dolibarr  16.0.5
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
19 if (empty($conf) || !is_object($conf)) {
20  print "Error, template page can't be called as URL";
21  exit;
22 }
23 
24 require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
25 
26 print '<!-- BEGIN PHP TEMPLATE ONLINEPAYMENTLINKS -->';
27 
28 // Url list
29 print '<u>'.$langs->trans("FollowingUrlAreAvailableToMakePayments").':</u><br><br>';
30 print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForOnlinePaymentOnFreeAmount", $servicename).':</span><br>';
31 print '<strong class="wordbreak">'.getOnlinePaymentUrl(1, 'free')."</strong><br><br>\n";
32 
33 if (!empty($conf->commande->enabled)) {
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 (!empty($conf->global->PAYMENT_SECURITY_TOKEN) && !empty($conf->global->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  print '<br> -> <strong class="wordbreak">';
47  $url = getOnlinePaymentUrl(0, 'order', GETPOST('generate_order_ref', 'alpha'));
48  print $url;
49  print "</strong><br>\n";
50  }
51  print '</form>';
52  }
53  print '<br>';
54 }
55 if (isModEnabled('facture')) {
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 (!empty($conf->global->PAYMENT_SECURITY_TOKEN) && !empty($conf->global->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  print '<br> -> <strong class="wordbreak">';
69  $url = getOnlinePaymentUrl(0, 'invoice', GETPOST('generate_invoice_ref', 'alpha'));
70  print $url;
71  print "</strong><br>\n";
72  }
73  print '</form>';
74  }
75  print '<br>';
76 }
77 if (!empty($conf->contrat->enabled)) {
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 (!empty($conf->global->PAYMENT_SECURITY_TOKEN) && !empty($conf->global->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  print '<br> -> <strong class="wordbreak">';
91  $url = getOnlinePaymentUrl(0, 'contractline', GETPOST('generate_contract_ref', 'alpha'));
92  print $url;
93  print "</strong><br>\n";
94  }
95  print '</form>';
96  }
97  print '<br>';
98 }
99 if (!empty($conf->adherent->enabled)) {
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 (!empty($conf->global->PAYMENT_SECURITY_TOKEN) && !empty($conf->global->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  print '<br> -> <strong class="wordbreak">';
113  $url = getOnlinePaymentUrl(0, 'membersubscription', GETPOST('generate_member_ref', 'alpha'));
114  print $url;
115  print "</strong><br>\n";
116  }
117  print '</form>';
118  }
119  print '<br>';
120 }
121 if (!empty($conf->don->enabled)) {
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 (!empty($conf->global->PAYMENT_SECURITY_TOKEN) && !empty($conf->global->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 '<br> -> <strong class="wordbreak">';
135  $url = getOnlinePaymentUrl(0, 'donation', GETPOST('generate_donation_ref', 'alpha'));
136  print $url;
137  print "</strong><br>\n";
138  }
139  print '</form>';
140  }
141  print '<br>';
142 }
143 
144 if (!empty($conf->use_javascript_ajax)) {
145  print "\n".'<script>';
146  print '$(document).ready(function () {
147  $("#generate_token").click(function() {
148  $.get( "'.DOL_URL_ROOT.'/core/ajax/security.php", {
149  action: \'getrandompassword\',
150  generic: true
151  },
152  function(token) {
153  $("#PAYMENT_SECURITY_TOKEN").val(token);
154  });
155  });
156  });';
157  print '</script>';
158 }
159 
160 print info_admin($langs->trans("YouCanAddTagOnUrl"));
161 
162 print '<!-- END PHP TEMPLATE ONLINEPAYMENTLINKS -->';
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:484
img_picto
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
Definition: functions.lib.php:3880
info_admin
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='')
Show information for admin users or standard users.
Definition: functions.lib.php:4800
isModEnabled
isModEnabled($module)
Is Dolibarr module enabled.
Definition: functions.lib.php:105