dolibarr 20.0.0
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 */
17
18// Protection to avoid direct call of template
19if (empty($conf) || !is_object($conf)) {
20 print "Error, template page can't be called as URL";
21 exit(1);
22}
23
24require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
25
26print '<!-- BEGIN PHP TEMPLATE ONLINEPAYMENTLINKS -->';
27
28// Url list
29print '<u>'.$langs->trans("FollowingUrlAreAvailableToMakePayments").':</u><br><br>';
30print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePaymentOnFreeAmount", $servicename).':</span><br>';
31print '<strong class="wordbreak">'.getOnlinePaymentUrl(1, 'free')."</strong><br><br>\n";
32
33if (isModEnabled('order')) {
34 print '<div id="order"></div>';
35 print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePaymentOnOrder", $servicename).':</span><br>';
36 print '<strong class="wordbreak">'.getOnlinePaymentUrl(1, 'order')."</strong><br>\n";
37 if (getDolGlobalString('PAYMENT_SECURITY_TOKEN') && getDolGlobalString('PAYMENT_SECURITY_TOKEN_UNIQUE')) {
38 $langs->load("orders");
39 print '<form action="'.$_SERVER["PHP_SELF"].'#order" method="POST">';
40 print '<input type="hidden" name="token" value="'.newToken().'">';
41
42 print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("Order")).': ';
43 print '<input type="text class="flat" id="generate_order_ref" name="generate_order_ref" value="'.GETPOST('generate_order_ref', 'alpha').'" size="10">';
44 print '<input type="submit" class="none reposition button smallpaddingimp" value="'.$langs->trans("GetSecuredUrl").'">';
45 if (GETPOST('generate_order_ref', 'alpha')) {
46 $url = getOnlinePaymentUrl(0, 'order', GETPOST('generate_order_ref', 'alpha'));
47 print '<div class="urllink"><input type="text" class="wordbreak quatrevingtpercent" value="';
48 print $url;
49 print '"></div>'."\n";
50 }
51 print '</form>';
52 }
53 print '<br>';
54}
55if (isModEnabled('invoice')) {
56 print '<div id="invoice"></div>';
57 print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePaymentOnInvoice", $servicename).':</span><br>';
58 print '<strong class="wordbreak">'.getOnlinePaymentUrl(1, 'invoice')."</strong><br>\n";
59 if (getDolGlobalString('PAYMENT_SECURITY_TOKEN') && getDolGlobalString('PAYMENT_SECURITY_TOKEN_UNIQUE')) {
60 $langs->load("bills");
61 print '<form action="'.$_SERVER["PHP_SELF"].'#invoice" method="POST">';
62 print '<input type="hidden" name="token" value="'.newToken().'">';
63
64 print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("Invoice")).': ';
65 print '<input type="text class="flat" id="generate_invoice_ref" name="generate_invoice_ref" value="'.GETPOST('generate_invoice_ref', 'alpha').'" size="10">';
66 print '<input type="submit" class="none reposition button smallpaddingimp" value="'.$langs->trans("GetSecuredUrl").'">';
67 if (GETPOST('generate_invoice_ref', 'alpha')) {
68 $url = getOnlinePaymentUrl(0, 'invoice', GETPOST('generate_invoice_ref', 'alpha'));
69 print '<div class="urllink"><input type="text" class="wordbreak quatrevingtpercent" value="';
70 print $url;
71 print '"></div>'."\n";
72 }
73 print '</form>';
74 }
75 print '<br>';
76}
77if (isModEnabled('contract')) {
78 print '<div id="contractline"></div>';
79 print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePaymentOnContractLine", $servicename).':</span><br>';
80 print '<strong class="wordbreak">'.getOnlinePaymentUrl(1, 'contractline')."</strong><br>\n";
81 if (getDolGlobalString('PAYMENT_SECURITY_TOKEN') && getDolGlobalString('PAYMENT_SECURITY_TOKEN_UNIQUE')) {
82 $langs->load("contracts");
83 print '<form action="'.$_SERVER["PHP_SELF"].'#contractline" method="POST">';
84 print '<input type="hidden" name="token" value="'.newToken().'">';
85
86 print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("ContractLine")).': ';
87 print '<input type="text class="flat" id="generate_contract_ref" name="generate_contract_ref" value="'.GETPOST('generate_contract_ref', 'alpha').'" size="10">';
88 print '<input type="submit" class="none reposition button smallpaddingimp" value="'.$langs->trans("GetSecuredUrl").'">';
89 if (GETPOST('generate_contract_ref')) {
90 $url = getOnlinePaymentUrl(0, 'contractline', GETPOST('generate_contract_ref', 'alpha'));
91 print '<div class="urllink"><input type="text" class="wordbreak quatrevingtpercent" value="';
92 print $url;
93 print '"></div>'."\n";
94 }
95 print '</form>';
96 }
97 print '<br>';
98}
99if (isModEnabled('member')) {
100 print '<div id="membersubscription"></div>';
101 print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePaymentOnMemberSubscription", $servicename).':</span><br>';
102 print '<strong class="wordbreak">'.getOnlinePaymentUrl(1, 'membersubscription')."</strong><br>\n";
103 if (getDolGlobalString('PAYMENT_SECURITY_TOKEN') && getDolGlobalString('PAYMENT_SECURITY_TOKEN_UNIQUE')) {
104 $langs->load("members");
105 print '<form action="'.$_SERVER["PHP_SELF"].'#membersubscription" method="POST">';
106 print '<input type="hidden" name="token" value="'.newToken().'">';
107
108 print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("Member")).': ';
109 print '<input type="text class="flat" id="generate_member_ref" name="generate_member_ref" value="'.GETPOST('generate_member_ref', 'alpha').'" size="10">';
110 print '<input type="submit" class="none reposition button smallpaddingimp" value="'.$langs->trans("GetSecuredUrl").'">';
111 if (GETPOST('generate_member_ref')) {
112 $url = getOnlinePaymentUrl(0, 'membersubscription', GETPOST('generate_member_ref', 'alpha'));
113 print '<div class="urllink"><input type="text" class="wordbreak quatrevingtpercent" value="';
114 print $url;
115 print '"></div>'."\n";
116 }
117 print '</form>';
118 }
119 print '<br>';
120}
121if (isModEnabled('don')) {
122 print '<div id="donation"></div>';
123 print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePaymentOnDonation", $servicename).':</span><br>';
124 print '<strong class="wordbreak">'.getOnlinePaymentUrl(1, 'donation')."</strong><br>\n";
125 if (getDolGlobalString('PAYMENT_SECURITY_TOKEN') && getDolGlobalString('PAYMENT_SECURITY_TOKEN_UNIQUE')) {
126 $langs->load("members");
127 print '<form action="'.$_SERVER["PHP_SELF"].'#donation" method="POST">';
128 print '<input type="hidden" name="token" value="'.newToken().'">';
129
130 print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("Don")).': ';
131 print '<input type="text class="flat" id="generate_donation_ref" name="generate_donation_ref" value="'.GETPOST('generate_donation_ref', 'alpha').'" size="10">';
132 print '<input type="submit" class="none reposition button smallpaddingimp" value="'.$langs->trans("GetSecuredUrl").'">';
133 if (GETPOST('generate_donation_ref')) {
134 print '<div class="urllink"><input type="text" class="wordbreak quatrevingtpercent" value="';
135 $url = getOnlinePaymentUrl(0, 'donation', GETPOST('generate_donation_ref', 'alpha'));
136 print $url;
137 print '"></div>'."\n";
138 }
139 print '</form>';
140 }
141 print '<br>';
142}
143
144$constname = 'PAYMENT_SECURITY_TOKEN';
145
146// Add button to autosuggest a key
147include_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
148print dolJSToSetRandomPassword($constname);
149
150print info_admin($langs->trans("YouCanAddTagOnUrl"));
151
152if (isModEnabled('website')) {
153 print info_admin($langs->trans("YouCanEmbedOnWebsite"));
154}
155
156print '<!-- 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 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.
dolJSToSetRandomPassword($htmlname, $htmlnameofbutton='generate_token', $generic=1)
Output javascript to autoset a generated password using default module into a HTML element.