dolibarr  7.0.0-beta
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 <http://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('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnFreeAmount",$servicename).':<br>';
32 print '<strong>'.getOnlinePaymentUrl(1,'free')."</strong><br><br>\n";
33 if (! empty($conf->commande->enabled))
34 {
35  print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnOrder",$servicename).':<br>';
36  print '<strong>'.getOnlinePaymentUrl(1,'order')."</strong><br>\n";
37  if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE))
38  {
39  $langs->load("orders");
40  print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
41  print $langs->trans("EnterRefToBuildUrl",$langs->transnoentitiesnoconv("Order")).': ';
42  print '<input type="text class="flat" id="generate_order_ref" name="generate_order_ref" value="'.GETPOST('generate_order_ref','alpha').'" size="10">';
43  print '<input type="submit" class="none button" value="'.$langs->trans("GetSecuredUrl").'">';
44  if (GETPOST('generate_order_ref','alpha'))
45  {
46  print '<br> -> <strong>';
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 (! empty($conf->facture->enabled))
56 {
57  print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnInvoice",$servicename).':<br>';
58  print '<strong>'.getOnlinePaymentUrl(1,'invoice')."</strong><br>\n";
59  if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE))
60  {
61  $langs->load("bills");
62  print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
63  print $langs->trans("EnterRefToBuildUrl",$langs->transnoentitiesnoconv("Invoice")).': ';
64  print '<input type="text class="flat" id="generate_invoice_ref" name="generate_invoice_ref" value="'.GETPOST('generate_invoice_ref','alpha').'" size="10">';
65  print '<input type="submit" class="none button" value="'.$langs->trans("GetSecuredUrl").'">';
66  if (GETPOST('generate_invoice_ref','alpha'))
67  {
68  print '<br> -> <strong>';
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 {
79  print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnContractLine",$servicename).':<br>';
80  print '<strong>'.getOnlinePaymentUrl(1,'contractline')."</strong><br>\n";
81  if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE))
82  {
83  $langs->load("contract");
84  print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
85  print $langs->trans("EnterRefToBuildUrl",$langs->transnoentitiesnoconv("Contract")).': ';
86  print '<input type="text class="flat" id="generate_contract_ref" name="generate_contract_ref" value="'.GETPOST('generate_contract_ref','alpha').'" size="10">';
87  print '<input type="submit" class="none button" value="'.$langs->trans("GetSecuredUrl").'">';
88  if (GETPOST('generate_contract_ref'))
89  {
90  print '<br> -> <strong>';
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 {
101  print img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnMemberSubscription",$servicename).':<br>';
102  print '<strong>'.getOnlinePaymentUrl(1,'membersubscription')."</strong><br>\n";
103  if (! empty($conf->global->PAYMENT_SECURITY_TOKEN) && ! empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE))
104  {
105  $langs->load("members");
106  print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
107  print $langs->trans("EnterRefToBuildUrl",$langs->transnoentitiesnoconv("Member")).': ';
108  print '<input type="text class="flat" id="generate_member_ref" name="generate_member_ref" value="'.GETPOST('generate_member_ref','alpha').'" size="10">';
109  print '<input type="submit" class="none reposition button" value="'.$langs->trans("GetSecuredUrl").'">';
110  if (GETPOST('generate_member_ref'))
111  {
112  print '<br> -> <strong>';
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 
122 if (! empty($conf->use_javascript_ajax))
123 {
124  print "\n".'<script type="text/javascript">';
125  print '$(document).ready(function () {
126  $("#generate_token").click(function() {
127  $.get( "'.DOL_URL_ROOT.'/core/ajax/security.php", {
128  action: \'getrandompassword\',
129  generic: true
130  },
131  function(token) {
132  $("#PAYMENT_SECURITY_TOKEN").val(token);
133  });
134  });
135  });';
136  print '</script>';
137 }
138 
139 print info_admin($langs->trans("YouCanAddTagOnUrl"));
140 
141 print '<!-- END PHP TEMPLATE ONLINEPAYMENTLINKS -->';
142 
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='')
Show picto whatever it's its name (generic function)
GETPOST($paramname, $check='none', $method=0, $filter=NULL, $options=NULL, $noreplace=0)
Return value of a param into GET or POST supervariable.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1')
Show information for admin users or standard users.
print
Draft customers invoices.
Definition: index.php:91