onlinepaymentlinks.tpl.php 7.9 KB

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