32if (!defined(
'NOTOKENRENEWAL')) {
33 define(
'NOTOKENRENEWAL',
'1');
35if (!defined(
'NOREQUIREMENU')) {
36 define(
'NOREQUIREMENU',
'1');
38if (!defined(
'NOREQUIREHTML')) {
39 define(
'NOREQUIREHTML',
'1');
43require
'../main.inc.php';
44require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
45require_once DOL_DOCUMENT_ROOT.
'/stripe/class/stripe.class.php';
57$langs->loadLangs(array(
"main",
"bills",
"cashdesk",
"banks"));
59$place = (
GETPOST(
'place',
'aZ09') ?
GETPOST(
'place',
'aZ09') :
'0');
63$hookmanager->initHooks(array(
'takepospay'));
65if (!$user->hasRight(
'takepos',
'run')) {
74$arrayofcss = array(
'/takepos/css/pos.css.php');
82$head =
'<link rel="stylesheet" href="css/pos.css.php">';
84 $head .=
'<link rel="stylesheet" href="css/colorful.css">';
87top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
93$usestripeterminals = 0;
94$keyforstripeterminalbank =
'';
98if (isModEnabled(
'stripe')) {
99 $service =
'StripeTest';
102 $service =
'StripeLive';
107 global $stripearrayofkeysbyenv;
108 $site_account = $stripearrayofkeysbyenv[$servicestatus][
'publishable_key'];
110 $stripe =
new Stripe($db);
111 $stripeacc = $stripe->getStripeAccount($service);
113 include_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
114 $invoicetmp =
new Facture($db);
115 $invoicetmp->fetch($invoiceid);
116 $stripecu = $stripe->getStripeCustomerAccount($invoicetmp->socid, $servicestatus, $site_account);
117 $keyforstripeterminalbank =
"CASHDESK_ID_BANKACCOUNT_STRIPETERMINAL".(empty($_SESSION[
'takeposterminal']) ?
'' : $_SESSION[
'takeposterminal']);
121 if ($usestripeterminals) {
123<script src=
"https://js.stripe.com/terminal/v1/"></script>
125var terminal = StripeTerminal.create({
126 onFetchConnectionToken: fetchConnectionToken,
127 onUnexpectedReaderDisconnect: unexpectedDisconnect,
130function unexpectedDisconnect() {
133 console.log(
"Disconnected from reader")
136function fetchConnectionToken() {
138 $urlconnexiontoken = DOL_URL_ROOT.
'/stripe/ajax/ajax.php?action=getConnexionToken&token='.
newToken().
'&servicestatus='.urlencode((
string) ($servicestatus));
142 if (!empty($stripeacc)) {
143 $urlconnexiontoken .=
'&stripeacc='.urlencode($stripeacc);
146 return fetch(
'<?php echo $urlconnexiontoken; ?>', { method:
"POST" })
147 .then(
function(response) {
148 return response.json();
150 .then(
function(data) {
160if (isModEnabled(
'stripe') && isset($keyforstripeterminalbank) && (!
getDolGlobalString(
'STRIPE_LIVE') ||
GETPOST(
'forcesandbox',
'alpha'))) {
161 dol_htmloutput_mesg($langs->trans(
'YouAreCurrentlyInSandboxMode',
'Stripe'), [],
'warning', 1);
166 $invoice->fetch($invoiceid);
168 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture";
169 $sql .=
" WHERE entity IN (".getEntity(
'invoice').
")";
170 $sql .=
" AND ref = '(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")'";
171 $resql = $db->query($sql);
172 $obj = $db->fetch_object($resql);
174 $invoiceid = $obj->rowid;
179 $invoice->fetch($invoiceid);
186if ($usestripeterminals && $invoice->type != $invoice::TYPE_CREDIT_NOTE) {
189 simulated: <?php
if (empty($servicestatus) &&
getDolGlobalString(
'STRIPE_TERMINAL_SIMULATED')) { ?>
true <?php }
else { ?> false <?php } ?>
190 <?php
if (
getDolGlobalString(
'STRIPE_LOCATION')) { ?>, location:
'<?php echo dol_escape_js(getDolGlobalString('STRIPE_LOCATION
')); ?>'<?php } ?>
192 terminal.discoverReaders(config).then(
function(discoverResult) {
193 if (discoverResult.error) {
194 console.log(
'Failed to discover: ', discoverResult.error);
195 }
else if (discoverResult.discoveredReaders.length === 0) {
196 console.log(
'No available readers.');
200 selectedReader = discoverResult.discoveredReaders[0];
203 terminal.connectReader(selectedReader).then(function(connectResult) {
204 if (connectResult.error) {
205 document.getElementById(
"card-present-alert").innerHTML =
'<div class="error">'+connectResult.error.message+
'</div>';
206 console.log(
'Failed to connect: ', connectResult.error);
208 document.getElementById(
"card-present-alert").innerHTML =
'';
209 console.log(
'Connected to reader: ', connectResult.reader.label);
210 if (document.getElementById(
"StripeTerminal")) {
211 document.getElementById(
"StripeTerminal").innerHTML =
'<button type="button" class="calcbutton2" onclick="ValidateStripeTerminal();"><span class="fa fa-2x fa-credit-card iconwithlabel"></span><br>'+connectResult.reader.label+
'</button>';
218 terminal.connectReader(<?php echo json_encode($stripe->getSelectedReader(
getDolGlobalString($keyforstripeterminalbank), $stripeacc, $servicestatus)); ?>).then(
function(connectResult) {
219 if (connectResult.error) {
220 document.getElementById(
"card-present-alert").innerHTML =
'<div class="error clearboth">'+connectResult.error.message+
'</div>';
221 console.log(
'Failed to connect: ', connectResult.error);
223 document.getElementById(
"card-present-alert").innerHTML =
'';
224 console.log(
'Connected to reader: ', connectResult.reader.label);
225 if (document.getElementById(
"StripeTerminal")) {
226 document.getElementById(
"StripeTerminal").innerHTML =
'<button type="button" class="calcbutton2" onclick="ValidateStripeTerminal();"><span class="fa fa-2x fa-credit-card iconwithlabel"></span><br>'+connectResult.reader.label+
'</button>';
237$arrayOfValidPaymentModes = array();
238$arrayOfValidBankAccount = array();
240$sql =
"SELECT code, libelle as label FROM ".MAIN_DB_PREFIX.
"c_paiement";
241$sql .=
" WHERE entity IN (".getEntity(
'c_paiement').
")";
242$sql .=
" AND active = 1";
243$sql .=
" ORDER BY libelle";
244$resql = $db->query($sql);
247 while ($obj = $db->fetch_object($resql)) {
248 $paycode = $obj->code;
249 if ($paycode ==
'LIQ') {
252 if ($paycode ==
'CB') {
255 if ($paycode ==
'CHQ') {
259 $accountname =
"CASHDESK_ID_BANKACCOUNT_".$paycode.$_SESSION[
"takeposterminal"];
262 $arrayOfValidPaymentModes[] = $obj;
264 if (!isModEnabled(
'bank')) {
265 if ($paycode ==
'CASH' || $paycode ==
'CB') {
266 $arrayOfValidPaymentModes[] = $obj;
277if ($invoice->id > 0) {
278 $remaintopay = $invoice->getRemainToPay();
280$alreadypayed = (is_object($invoice) ? ($invoice->total_ttc - $remaintopay) : 0);
283 print
"var received='';";
285 print
"var received=0;";
289 var alreadypayed = <?php echo $alreadypayed ?>;
291 function addreceived(
price)
295 print
'received+=String(price);'.
"\n";
297 print
'received+=parseFloat(price);'.
"\n";
300 $(
'.change1').html(
pricejs(parseFloat(received),
'MT'));
301 $(
'.change1').val(parseFloat(received));
302 alreadypaydplusreceived=
price2numjs(alreadypayed + parseFloat(received));
305 if (alreadypaydplusreceived > <?php echo (
float) $invoice->total_ttc; ?>)
307 var change=parseFloat(alreadypayed + parseFloat(received) - <?php echo (
float) $invoice->total_ttc; ?>);
308 $(
'.change2').html(
pricejs(change,
'MT'));
309 $(
'.change2').val(change);
310 $(
'.change1').removeClass(
'colorred');
311 $(
'.change1').addClass(
'colorgreen');
312 $(
'.change2').removeClass(
'colorwhite');
313 $(
'.change2').addClass(
'colorred');
317 $(
'.change2').html(
pricejs(0,
'MT'));
318 $(
'.change2').val(0);
319 if (alreadypaydplusreceived == <?php echo $invoice->total_ttc; ?>)
321 $(
'.change1').removeClass(
'colorred');
322 $(
'.change1').addClass(
'colorgreen');
323 $(
'.change2').removeClass(
'colorred');
324 $(
'.change2').addClass(
'colorwhite');
328 $(
'.change1').removeClass(
'colorgreen');
329 $(
'.change1').addClass(
'colorred');
330 $(
'.change2').removeClass(
'colorred');
331 $(
'.change2').addClass(
'colorwhite');
341 $(
'.change1').html(
pricejs(received,
'MT'));
343 $(
'.change2').html(
pricejs(received,
'MT'));
345 $(
'.change1').removeClass(
'colorgreen');
346 $(
'.change1').addClass(
'colorred');
347 $(
'.change2').removeClass(
'colorred');
348 $(
'.change2').addClass(
'colorwhite');
353 console.log(
"Launch Validate");
355 var invoiceid = <?php echo($invoiceid > 0 ? $invoiceid : 0); ?>;
356 var accountid = $(
"#selectaccountid").val();
357 var amountpayed = $(
"#change1").val();
358 var excess = $(
"#change2").val();
359 if (amountpayed > <?php echo $invoice->total_ttc; ?>) {
360 amountpayed = <?php echo $invoice->total_ttc; ?>;
362 console.log(
"We click on the payment mode to pay amount = "+amountpayed);
363 parent.$(
"#poslines").load(
"invoice.php?place=<?php echo $place; ?>&action=valid&token=<?php echo newToken(); ?>&pay="+payment+
"&amount="+amountpayed+
"&excess="+excess+
"&invoiceid="+invoiceid+
"&accountid="+accountid,
function() {
364 if (amountpayed > <?php echo $remaintopay; ?> || amountpayed == <?php echo $remaintopay; ?> || amountpayed==0 ) {
365 console.log(
"Close popup");
366 parent.$.colorbox.close();
369 console.log(
"Amount is not complete, so we do NOT close popup and reload it.");
377 function fetchPaymentIntentClientSecret(amount, invoiceid) {
378 const bodyContent = JSON.stringify({ amount : amount, invoiceid : invoiceid });
380 $urlpaymentintent = DOL_URL_ROOT.
'/stripe/ajax/ajax.php?action=createPaymentIntent&token='.
newToken().
'&servicestatus='.urlencode((
string) $servicestatus);
381 if (!empty($stripeacc)) {
382 $urlpaymentintent .=
'&stripeacc='.$stripeacc;
385 return fetch(
'<?php echo $urlpaymentintent; ?>', {
388 'Content-Type':
'application/json'
392 .then(
function(response) {
393 return response.json();
395 .then(
function(data) {
396 return data.client_secret;
401 function capturePaymentIntent(paymentIntentId) {
402 const bodyContent = JSON.stringify({
"id": paymentIntentId})
404 $urlpaymentintent = DOL_URL_ROOT.
'/stripe/ajax/ajax.php?action=capturePaymentIntent&token='.
newToken().
'&servicestatus='.urlencode((
string) ($servicestatus));
405 if (!empty($stripeacc)) {
406 $urlpaymentintent .=
'&stripeacc='.urlencode($stripeacc);
409 return fetch(
'<?php echo $urlpaymentintent; ?>', {
412 'Content-Type':
'application/json'
416 .then(
function(response) {
417 return response.json();
419 .then(
function(data) {
420 return data.client_secret;
425 function ValidateStripeTerminal() {
426 console.log(
"Launch ValidateStripeTerminal");
427 var invoiceid = <?php echo($invoiceid > 0 ? $invoiceid : 0); ?>;
428 var accountid = $(
"#selectaccountid").val();
429 var amountpayed = $(
"#change1").val();
430 var excess = $(
"#change2").val();
431 if (amountpayed > <?php echo $invoice->getRemainToPay(); ?>) {
432 amountpayed = <?php echo $invoice->getRemainToPay(); ?>;
434 if (amountpayed == 0) {
435 amountpayed = <?php echo $invoice->getRemainToPay(); ?>;
438 console.log(
"Pay with terminal ", amountpayed);
440 fetchPaymentIntentClientSecret(amountpayed, invoiceid).then(
function(client_secret) {
441 <?php
if (empty($servicestatus) &&
getDolGlobalString(
'STRIPE_TERMINAL_SIMULATED')) { ?>
442 terminal.setSimulatorConfiguration({testCardNumber:
'<?php echo dol_escape_js(getDolGlobalString('STRIPE_TERMINAL_SIMULATED
')); ?>'});
444 document.getElementById(
"card-present-alert").innerHTML =
'<div class="warning clearboth"><?php echo $langs->trans('PaymentSendToStripeTerminal
'); ?></div>';
445 terminal.collectPaymentMethod(client_secret).then(
function(result) {
448 document.getElementById(
"card-present-alert").innerHTML =
'<div class="error clearboth">'+result.error.message+
'</div>';
450 document.getElementById(
"card-present-alert").innerHTML =
'<div class="warning clearboth"><?php echo $langs->trans('PaymentBeingProcessed
'); ?></div>';
451 console.log(
'terminal.collectPaymentMethod', result.paymentIntent);
452 terminal.processPayment(result.paymentIntent).then(function(result) {
454 document.getElementById(
"card-present-alert").innerHTML =
'<div class="error clearboth">'+result.error.message+
'</div>';
455 console.log(result.error)
456 } else if (result.paymentIntent) {
457 paymentIntentId = result.paymentIntent.id;
458 console.log(
'terminal.processPayment', result.paymentIntent);
459 capturePaymentIntent(paymentIntentId).then(function(client_secret) {
462 document.getElementById(
"card-present-alert").innerHTML =
'<div class="error clearboth">'+result.error.message+
'</div>';
463 console.log(
"error when capturing paymentIntent", result.error);
465 document.getElementById(
"card-present-alert").innerHTML =
'<div class="warning clearboth"><?php echo $langs->trans('PaymentValidated
'); ?></div>';
466 console.log(
"Capture paymentIntent successful "+paymentIntentId);
467 parent.$(
"#poslines").load(
"invoice.php?place=<?php echo $place; ?>&action=valid&token=<?php echo newToken(); ?>&pay=CB&amount="+amountpayed+
"&excess="+excess+
"&invoiceid="+invoiceid+
"&accountid="+accountid, function() {
468 if (amountpayed > <?php echo $remaintopay; ?> || amountpayed == <?php echo $remaintopay; ?> || amountpayed==0 ) {
469 console.log(
"Close popup");
470 parent.$.colorbox.close();
473 console.log(
"Amount is not comple, so we do NOT close popup and reload it.");
487 function ValidateSumup() {
488 console.log(
"Launch ValidateSumup");
489 <?php $_SESSION[
'SMP_CURRENT_PAYMENT'] =
"NEW" ?>
490 var invoiceid = <?php echo($invoiceid > 0 ? $invoiceid : 0); ?>;
491 var amountpayed = $(
"#change1").val();
492 if (amountpayed > <?php echo $invoice->total_ttc; ?>) {
493 amountpayed = <?php echo $invoice->total_ttc; ?>;
495 if (amountpayed == 0) {
496 amountpayed = <?php echo $invoice->total_ttc; ?>;
498 var currencycode =
"<?php echo $invoice->multicurrency_code; ?>";
501 window.open(
'sumupmerchant://pay/1.0?affiliate-key=<?php echo urlencode(getDolGlobalString('TAKEPOS_SUMUP_AFFILIATE
')) ?>&app-id=<?php echo urlencode(getDolGlobalString('TAKEPOS_SUMUP_APPID
')) ?>&amount=' + amountpayed +
'¤cy=' + currencycode +
'&title=' + invoiceid +
'&callback=<?php echo DOL_MAIN_URL_ROOT ?>/takepos/smpcb.php');
503 var loop = window.setInterval(
function () {
506 data: { token:
'<?php echo currentToken(); ?>' },
507 url:
'<?php echo DOL_URL_ROOT ?>/takepos/smpcb.php?status' }).done(
function (data) {
509 if (data ===
"SUCCESS") {
510 parent.$(
"#poslines").load(
"invoice.php?place=<?php echo urlencode($place); ?>&action=valid&token=<?php echo newToken(); ?>&pay=CB&amount=" + amountpayed +
"&invoiceid=" + invoiceid,
function () {
512 parent.$.colorbox.close();
516 }
else if (data ===
"FAILED") {
517 parent.$.colorbox.close();
526 echo
"var line1='".$langs->trans(
'TotalTTC').
"'.substring(0,20);";
527 echo
"line1=line1.padEnd(20);";
528 echo
"var line2='".price($invoice->total_ttc, 1,
'', 1, -1, -1).
"'.substring(0,20);";
529 echo
"line2=line2.padEnd(20);";
532 data: { text: line1+line2 },
533 url: '".getDolGlobalString(
'TAKEPOS_PRINT_SERVER').
"/display/index.php',
540$showothercurrency = 0;
541$sessioncurrency = $_SESSION[
"takeposcustomercurrency"] ??
'';
542if (isModEnabled(
'multicurrency') && $sessioncurrency !=
"" &&
$conf->currency != $sessioncurrency) {
544 $showothercurrency = 1;
545 include_once DOL_DOCUMENT_ROOT .
'/multicurrency/class/multicurrency.class.php';
547 $multicurrency->fetch(0, $sessioncurrency);
551<div style=
"position:relative; padding-top: 20px; left:5%; height:140px; width:90%;">
552 <div
class=
"paymentbordline paymentbordlinetotal center">
553 <span
class=
"takepospay colorwhite"><?php echo $langs->trans(
'TotalTTC'); ?>: <span
id=
"totaldisplay" class=
"colorwhite"><?php
554 echo
price($invoice->total_ttc, 1,
'', 1, -1, -1,
$conf->currency);
555 if ($showothercurrency) {
556 print
' <span id="linecolht-span-total opacitymedium" style="font-size:0.9em; font-style:italic;">(' .
price($invoice->total_ht * $multicurrency->rate->rate) .
' ' . $sessioncurrency .
')</span>';
560 <?php
if ($remaintopay != $invoice->total_ttc) { ?>
561 <div
class=
"paymentbordline paymentbordlineremain center">
562 <span
class=
"takepospay colorwhite"><?php echo $langs->trans(
'RemainToPay'); ?>: <span
id=
"remaintopaydisplay" class=
"colorwhite"><?php
563 echo
price($remaintopay, 1,
'', 1, -1, -1, $invoice->multicurrency_code);
564 if ($showothercurrency) {
565 print
' <span id="linecolht-span-total opacitymedium" style="font-size:0.9em; font-style:italic;">(' .
price($remaintopay * $multicurrency->rate->rate) .
' ' . $sessioncurrency .
')</span>';
570 <div
class=
"paymentbordline paymentbordlinereceived center">
571 <span
class=
"takepospay colorwhite"><?php echo $langs->trans(
"Received"); ?>: <span
class=
"change1 colorred"><?php
572 echo
price(0, 1,
'', 1, -1, -1, $invoice->multicurrency_code);
573 if ($showothercurrency) {
574 print
' <span id="linecolht-span-total opacitymedium" style="font-size:0.9em; font-style:italic;">(' .
price(0 * $multicurrency->rate->rate) .
' ' . $sessioncurrency .
')</span>';
576 ?></span><input
type=
"hidden" id=
"change1" class=
"change1" value=
"0"></span>
578 <div
class=
"paymentbordline paymentbordlinechange center">
579 <span
class=
"takepospay colorwhite"><?php echo $langs->trans(
"Change"); ?>: <span
class=
"change2 colorwhite"><?php
580 echo
price(0, 1,
'', 1, -1, -1, $invoice->multicurrency_code);
581 if ($showothercurrency) {
582 print
' <span id="linecolht-span-total opacitymedium" style="font-size:0.9em; font-style:italic;">(' .
price(0 * $multicurrency->rate->rate) .
' ' . $sessioncurrency .
')</span>';
584 ?></span><input
type=
"hidden" id=
"change2" class=
"change2" value=
"0"></span>
588 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
589 print
'<div class="paymentbordline paddingtop paddingbottom center">';
591 $form =
new Form($db);
592 print
'<span class="takepospay colorwhite">'.$langs->trans(
"BankAccount").
': </span>';
593 $form->select_comptes(0,
'accountid', 0, $filter, 1,
'');
599<div style=
"position:absolute; left:5%; height:52%; width:90%;">
601$action_buttons = array(
603"function" =>
"reset()",
604"span" =>
"style='font-size: 150%;'",
606"class" =>
"poscolorblue"
609"function" =>
"parent.$.colorbox.close();",
610"span" =>
"id='printtext' style='font-weight: bold; font-size: 18pt;'",
612"class" =>
"poscolordelete"
616if (isModEnabled(
'stripe') && isset($keyforstripeterminalbank) &&
getDolGlobalString(
'STRIPE_CARD_PRESENT')) {
617 print
'<span id="card-present-alert">';
618 dol_htmloutput_mesg($langs->trans(
'ConnectingToStripeTerminal',
'Stripe'), [],
'warning', 1);
621print
'<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ?
'7' :
'10').
')">'.($numpad == 0 ?
'7' :
'10').
'</button>';
622print
'<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ?
'8' :
'20').
')">'.($numpad == 0 ?
'8' :
'20').
'</button>';
623print
'<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ?
'9' :
'50').
')">'.($numpad == 0 ?
'9' :
'50').
'</button>';
625<?php
if (count($arrayOfValidPaymentModes) > 0) {
626 $paycode = $arrayOfValidPaymentModes[0]->code;
628 if ($paycode ==
'LIQ') {
629 if (!isset(
$conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
632 } elseif ($paycode ==
'CB') {
633 if (!isset(
$conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
634 $payIcon =
'credit-card';
636 } elseif ($paycode ==
'CHQ') {
637 if (!isset(
$conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
638 $payIcon =
'money-check';
642 print
'<button type="button" class="calcbutton2" onclick="Validate(\''.dol_escape_js($paycode).
'\')
">'.(!empty($payIcon) ? '<span class="fa fa-2x fa-
'.$payIcon.' iconwithlabel
"></span><span class="hideonsmartphone
"><br>'.$langs->trans("PaymentTypeShort
".$arrayOfValidPaymentModes[0]->code) : $langs->trans("PaymentTypeShort
".$arrayOfValidPaymentModes[0]->code)).'</span></button>';
644 print '<button type="button" class="calcbutton2
">'.$langs->trans("NoPaimementModesDefined
").'</button>';
647print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '4
' : '1
').')
">'.($numpad == 0 ? '4' : '1').'</button>';
648print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '5
' : '2
').')
">'.($numpad == 0 ? '5' : '2').'</button>';
649print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '6
' : '5
').')
">'.($numpad == 0 ? '6' : '5').'</button>';
651<?php if (count($arrayOfValidPaymentModes) > 1) {
652 $paycode = $arrayOfValidPaymentModes[1]->code;
654 if ($paycode == 'LIQ') {
655 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
658 } elseif ($paycode == 'CB') {
659 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
660 $payIcon = 'credit-card';
662 } elseif ($paycode == 'CHQ') {
663 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
664 $payIcon = 'money-check';
668 print '<button type="button" class="calcbutton2
" onclick="Validate(\
''.
dol_escape_js($paycode).
'\')
">'.(!empty($payIcon) ? '<span class="fa fa-2x fa-
'.$payIcon.' iconwithlabel
"></span><br> '.$langs->trans("PaymentTypeShort
".$arrayOfValidPaymentModes[1]->code) : $langs->trans("PaymentTypeShort
".$arrayOfValidPaymentModes[1]->code)).'</button>';
670 $button = array_pop($action_buttons);
671 print '<button type="button" class="calcbutton2
" onclick="'.$button["function"].'"><span '.$button["span
"].'>'.$button["text
"].'</span></button>';
674print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '1
' : '0.10
').')
">'.($numpad == 0 ? '1' : '0.10').'</button>';
675print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '2
' : '0.20
').')
">'.($numpad == 0 ? '2' : '0.20').'</button>';
676print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '3
' : '0.50
').')
">'.($numpad == 0 ? '3' : '0.50').'</button>';
678<?php if (count($arrayOfValidPaymentModes) > 2) {
679 $paycode = $arrayOfValidPaymentModes[2]->code;
681 if ($paycode == 'LIQ') {
682 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
685 } elseif ($paycode == 'CB') {
686 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
687 $payIcon = 'credit-card';
689 } elseif ($paycode == 'CHQ') {
690 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
691 $payIcon = 'money-check';
695 print '<button type="button" class="calcbutton2
" onclick="Validate(\
''.
dol_escape_js($paycode).
'\')
">'.(!empty($payIcon) ? '<span class="fa fa-2x fa-
'.$payIcon.' iconwithlabel
"></span><br>'.$langs->trans("PaymentTypeShort
".$arrayOfValidPaymentModes[2]->code) : $langs->trans("PaymentTypeShort
".$arrayOfValidPaymentModes[2]->code)).'</button>';
697 $button = array_pop($action_buttons);
698 print '<button type="button" class="calcbutton2
" onclick="'.$button["function"].'"><span '.$button["span
"].'>'.$button["text
"].'</span></button>';
701print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '0
' : '0.01
').')
">'.($numpad == 0 ? '0' : '0.01').'</button>';
702print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '\
'000\'' :
'0.02').
')">'.($numpad == 0 ?
'000' :
'0.02').
'</button>';
703print
'<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ?
'\'.\
'' :
'0.05').
')">'.($numpad == 0 ?
'.' :
'0.05').
'</button>';
706while ($i < count($arrayOfValidPaymentModes)) {
707 $paycode = $arrayOfValidPaymentModes[$i]->code;
709 if ($paycode ==
'LIQ') {
710 if (!isset(
$conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
713 } elseif ($paycode ==
'CB') {
714 if (!isset(
$conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
715 $payIcon =
'credit-card';
717 } elseif ($paycode ==
'CHQ') {
718 if (!isset(
$conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
719 $payIcon =
'money-check';
723 print
'<button type="button" class="calcbutton2" onclick="Validate(\''.dol_escape_js($paycode).
'\')
">'.(!empty($payIcon) ? '<span class="fa fa-2x fa-
'.$payIcon.' iconwithlabel
"></span><br>'.$langs->trans("PaymentTypeShort
".$arrayOfValidPaymentModes[$i]->code) : $langs->trans("PaymentTypeShort
".$arrayOfValidPaymentModes[$i]->code)).'</button>';
727if (isModEnabled('stripe') && isset($keyforstripeterminalbank) && getDolGlobalString('STRIPE_CARD_PRESENT')) {
728 $keyforstripeterminalbank = "CASHDESK_ID_BANKACCOUNT_STRIPETERMINAL
".$_SESSION["takeposterminal
"];
729 print '<span id="StripeTerminal
"></span>';
730 if (getDolGlobalString($keyforstripeterminalbank)) {
733 $langs->loadLangs(array("errors
", "admin
"));
734 //print '<button type="button" class="calcbutton2
disabled" title="'.$langs->trans("SetupNotComplete").'">TerminalOff</button>';
738$keyforsumupbank = "CASHDESK_ID_BANKACCOUNT_SUMUP
".$_SESSION["takeposterminal
"];
739if (getDolGlobalInt("TAKEPOS_ENABLE_SUMUP
")) {
740 if (getDolGlobalString($keyforsumupbank)) {
741 print '<button type="button" class="calcbutton2
" onclick="ValidateSumup();
">Sumup</button>';
743 $langs->loadLangs(array("errors
", "admin
"));
744 print '<button type="button" class="calcbutton2
disabled" title="'.$langs->trans("SetupNotComplete").'">Sumup</button>';
748$parameters = array();
749$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $invoice, $action); // Note that $action and $object may have been modified by hook
751 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
754$class = ($i == 3) ? "calcbutton3
" : "calcbutton2
";
755foreach ($action_buttons as $button) {
756 $newclass = $class.($button["class"] ? " ".$button["class"] : "");
757 print '<button type="button" class="'.$newclass.'" onclick="'.$button["function"].'"><span '.$button["span
"].'>'.$button["text
"].'</span></button>';
760if (getDolGlobalString('TAKEPOS_DELAYED_PAYMENT')) {
761 print '<button type="button" class="calcbutton2
" onclick="Validate(\
'delayed\')">'.$langs->trans(
"Reported").
'</button>';
767$parameters = array();
768$hookmanager->executeHooks(
'completePayment', $parameters, $invoice);
769print $hookmanager->resPrint;
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
Class to manage invoices.
Stripe class @TODO No reason to extends CommonObject.
Class toolbox to validate values.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into javascript code.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_htmloutput_mesg($mesgstring='', $mesgarray=array(), $style='ok', $keepembedded=0)
Print formatted messages to output (Used to show messages on html output).
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
ui state ui widget content ui state ui widget header ui state a ui button
0 = Do not include form tag and submit button -1 = Do not include form tag but include submit button
if(!defined( 'CSRFCHECK_WITH_TOKEN'))
pricejs(amount, mode='MT', currency_code='', force_locale='')
Function similar to PHP price()
price2numjs(amount)
Function similar to PHP price2num()
top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs=array(), $arrayofcss=array(), $disableforlogin=0, $disablenofollow=0, $disablenoindex=0)
Output html header of a page.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.