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