dolibarr  13.0.2
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 {
21  print "Error, template page can't be called as URL";
22  exit;
23 }
24 
25 require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
26 
27 print '<!-- BEGIN PHP TEMPLATE ONLINEPAYMENTLINKS -->';
28 
29 // Url list
30 print '<u>'.$langs->trans("FollowingUrlAreAvailableToMakePayments").':</u><br><br>';
31 print img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnFreeAmount", $servicename).':<br>';
32 print '<strong class="wordbreak">'.getOnlinePaymentUrl(1, 'free')."</strong><br><br>\n";
33 if (!empty($conf->commande->enabled))
34 {
35  print '<div id="order"></div>';
36  print img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnOrder", $servicename).':<br>';
37  print '<strong class="wordbreak">'.getOnlinePaymentUrl(1, 'order')."</strong><br>\n";
38  if (!empty($conf->global->PAYMENT_SECURITY_TOKEN) && !empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE))
39  {
40  $langs->load("orders");
41  print '<form action="'.$_SERVER["PHP_SELF"].'#order" method="POST">';
42  print '<input type="hidden" name="token" value="'.newToken().'">';
43 
44  print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("Order")).': ';
45  print '<input type="text class="flat" id="generate_order_ref" name="generate_order_ref" value="'.GETPOST('generate_order_ref', 'alpha').'" size="10">';
46  print '<input type="submit" class="none button" value="'.$langs->trans("GetSecuredUrl").'">';
47  if (GETPOST('generate_order_ref', 'alpha'))
48  {
49  print '<br> -> <strong class="wordbreak">';
50  $url = getOnlinePaymentUrl(0, 'order', GETPOST('generate_order_ref', 'alpha'));
51  print $url;
52  print "</strong><br>\n";
53  }
54  print '</form>';
55  }
56  print '<br>';
57 }
58 if (!empty($conf->facture->enabled))
59 {
60  print '<div id="invoice"></div>';
61  print img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnInvoice", $servicename).':<br>';
62  print '<strong class="wordbreak">'.getOnlinePaymentUrl(1, 'invoice')."</strong><br>\n";
63  if (!empty($conf->global->PAYMENT_SECURITY_TOKEN) && !empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE))
64  {
65  $langs->load("bills");
66  print '<form action="'.$_SERVER["PHP_SELF"].'#invoice" method="POST">';
67  print '<input type="hidden" name="token" value="'.newToken().'">';
68 
69  print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("Invoice")).': ';
70  print '<input type="text class="flat" id="generate_invoice_ref" name="generate_invoice_ref" value="'.GETPOST('generate_invoice_ref', 'alpha').'" size="10">';
71  print '<input type="submit" class="none button" value="'.$langs->trans("GetSecuredUrl").'">';
72  if (GETPOST('generate_invoice_ref', 'alpha'))
73  {
74  print '<br> -> <strong class="wordbreak">';
75  $url = getOnlinePaymentUrl(0, 'invoice', GETPOST('generate_invoice_ref', 'alpha'));
76  print $url;
77  print "</strong><br>\n";
78  }
79  print '</form>';
80  }
81  print '<br>';
82 }
83 if (!empty($conf->contrat->enabled))
84 {
85  print '<div id="contractline"></div>';
86  print img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnContractLine", $servicename).':<br>';
87  print '<strong class="wordbreak">'.getOnlinePaymentUrl(1, 'contractline')."</strong><br>\n";
88  if (!empty($conf->global->PAYMENT_SECURITY_TOKEN) && !empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE))
89  {
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 button" value="'.$langs->trans("GetSecuredUrl").'">';
97  if (GETPOST('generate_contract_ref'))
98  {
99  print '<br> -> <strong class="wordbreak">';
100  $url = getOnlinePaymentUrl(0, 'contractline', GETPOST('generate_contract_ref', 'alpha'));
101  print $url;
102  print "</strong><br>\n";
103  }
104  print '</form>';
105  }
106  print '<br>';
107 }
108 if (!empty($conf->adherent->enabled))
109 {
110  print '<div id="membersubscription"></div>';
111  print img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnMemberSubscription", $servicename).':<br>';
112  print '<strong class="wordbreak">'.getOnlinePaymentUrl(1, 'membersubscription')."</strong><br>\n";
113  if (!empty($conf->global->PAYMENT_SECURITY_TOKEN) && !empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE))
114  {
115  $langs->load("members");
116  print '<form action="'.$_SERVER["PHP_SELF"].'#membersubscription" method="POST">';
117  print '<input type="hidden" name="token" value="'.newToken().'">';
118 
119  print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("Member")).': ';
120  print '<input type="text class="flat" id="generate_member_ref" name="generate_member_ref" value="'.GETPOST('generate_member_ref', 'alpha').'" size="10">';
121  print '<input type="submit" class="none reposition button" value="'.$langs->trans("GetSecuredUrl").'">';
122  if (GETPOST('generate_member_ref'))
123  {
124  print '<br> -> <strong class="wordbreak">';
125  $url = getOnlinePaymentUrl(0, 'membersubscription', GETPOST('generate_member_ref', 'alpha'));
126  print $url;
127  print "</strong><br>\n";
128  }
129  print '</form>';
130  }
131  print '<br>';
132 }
133 if (!empty($conf->don->enabled))
134 {
135  print '<div id="donation"></div>';
136  print img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnDonation", $servicename).':<br>';
137  print '<strong class="wordbreak">'.getOnlinePaymentUrl(1, 'donation')."</strong><br>\n";
138  if (!empty($conf->global->PAYMENT_SECURITY_TOKEN) && !empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE))
139  {
140  $langs->load("members");
141  print '<form action="'.$_SERVER["PHP_SELF"].'#donation" method="POST">';
142  print '<input type="hidden" name="token" value="'.newToken().'">';
143 
144  print $langs->trans("EnterRefToBuildUrl", $langs->transnoentitiesnoconv("Don")).': ';
145  print '<input type="text class="flat" id="generate_donation_ref" name="generate_donation_ref" value="'.GETPOST('generate_donation_ref', 'alpha').'" size="10">';
146  print '<input type="submit" class="none reposition button" value="'.$langs->trans("GetSecuredUrl").'">';
147  if (GETPOST('generate_donation_ref'))
148  {
149  print '<br> -> <strong class="wordbreak">';
150  $url = getOnlinePaymentUrl(0, 'donation', GETPOST('generate_donation_ref', 'alpha'));
151  print $url;
152  print "</strong><br>\n";
153  }
154  print '</form>';
155  }
156  print '<br>';
157 }
158 
159 if (!empty($conf->use_javascript_ajax))
160 {
161  print "\n".'<script>';
162  print '$(document).ready(function () {
163  $("#generate_token").click(function() {
164  $.get( "'.DOL_URL_ROOT.'/core/ajax/security.php", {
165  action: \'getrandompassword\',
166  generic: true
167  },
168  function(token) {
169  $("#PAYMENT_SECURITY_TOKEN").val(token);
170  });
171  });
172  });';
173  print '</script>';
174 }
175 
176 print info_admin($langs->trans("YouCanAddTagOnUrl"));
177 
178 print '<!-- END PHP TEMPLATE ONLINEPAYMENTLINKS -->';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it&#39;s its name (generic function)
print
Draft customers invoices.
Definition: index.php:89
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin= '1', $morecss= '', $textfordropdown= '')
Show information for admin users or standard users.