31if (!defined(
'NOTOKENRENEWAL')) {
32 define(
'NOTOKENRENEWAL',
'1');
34if (!defined(
'NOREQUIREMENU')) {
35 define(
'NOREQUIREMENU',
'1');
37if (!defined(
'NOREQUIREHTML')) {
38 define(
'NOREQUIREHTML',
'1');
42require
'../main.inc.php';
43require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/stripe/class/stripe.class.php';
48$langs->loadLangs(array(
"main",
"bills",
"cashdesk",
"banks"));
50$place = (
GETPOST(
'place',
'aZ09') ?
GETPOST(
'place',
'aZ09') :
'0');
54$hookmanager->initHooks(array(
'takepospay'));
56if (!$user->hasRight(
'takepos',
'run')) {
65$arrayofcss = array(
'/takepos/css/pos.css.php');
73$head =
'<link rel="stylesheet" href="css/pos.css.php">';
75 $head .=
'<link rel="stylesheet" href="css/colorful.css">';
78top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
84$usestripeterminals = 0;
86if (isModEnabled(
'stripe')) {
87 $service =
'StripeTest';
90 $service =
'StripeLive';
95 global $stripearrayofkeysbyenv;
96 $site_account = $stripearrayofkeysbyenv[$servicestatus][
'publishable_key'];
99 $stripeacc = $stripe->getStripeAccount($service);
101 include_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
102 $invoicetmp =
new Facture($db);
103 $invoicetmp->fetch($invoiceid);
104 $stripecu = $stripe->getStripeCustomerAccount($invoicetmp->socid, $servicestatus, $site_account);
105 $keyforstripeterminalbank =
"CASHDESK_ID_BANKACCOUNT_STRIPETERMINAL".(empty($_SESSION[
'takeposterminal']) ?
'' : $_SESSION[
'takeposterminal']);
109 if ($usestripeterminals) {
111<script src=
"https://js.stripe.com/terminal/v1/"></script>
113var terminal = StripeTerminal.create({
114 onFetchConnectionToken: fetchConnectionToken,
115 onUnexpectedReaderDisconnect: unexpectedDisconnect,
118function unexpectedDisconnect() {
121 console.log(
"Disconnected from reader")
124function fetchConnectionToken() {
126 $urlconnexiontoken = DOL_URL_ROOT.
'/stripe/ajax/ajax.php?action=getConnexionToken&token='.
newToken().
'&servicestatus='.urlencode((
string) ($servicestatus));
130 if (!empty($stripeacc)) {
131 $urlconnexiontoken .=
'&stripeacc='.urlencode($stripeacc);
134 return fetch(
'<?php echo $urlconnexiontoken; ?>', { method:
"POST" })
135 .then(
function(response) {
136 return response.json();
138 .then(
function(data) {
148if (isModEnabled(
'stripe') && isset($keyforstripeterminalbank) && (!
getDolGlobalString(
'STRIPE_LIVE') ||
GETPOST(
'forcesandbox',
'alpha'))) {
149 dol_htmloutput_mesg($langs->trans(
'YouAreCurrentlyInSandboxMode',
'Stripe'),
'',
'warning', 1);
154 $invoice->fetch($invoiceid);
156 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture";
157 $sql .=
" WHERE entity IN (".getEntity(
'invoice').
")";
158 $sql .=
" AND ref = '(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")'";
159 $resql = $db->query($sql);
160 $obj = $db->fetch_object($resql);
162 $invoiceid = $obj->rowid;
167 $invoice->fetch($invoiceid);
174if ($usestripeterminals && $invoice->type != $invoice::TYPE_CREDIT_NOTE) {
177 simulated: <?php
if (empty($servicestatus) &&
getDolGlobalString(
'STRIPE_TERMINAL_SIMULATED')) { ?>
true <?php }
else { ?> false <?php } ?>
178 <?php
if (
getDolGlobalString(
'STRIPE_LOCATION')) { ?>, location:
'<?php echo $conf->global->STRIPE_LOCATION; ?>'<?php } ?>
180 terminal.discoverReaders(config).then(
function(discoverResult) {
181 if (discoverResult.error) {
182 console.log(
'Failed to discover: ', discoverResult.error);
183 }
else if (discoverResult.discoveredReaders.length === 0) {
184 console.log(
'No available readers.');
188 selectedReader = discoverResult.discoveredReaders[0];
191 terminal.connectReader(selectedReader).then(function(connectResult) {
192 if (connectResult.error) {
193 document.getElementById(
"card-present-alert").innerHTML =
'<div class="error">'+connectResult.error.message+
'</div>';
194 console.log(
'Failed to connect: ', connectResult.error);
196 document.getElementById(
"card-present-alert").innerHTML =
'';
197 console.log(
'Connected to reader: ', connectResult.reader.label);
198 if (document.getElementById(
"StripeTerminal")) {
199 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>';
206 terminal.connectReader(<?php echo json_encode($stripe->getSelectedReader(
getDolGlobalString($keyforstripeterminalbank), $stripeacc, $servicestatus)); ?>).then(
function(connectResult) {
207 if (connectResult.error) {
208 document.getElementById(
"card-present-alert").innerHTML =
'<div class="error clearboth">'+connectResult.error.message+
'</div>';
209 console.log(
'Failed to connect: ', connectResult.error);
211 document.getElementById(
"card-present-alert").innerHTML =
'';
212 console.log(
'Connected to reader: ', connectResult.reader.label);
213 if (document.getElementById(
"StripeTerminal")) {
214 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>';
225 $arrayOfValidPaymentModes = array();
226$arrayOfValidBankAccount = array();
228$sql =
"SELECT code, libelle as label FROM ".MAIN_DB_PREFIX.
"c_paiement";
229$sql .=
" WHERE entity IN (".getEntity(
'c_paiement').
")";
230$sql .=
" AND active = 1";
231$sql .=
" ORDER BY libelle";
232$resql = $db->query($sql);
235 while ($obj = $db->fetch_object($resql)) {
236 $paycode = $obj->code;
237 if ($paycode ==
'LIQ') {
240 if ($paycode ==
'CB') {
243 if ($paycode ==
'CHQ') {
247 $accountname =
"CASHDESK_ID_BANKACCOUNT_".$paycode.$_SESSION[
"takeposterminal"];
250 $arrayOfValidPaymentModes[] = $obj;
252 if (!isModEnabled(
'bank')) {
253 if ($paycode ==
'CASH' || $paycode ==
'CB') {
254 $arrayOfValidPaymentModes[] = $obj;
265if ($invoice->id > 0) {
266 $remaintopay = $invoice->getRemainToPay();
268$alreadypayed = (is_object($invoice) ? ($invoice->total_ttc - $remaintopay) : 0);
271 print
"var received='';";
273 print
"var received=0;";
277 var alreadypayed = <?php echo $alreadypayed ?>;
279 function addreceived(
price)
283 print
'received+=String(price);'.
"\n";
285 print
'received+=parseFloat(price);'.
"\n";
288 $(
'.change1').html(
pricejs(parseFloat(received),
'MT'));
289 $(
'.change1').val(parseFloat(received));
290 alreadypaydplusreceived=
price2numjs(alreadypayed + parseFloat(received));
293 if (alreadypaydplusreceived > <?php echo $invoice->total_ttc; ?>)
295 var change=parseFloat(alreadypayed + parseFloat(received) - <?php echo $invoice->total_ttc; ?>);
296 $(
'.change2').html(
pricejs(change,
'MT'));
297 $(
'.change2').val(change);
298 $(
'.change1').removeClass(
'colorred');
299 $(
'.change1').addClass(
'colorgreen');
300 $(
'.change2').removeClass(
'colorwhite');
301 $(
'.change2').addClass(
'colorred');
305 $(
'.change2').html(
pricejs(0,
'MT'));
306 $(
'.change2').val(0);
307 if (alreadypaydplusreceived == <?php echo $invoice->total_ttc; ?>)
309 $(
'.change1').removeClass(
'colorred');
310 $(
'.change1').addClass(
'colorgreen');
311 $(
'.change2').removeClass(
'colorred');
312 $(
'.change2').addClass(
'colorwhite');
316 $(
'.change1').removeClass(
'colorgreen');
317 $(
'.change1').addClass(
'colorred');
318 $(
'.change2').removeClass(
'colorred');
319 $(
'.change2').addClass(
'colorwhite');
329 $(
'.change1').html(
pricejs(received,
'MT'));
331 $(
'.change2').html(
pricejs(received,
'MT'));
333 $(
'.change1').removeClass(
'colorgreen');
334 $(
'.change1').addClass(
'colorred');
335 $(
'.change2').removeClass(
'colorred');
336 $(
'.change2').addClass(
'colorwhite');
341 console.log(
"Launch Validate");
343 var invoiceid = <?php echo($invoiceid > 0 ? $invoiceid : 0); ?>;
344 var accountid = $(
"#selectaccountid").val();
345 var amountpayed = $(
"#change1").val();
346 var excess = $(
"#change2").val();
347 if (amountpayed > <?php echo $invoice->total_ttc; ?>) {
348 amountpayed = <?php echo $invoice->total_ttc; ?>;
350 console.log(
"We click on the payment mode to pay amount = "+amountpayed);
351 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() {
352 if (amountpayed > <?php echo $remaintopay; ?> || amountpayed == <?php echo $remaintopay; ?> || amountpayed==0 ) {
353 console.log(
"Close popup");
354 parent.$.colorbox.close();
357 console.log(
"Amount is not complete, so we do NOT close popup and reload it.");
365 function fetchPaymentIntentClientSecret(amount, invoiceid) {
366 const bodyContent = JSON.stringify({ amount : amount, invoiceid : invoiceid });
368 $urlpaymentintent = DOL_URL_ROOT.
'/stripe/ajax/ajax.php?action=createPaymentIntent&token='.
newToken().
'&servicestatus='.urlencode((
string) $servicestatus);
369 if (!empty($stripeacc)) {
370 $urlpaymentintent .=
'&stripeacc='.$stripeacc;
373 return fetch(
'<?php echo $urlpaymentintent; ?>', {
376 'Content-Type':
'application/json'
380 .then(
function(response) {
381 return response.json();
383 .then(
function(data) {
384 return data.client_secret;
389 function capturePaymentIntent(paymentIntentId) {
390 const bodyContent = JSON.stringify({
"id": paymentIntentId})
392 $urlpaymentintent = DOL_URL_ROOT.
'/stripe/ajax/ajax.php?action=capturePaymentIntent&token='.
newToken().
'&servicestatus='.urlencode((
string) ($servicestatus));
393 if (!empty($stripeacc)) {
394 $urlpaymentintent .=
'&stripeacc='.urlencode($stripeacc);
397 return fetch(
'<?php echo $urlpaymentintent; ?>', {
400 'Content-Type':
'application/json'
404 .then(
function(response) {
405 return response.json();
407 .then(
function(data) {
408 return data.client_secret;
413 function ValidateStripeTerminal() {
414 console.log(
"Launch ValidateStripeTerminal");
415 var invoiceid = <?php echo($invoiceid > 0 ? $invoiceid : 0); ?>;
416 var accountid = $(
"#selectaccountid").val();
417 var amountpayed = $(
"#change1").val();
418 var excess = $(
"#change2").val();
419 if (amountpayed > <?php echo $invoice->getRemainToPay(); ?>) {
420 amountpayed = <?php echo $invoice->getRemainToPay(); ?>;
422 if (amountpayed == 0) {
423 amountpayed = <?php echo $invoice->getRemainToPay(); ?>;
426 console.log(
"Pay with terminal ", amountpayed);
428 fetchPaymentIntentClientSecret(amountpayed, invoiceid).then(
function(client_secret) {
429 <?php
if (empty($servicestatus) &&
getDolGlobalString(
'STRIPE_TERMINAL_SIMULATED')) { ?>
430 terminal.setSimulatorConfiguration({testCardNumber:
'<?php echo $conf->global->STRIPE_TERMINAL_SIMULATED; ?>'});
432 document.getElementById(
"card-present-alert").innerHTML =
'<div class="warning clearboth"><?php echo $langs->trans('PaymentSendToStripeTerminal
'); ?></div>';
433 terminal.collectPaymentMethod(client_secret).then(
function(result) {
436 document.getElementById(
"card-present-alert").innerHTML =
'<div class="error clearboth">'+result.error.message+
'</div>';
438 document.getElementById(
"card-present-alert").innerHTML =
'<div class="warning clearboth"><?php echo $langs->trans('PaymentBeingProcessed
'); ?></div>';
439 console.log(
'terminal.collectPaymentMethod', result.paymentIntent);
440 terminal.processPayment(result.paymentIntent).then(function(result) {
442 document.getElementById(
"card-present-alert").innerHTML =
'<div class="error clearboth">'+result.error.message+
'</div>';
443 console.log(result.error)
444 } else if (result.paymentIntent) {
445 paymentIntentId = result.paymentIntent.id;
446 console.log(
'terminal.processPayment', result.paymentIntent);
447 capturePaymentIntent(paymentIntentId).then(function(client_secret) {
450 document.getElementById(
"card-present-alert").innerHTML =
'<div class="error clearboth">'+result.error.message+
'</div>';
451 console.log(
"error when capturing paymentIntent", result.error);
453 document.getElementById(
"card-present-alert").innerHTML =
'<div class="warning clearboth"><?php echo $langs->trans('PaymentValidated
'); ?></div>';
454 console.log(
"Capture paymentIntent successful "+paymentIntentId);
455 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() {
456 if (amountpayed > <?php echo $remaintopay; ?> || amountpayed == <?php echo $remaintopay; ?> || amountpayed==0 ) {
457 console.log(
"Close popup");
458 parent.$.colorbox.close();
461 console.log(
"Amount is not comple, so we do NOT close popup and reload it.");
475 function ValidateSumup() {
476 console.log(
"Launch ValidateSumup");
477 <?php $_SESSION[
'SMP_CURRENT_PAYMENT'] =
"NEW" ?>
478 var invoiceid = <?php echo($invoiceid > 0 ? $invoiceid : 0); ?>;
479 var amountpayed = $(
"#change1").val();
480 if (amountpayed > <?php echo $invoice->total_ttc; ?>) {
481 amountpayed = <?php echo $invoice->total_ttc; ?>;
483 if (amountpayed == 0) {
484 amountpayed = <?php echo $invoice->total_ttc; ?>;
486 var currencycode =
"<?php echo $invoice->multicurrency_code; ?>";
489 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');
491 var loop = window.setInterval(
function () {
494 data: { token:
'<?php echo currentToken(); ?>' },
495 url:
'<?php echo DOL_URL_ROOT ?>/takepos/smpcb.php?status' }).done(
function (data) {
497 if (data ===
"SUCCESS") {
498 parent.$(
"#poslines").load(
"invoice.php?place=<?php echo urlencode($place); ?>&action=valid&token=<?php echo newToken(); ?>&pay=CB&amount=" + amountpayed +
"&invoiceid=" + invoiceid,
function () {
500 parent.$.colorbox.close();
504 }
else if (data ===
"FAILED") {
505 parent.$.colorbox.close();
514 echo
"var line1='".$langs->trans(
'TotalTTC').
"'.substring(0,20);";
515 echo
"line1=line1.padEnd(20);";
516 echo
"var line2='".price($invoice->total_ttc, 1,
'', 1, -1, -1).
"'.substring(0,20);";
517 echo
"line2=line2.padEnd(20);";
520 data: { text: line1+line2 },
521 url: '".getDolGlobalString(
'TAKEPOS_PRINT_SERVER').
"/display/index.php',
528$showothercurrency = 0;
529$sessioncurrency = $_SESSION[
"takeposcustomercurrency"] ??
'';
530if (isModEnabled(
'multicurrency') && $sessioncurrency !=
"" && $conf->currency != $sessioncurrency) {
532 $showothercurrency = 1;
533 include_once DOL_DOCUMENT_ROOT .
'/multicurrency/class/multicurrency.class.php';
535 $multicurrency->fetch(0, $sessioncurrency);
539<div style=
"position:relative; padding-top: 20px; left:5%; height:140px; width:90%;">
540 <div
class=
"paymentbordline paymentbordlinetotal center">
541 <span
class=
"takepospay colorwhite"><?php echo $langs->trans(
'TotalTTC'); ?>: <span
id=
"totaldisplay" class=
"colorwhite"><?php
542 echo
price($invoice->total_ttc, 1,
'', 1, -1, -1, $conf->currency);
543 if ($showothercurrency) {
544 print
' <span id="linecolht-span-total opacitymedium" style="font-size:0.9em; font-style:italic;">(' .
price($invoice->total_ht * $multicurrency->rate->rate) .
' ' . $sessioncurrency .
')</span>';
548 <?php
if ($remaintopay != $invoice->total_ttc) { ?>
549 <div
class=
"paymentbordline paymentbordlineremain center">
550 <span
class=
"takepospay colorwhite"><?php echo $langs->trans(
'RemainToPay'); ?>: <span
id=
"remaintopaydisplay" class=
"colorwhite"><?php
551 echo
price($remaintopay, 1,
'', 1, -1, -1, $invoice->multicurrency_code);
552 if ($showothercurrency) {
553 print
' <span id="linecolht-span-total opacitymedium" style="font-size:0.9em; font-style:italic;">(' .
price($remaintopay * $multicurrency->rate->rate) .
' ' . $sessioncurrency .
')</span>';
558 <div
class=
"paymentbordline paymentbordlinereceived center">
559 <span
class=
"takepospay colorwhite"><?php echo $langs->trans(
"Received"); ?>: <span
class=
"change1 colorred"><?php
560 echo
price(0, 1,
'', 1, -1, -1, $invoice->multicurrency_code);
561 if ($showothercurrency) {
562 print
' <span id="linecolht-span-total opacitymedium" style="font-size:0.9em; font-style:italic;">(' .
price(0 * $multicurrency->rate->rate) .
' ' . $sessioncurrency .
')</span>';
564 ?></span><input
type=
"hidden" id=
"change1" class=
"change1" value=
"0"></span>
566 <div
class=
"paymentbordline paymentbordlinechange center">
567 <span
class=
"takepospay colorwhite"><?php echo $langs->trans(
"Change"); ?>: <span
class=
"change2 colorwhite"><?php
568 echo
price(0, 1,
'', 1, -1, -1, $invoice->multicurrency_code);
569 if ($showothercurrency) {
570 print
' <span id="linecolht-span-total opacitymedium" style="font-size:0.9em; font-style:italic;">(' .
price(0 * $multicurrency->rate->rate) .
' ' . $sessioncurrency .
')</span>';
572 ?></span><input
type=
"hidden" id=
"change2" class=
"change2" value=
"0"></span>
576 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
577 print
'<div class="paymentbordline paddingtop paddingbottom center">';
579 $form =
new Form($db);
580 print
'<span class="takepospay colorwhite">'.$langs->trans(
"BankAccount").
': </span>';
581 $form->select_comptes(0,
'accountid', 0, $filter, 1,
'');
587<div style=
"position:absolute; left:5%; height:52%; width:90%;">
589$action_buttons = array(
591 "function" =>
"reset()",
592 "span" =>
"style='font-size: 150%;'",
594 "class" =>
"poscolorblue"
597 "function" =>
"parent.$.colorbox.close();",
598 "span" =>
"id='printtext' style='font-weight: bold; font-size: 18pt;'",
600 "class" =>
"poscolordelete"
604if (isModEnabled(
'stripe') && isset($keyforstripeterminalbank) &&
getDolGlobalString(
'STRIPE_CARD_PRESENT')) {
605 print
'<span id="card-present-alert">';
606 dol_htmloutput_mesg($langs->trans(
'ConnectingToStripeTerminal',
'Stripe'),
'',
'warning', 1);
609print
'<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ?
'7' :
'10').
')">'.($numpad == 0 ?
'7' :
'10').
'</button>';
610print
'<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ?
'8' :
'20').
')">'.($numpad == 0 ?
'8' :
'20').
'</button>';
611print
'<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ?
'9' :
'50').
')">'.($numpad == 0 ?
'9' :
'50').
'</button>';
613<?php
if (count($arrayOfValidPaymentModes) > 0) {
614 $paycode = $arrayOfValidPaymentModes[0]->code;
616 if ($paycode ==
'LIQ') {
617 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
620 } elseif ($paycode ==
'CB') {
621 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
622 $payIcon =
'credit-card';
624 } elseif ($paycode ==
'CHQ') {
625 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
626 $payIcon =
'money-check';
630 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>';
632 print '<button type="button" class="calcbutton2
">'.$langs->trans("NoPaimementModesDefined
").'</button>';
635print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '4
' : '1
').')
">'.($numpad == 0 ? '4' : '1').'</button>';
636print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '5
' : '2
').')
">'.($numpad == 0 ? '5' : '2').'</button>';
637print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '6
' : '5
').')
">'.($numpad == 0 ? '6' : '5').'</button>';
639<?php if (count($arrayOfValidPaymentModes) > 1) {
640 $paycode = $arrayOfValidPaymentModes[1]->code;
642 if ($paycode == 'LIQ') {
643 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
646 } elseif ($paycode == 'CB') {
647 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
648 $payIcon = 'credit-card';
650 } elseif ($paycode == 'CHQ') {
651 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
652 $payIcon = 'money-check';
656 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>';
658 $button = array_pop($action_buttons);
659 print '<button type="button" class="calcbutton2
" onclick="'.$button["function"].'"><span '.$button["span
"].'>'.$button["text
"].'</span></button>';
662print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '1
' : '0.10
').')
">'.($numpad == 0 ? '1' : '0.10').'</button>';
663print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '2
' : '0.20
').')
">'.($numpad == 0 ? '2' : '0.20').'</button>';
664print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '3
' : '0.50
').')
">'.($numpad == 0 ? '3' : '0.50').'</button>';
666<?php if (count($arrayOfValidPaymentModes) > 2) {
667 $paycode = $arrayOfValidPaymentModes[2]->code;
669 if ($paycode == 'LIQ') {
670 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
673 } elseif ($paycode == 'CB') {
674 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
675 $payIcon = 'credit-card';
677 } elseif ($paycode == 'CHQ') {
678 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
679 $payIcon = 'money-check';
683 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>';
685 $button = array_pop($action_buttons);
686 print '<button type="button" class="calcbutton2
" onclick="'.$button["function"].'"><span '.$button["span
"].'>'.$button["text
"].'</span></button>';
689print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '0
' : '0.01
').')
">'.($numpad == 0 ? '0' : '0.01').'</button>';
690print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '\
'000\'' :
'0.02').
')">'.($numpad == 0 ?
'000' :
'0.02').
'</button>';
691print
'<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ?
'\'.\
'' :
'0.05').
')">'.($numpad == 0 ?
'.' :
'0.05').
'</button>';
694while ($i < count($arrayOfValidPaymentModes)) {
695 $paycode = $arrayOfValidPaymentModes[$i]->code;
697 if ($paycode ==
'LIQ') {
698 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
701 } elseif ($paycode ==
'CB') {
702 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
703 $payIcon =
'credit-card';
705 } elseif ($paycode ==
'CHQ') {
706 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
707 $payIcon =
'money-check';
711 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>';
715if (isModEnabled('stripe') && isset($keyforstripeterminalbank) && getDolGlobalString('STRIPE_CARD_PRESENT')) {
716 $keyforstripeterminalbank = "CASHDESK_ID_BANKACCOUNT_STRIPETERMINAL
".$_SESSION["takeposterminal
"];
717 print '<span id="StripeTerminal
"></span>';
718 if (getDolGlobalString($keyforstripeterminalbank)) {
721 $langs->loadLangs(array("errors
", "admin
"));
722 //print '<button type="button" class="calcbutton2
disabled" title="'.$langs->trans("SetupNotComplete").'">TerminalOff</button>';
726$keyforsumupbank = "CASHDESK_ID_BANKACCOUNT_SUMUP
".$_SESSION["takeposterminal
"];
727if (getDolGlobalInt("TAKEPOS_ENABLE_SUMUP
")) {
728 if (getDolGlobalString($keyforsumupbank)) {
729 print '<button type="button" class="calcbutton2
" onclick="ValidateSumup();
">Sumup</button>';
731 $langs->loadLangs(array("errors
", "admin
"));
732 print '<button type="button" class="calcbutton2
disabled" title="'.$langs->trans("SetupNotComplete").'">Sumup</button>';
736$parameters = array();
737$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $invoice, $action); // Note that $action and $object may have been modified by hook
739 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
742$class = ($i == 3) ? "calcbutton3
" : "calcbutton2
";
743foreach ($action_buttons as $button) {
744 $newclass = $class.($button["class"] ? " ".$button["class"] : "");
745 print '<button type="button" class="'.$newclass.'" onclick="'.$button["function"].'"><span '.$button["span
"].'>'.$button["text
"].'</span></button>';
748if (getDolGlobalString('TAKEPOS_DELAYED_PAYMENT')) {
749 print '<button type="button" class="calcbutton2
" onclick="Validate(\
'delayed\')">'.$langs->trans(
"Reported").
'</button>';
755$parameters = array();
756$hookmanager->executeHooks(
'completePayment', $parameters, $invoice);
757print $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 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.
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.