dolibarr 21.0.0-beta
onlinepaymentlinks.tpl.php
1<?php
2/* Copyright (C) 2017 Laurent Destailleur <eldy@destailleur.fr>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
22// Protection to avoid direct call of template
23if (empty($conf) || !is_object($conf)) {
24 print "Error, template page can't be called as URL";
25 exit(1);
26}
27
28require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
29
30print '<!-- BEGIN PHP TEMPLATE ONLINEPAYMENTLINKS -->';
31
32// Url list
33print '<u>'.$langs->trans("FollowingUrlAreAvailableToMakePayments").':</u><br><br>';
34print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePaymentOnFreeAmount", $servicename).':</span><br>';
35print '<strong class="wordbreak">'.getOnlinePaymentUrl(1, 'free')."</strong><br><br>\n";
36
37if (isModEnabled('order')) {
38 print '<div id="order"></div>';
39 print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePaymentOnOrder", $servicename).':</span><br>';
40 print '<strong class="wordbreak">'.getOnlinePaymentUrl(1, 'order')."</strong><br>\n";
41 if (getDolGlobalString('PAYMENT_SECURITY_TOKEN') && getDolGlobalString('PAYMENT_SECURITY_TOKEN_UNIQUE')) {
42 $langs->load("orders");
43 print '<form action="'.$_SERVER["PHP_SELF"].'#order" method="POST">';
44 print '<input type="hidden" name="token" value="'.newToken().'">';
45
46 print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("Order")).': ';
47 print '<input type="text class="flat" id="generate_order_ref" name="generate_order_ref" value="'.GETPOST('generate_order_ref', 'alpha').'" size="10">';
48 print '<input type="submit" class="none reposition button smallpaddingimp" value="'.$langs->trans("GetSecuredUrl").'">';
49 if (GETPOST('generate_order_ref', 'alpha')) {
50 $url = getOnlinePaymentUrl(0, 'order', GETPOST('generate_order_ref', 'alpha'));
51 print '<div class="urllink"><input type="text" class="wordbreak quatrevingtpercent" value="';
52 print $url;
53 print '"></div>'."\n";
54 }
55 print '</form>';
56 }
57 print '<br>';
58}
59if (isModEnabled('invoice')) {
60 print '<div id="invoice"></div>';
61 print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePaymentOnInvoice", $servicename).':</span><br>';
62 print '<strong class="wordbreak">'.getOnlinePaymentUrl(1, 'invoice')."</strong><br>\n";
63 if (getDolGlobalString('PAYMENT_SECURITY_TOKEN') && getDolGlobalString('PAYMENT_SECURITY_TOKEN_UNIQUE')) {
64 $langs->load("bills");
65 print '<form action="'.$_SERVER["PHP_SELF"].'#invoice" method="POST">';
66 print '<input type="hidden" name="token" value="'.newToken().'">';
67
68 print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("Invoice")).': ';
69 print '<input type="text class="flat" id="generate_invoice_ref" name="generate_invoice_ref" value="'.GETPOST('generate_invoice_ref', 'alpha').'" size="10">';
70 print '<input type="submit" class="none reposition button smallpaddingimp" value="'.$langs->trans("GetSecuredUrl").'">';
71 if (GETPOST('generate_invoice_ref', 'alpha')) {
72 $url = getOnlinePaymentUrl(0, 'invoice', GETPOST('generate_invoice_ref', 'alpha'));
73 print '<div class="urllink"><input type="text" class="wordbreak quatrevingtpercent" value="';
74 print $url;
75 print '"></div>'."\n";
76 }
77 print '</form>';
78 }
79 print '<br>';
80}
81if (isModEnabled('contract')) {
82 print '<div id="contractline"></div>';
83 print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePaymentOnContractLine", $servicename).':</span><br>';
84 print '<strong class="wordbreak">'.getOnlinePaymentUrl(1, 'contractline')."</strong><br>\n";
85 if (getDolGlobalString('PAYMENT_SECURITY_TOKEN') && getDolGlobalString('PAYMENT_SECURITY_TOKEN_UNIQUE')) {
86 $langs->load("contracts");
87 print '<form action="'.$_SERVER["PHP_SELF"].'#contractline" method="POST">';
88 print '<input type="hidden" name="token" value="'.newToken().'">';
89
90 print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("ContractLine")).': ';
91 print '<input type="text class="flat" id="generate_contract_ref" name="generate_contract_ref" value="'.GETPOST('generate_contract_ref', 'alpha').'" size="10">';
92 print '<input type="submit" class="none reposition button smallpaddingimp" value="'.$langs->trans("GetSecuredUrl").'">';
93 if (GETPOST('generate_contract_ref')) {
94 $url = getOnlinePaymentUrl(0, 'contractline', GETPOST('generate_contract_ref', 'alpha'));
95 print '<div class="urllink"><input type="text" class="wordbreak quatrevingtpercent" value="';
96 print $url;
97 print '"></div>'."\n";
98 }
99 print '</form>';
100 }
101 print '<br>';
102}
103if (isModEnabled('member')) {
104 print '<div id="membersubscription"></div>';
105 print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePaymentOnMemberSubscription", $servicename).':</span><br>';
106 print '<strong class="wordbreak">'.getOnlinePaymentUrl(1, 'membersubscription')."</strong><br>\n";
107 if (getDolGlobalString('PAYMENT_SECURITY_TOKEN') && getDolGlobalString('PAYMENT_SECURITY_TOKEN_UNIQUE')) {
108 $langs->load("members");
109 print '<form action="'.$_SERVER["PHP_SELF"].'#membersubscription" method="POST">';
110 print '<input type="hidden" name="token" value="'.newToken().'">';
111
112 print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("Member")).': ';
113 print '<input type="text class="flat" id="generate_member_ref" name="generate_member_ref" value="'.GETPOST('generate_member_ref', 'alpha').'" size="10">';
114 print '<input type="submit" class="none reposition button smallpaddingimp" value="'.$langs->trans("GetSecuredUrl").'">';
115 if (GETPOST('generate_member_ref')) {
116 $url = getOnlinePaymentUrl(0, 'membersubscription', GETPOST('generate_member_ref', 'alpha'));
117 print '<div class="urllink"><input type="text" class="wordbreak quatrevingtpercent" value="';
118 print $url;
119 print '"></div>'."\n";
120 }
121 print '</form>';
122 }
123 print '<br>';
124}
125if (isModEnabled('don')) {
126 print '<div id="donation"></div>';
127 print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePaymentOnDonation", $servicename).':</span><br>';
128 print '<strong class="wordbreak">'.getOnlinePaymentUrl(1, 'donation')."</strong><br>\n";
129 if (getDolGlobalString('PAYMENT_SECURITY_TOKEN') && getDolGlobalString('PAYMENT_SECURITY_TOKEN_UNIQUE')) {
130 $langs->load("members");
131 print '<form action="'.$_SERVER["PHP_SELF"].'#donation" method="POST">';
132 print '<input type="hidden" name="token" value="'.newToken().'">';
133
134 print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("Don")).': ';
135 print '<input type="text class="flat" id="generate_donation_ref" name="generate_donation_ref" value="'.GETPOST('generate_donation_ref', 'alpha').'" size="10">';
136 print '<input type="submit" class="none reposition button smallpaddingimp" value="'.$langs->trans("GetSecuredUrl").'">';
137 if (GETPOST('generate_donation_ref')) {
138 print '<div class="urllink"><input type="text" class="wordbreak quatrevingtpercent" value="';
139 $url = getOnlinePaymentUrl(0, 'donation', GETPOST('generate_donation_ref', 'alpha'));
140 print $url;
141 print '"></div>'."\n";
142 }
143 print '</form>';
144 }
145 print '<br>';
146}
147
148$constname = 'PAYMENT_SECURITY_TOKEN';
149
150// Add button to autosuggest a key
151include_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
152print dolJSToSetRandomPassword($constname);
153
154print info_admin($langs->trans("YouCanAddTagOnUrl"));
155
156if (isModEnabled('website')) {
157 print info_admin($langs->trans("YouCanEmbedOnWebsite"));
158}
159
160print '<!-- END PHP TEMPLATE ONLINEPAYMENTLINKS -->';
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
dolJSToSetRandomPassword($htmlname, $htmlnameofbutton='generate_token', $generic=1)
Output javascript to autoset a generated password using default module into a HTML element.