dolibarr 24.0.2
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
36print '<div class="info">';
37
38// Url list
39print '<u>'.$langs->trans("FollowingUrlAreAvailableToMakePayments").':</u><br><br>';
40print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePaymentOnFreeAmount", $servicename).':</span><br>';
41print '<strong class="wordbreak">'.getOnlinePaymentUrl(1, 'free')."</strong><br><br>\n";
42
43if (isModEnabled('order')) {
44 print '<div id="order"></div>';
45 print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePaymentOnOrder", $servicename).':</span><br>';
46 print '<strong class="wordbreak">'.getOnlinePaymentUrl(1, 'order')."</strong><br>\n";
47 if (getDolGlobalString('PAYMENT_SECURITY_TOKEN')) {
48 $langs->load("orders");
49 print '<form action="'.$_SERVER["PHP_SELF"].'#order" method="POST">';
50 print '<input type="hidden" name="token" value="'.newToken().'">';
51
52 print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("Order")).':<br>';
53 print '<input type="text class="flat" id="generate_order_ref" name="generate_order_ref" value="'.GETPOST('generate_order_ref', 'alpha').'" size="10">';
54 print '<input type="submit" class="none reposition button smallpaddingimp" value="'.$langs->trans("GetSecuredUrl").'">';
55 if (GETPOST('generate_order_ref', 'alpha')) {
56 $url = getOnlinePaymentUrl(0, 'order', GETPOST('generate_order_ref', 'alpha'));
57 print '<div class="urllinkno"><input type="text" class="wordbreak quatrevingtpercent" value="';
58 print $url;
59 print '" spellcheck="false"></div>'."\n";
60 }
61 print '</form>';
62 }
63 print '<br>';
64}
65if (isModEnabled('invoice')) {
66 print '<div id="invoice"></div>';
67 print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePaymentOnInvoice", $servicename).':</span><br>';
68 print '<strong class="wordbreak">'.getOnlinePaymentUrl(1, 'invoice')."</strong><br>\n";
69 if (getDolGlobalString('PAYMENT_SECURITY_TOKEN')) {
70 $langs->load("bills");
71 print '<form action="'.$_SERVER["PHP_SELF"].'#invoice" method="POST">';
72 print '<input type="hidden" name="token" value="'.newToken().'">';
73
74 print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("Invoice")).':<br>';
75 print '<input type="text class="flat" id="generate_invoice_ref" name="generate_invoice_ref" value="'.GETPOST('generate_invoice_ref', 'alpha').'" size="10">';
76 print '<input type="submit" class="none reposition button smallpaddingimp" value="'.$langs->trans("GetSecuredUrl").'">';
77 if (GETPOST('generate_invoice_ref', 'alpha')) {
78 $url = getOnlinePaymentUrl(0, 'invoice', GETPOST('generate_invoice_ref', 'alpha'));
79 print '<div class="urllinkno"><input type="text" class="wordbreak quatrevingtpercent" value="';
80 print $url;
81 print '" spellcheck="false"></div>'."\n";
82 }
83 print '</form>';
84 }
85 print '<br>';
86}
87if (isModEnabled('contract')) {
88 print '<div id="contractline"></div>';
89 print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePaymentOnContractLine", $servicename).':</span><br>';
90 print '<strong class="wordbreak">'.getOnlinePaymentUrl(1, 'contractline')."</strong><br>\n";
91 if (getDolGlobalString('PAYMENT_SECURITY_TOKEN')) {
92 $langs->load("contracts");
93 print '<form action="'.$_SERVER["PHP_SELF"].'#contractline" method="POST">';
94 print '<input type="hidden" name="token" value="'.newToken().'">';
95
96 print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("ContractLine")).':<br>';
97 print '<input type="text class="flat" id="generate_contract_ref" name="generate_contract_ref" value="'.GETPOST('generate_contract_ref', 'alpha').'" size="10">';
98 print '<input type="submit" class="none reposition button smallpaddingimp" value="'.$langs->trans("GetSecuredUrl").'">';
99 if (GETPOST('generate_contract_ref')) {
100 $url = getOnlinePaymentUrl(0, 'contractline', GETPOST('generate_contract_ref', 'alpha'));
101 print '<div class="urllinkno"><input type="text" class="wordbreak quatrevingtpercent" value="';
102 print $url;
103 print '" spellcheck="false"></div>'."\n";
104 }
105 print '</form>';
106 }
107 print '<br>';
108}
109if (isModEnabled('member')) {
110 print '<div id="membersubscription"></div>';
111 print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePaymentOnMemberSubscription", $servicename).':</span><br>';
112 print '<strong class="wordbreak">'.getOnlinePaymentUrl(1, 'membersubscription')."</strong><br>\n";
113 if (getDolGlobalString('PAYMENT_SECURITY_TOKEN')) {
114 $langs->load("members");
115 print '<form action="'.$_SERVER["PHP_SELF"].'#membersubscription" method="POST">';
116 print '<input type="hidden" name="token" value="'.newToken().'">';
117
118 print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("Member")).':<br>';
119 print '<input type="text class="flat" id="generate_member_ref" name="generate_member_ref" value="'.GETPOST('generate_member_ref', 'alpha').'" size="10">';
120 print '<input type="submit" class="none reposition button smallpaddingimp" value="'.$langs->trans("GetSecuredUrl").'">';
121 if (GETPOST('generate_member_ref')) {
122 $url = getOnlinePaymentUrl(0, 'membersubscription', GETPOST('generate_member_ref', 'alpha'));
123 print '<div class="urllinkno"><input type="text" class="wordbreak quatrevingtpercent" value="';
124 print $url;
125 print '" spellcheck="false"></div>'."\n";
126 }
127 print '</form>';
128 }
129 print '<br>';
130}
131if (isModEnabled('don')) {
132 print '<div id="donation"></div>';
133 print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePaymentOnDonation", $servicename).':</span><br>';
134 print '<strong class="wordbreak">'.getOnlinePaymentUrl(1, 'donation')."</strong><br>\n";
135 if (getDolGlobalString('PAYMENT_SECURITY_TOKEN')) {
136 $langs->load("members");
137 print '<form action="'.$_SERVER["PHP_SELF"].'#donation" method="POST">';
138 print '<input type="hidden" name="token" value="'.newToken().'">';
139
140 print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("Don")).':<br>';
141 print '<input type="text class="flat" id="generate_donation_ref" name="generate_donation_ref" value="'.GETPOST('generate_donation_ref', 'alpha').'" size="10">';
142 print '<input type="submit" class="none reposition button smallpaddingimp" value="'.$langs->trans("GetSecuredUrl").'">';
143 if (GETPOST('generate_donation_ref')) {
144 print '<div class="urllinkno"><input type="text" class="wordbreak quatrevingtpercent" value="';
145 $url = getOnlinePaymentUrl(0, 'donation', GETPOST('generate_donation_ref', 'alpha'));
146 print $url;
147 print '" spellcheck="false"></div>'."\n";
148 }
149 print '</form>';
150 }
151 print '<br>';
152}
153
154print $langs->trans("YouCanAddTagOnUrl");
155
156print '</div>';
157
158$constname = 'PAYMENT_SECURITY_TOKEN';
159
160// Add button to autosuggest a key
161include_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
162print dolJSToSetRandomPassword($constname);
163
164
165if (isModEnabled('website')) {
166 print info_admin($langs->trans("YouCanEmbedOnWebsite"));
167}
168
169print '<!-- END PHP TEMPLATE ONLINEPAYMENTLINKS -->';
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
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, $nodefault=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='', $textonpictotooltip='', $cssfordropdown='info_admin')
Show information in HTML for admin users or standard users.
dolJSToSetRandomPassword($htmlname, $htmlnameofbutton='generate_token', $generic=1)
Output javascript to autoset a generated password using default module into a HTML element.