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;
87if (isModEnabled(
'stripe')) {
88 $service =
'StripeTest';
91 $service =
'StripeLive';
96 global $stripearrayofkeysbyenv;
97 $site_account = $stripearrayofkeysbyenv[$servicestatus][
'publishable_key'];
100 $stripeacc = $stripe->getStripeAccount($service);
102 include_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
103 $invoicetmp =
new Facture($db);
104 $invoicetmp->fetch($invoiceid);
105 $stripecu = $stripe->getStripeCustomerAccount($invoicetmp->socid, $servicestatus, $site_account);
106 $keyforstripeterminalbank =
"CASHDESK_ID_BANKACCOUNT_STRIPETERMINAL".(empty($_SESSION[
'takeposterminal']) ?
'' : $_SESSION[
'takeposterminal']);
110 if ($usestripeterminals) {
112<script src=
"https://js.stripe.com/terminal/v1/"></script>
114var terminal = StripeTerminal.create({
115 onFetchConnectionToken: fetchConnectionToken,
116 onUnexpectedReaderDisconnect: unexpectedDisconnect,
119function unexpectedDisconnect() {
122 console.log(
"Disconnected from reader")
125function fetchConnectionToken() {
127 $urlconnexiontoken = DOL_URL_ROOT.
'/stripe/ajax/ajax.php?action=getConnexionToken&token='.
newToken().
'&servicestatus='.urlencode((
string) ($servicestatus));
131 if (!empty($stripeacc)) {
132 $urlconnexiontoken .=
'&stripeacc='.urlencode($stripeacc);
135 return fetch(
'<?php echo $urlconnexiontoken; ?>', { method:
"POST" })
136 .then(
function(response) {
137 return response.json();
139 .then(
function(data) {
149if (isModEnabled(
'stripe') && isset($keyforstripeterminalbank) && (!
getDolGlobalString(
'STRIPE_LIVE') ||
GETPOST(
'forcesandbox',
'alpha'))) {
150 dol_htmloutput_mesg($langs->trans(
'YouAreCurrentlyInSandboxMode',
'Stripe'),
'',
'warning', 1);
155 $invoice->fetch($invoiceid);
157 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture";
158 $sql .=
" WHERE entity IN (".getEntity(
'invoice').
")";
159 $sql .=
" AND ref = '(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")'";
160 $resql = $db->query($sql);
161 $obj = $db->fetch_object($resql);
163 $invoiceid = $obj->rowid;
168 $invoice->fetch($invoiceid);
175if ($usestripeterminals && $invoice->type != $invoice::TYPE_CREDIT_NOTE) {
178 simulated: <?php
if (empty($servicestatus) &&
getDolGlobalString(
'STRIPE_TERMINAL_SIMULATED')) { ?>
true <?php }
else { ?> false <?php } ?>
179 <?php
if (
getDolGlobalString(
'STRIPE_LOCATION')) { ?>, location:
'<?php echo $conf->global->STRIPE_LOCATION; ?>'<?php } ?>
181 terminal.discoverReaders(config).then(
function(discoverResult) {
182 if (discoverResult.error) {
183 console.log(
'Failed to discover: ', discoverResult.error);
184 }
else if (discoverResult.discoveredReaders.length === 0) {
185 console.log(
'No available readers.');
189 selectedReader = discoverResult.discoveredReaders[0];
192 terminal.connectReader(selectedReader).then(function(connectResult) {
193 if (connectResult.error) {
194 document.getElementById(
"card-present-alert").innerHTML =
'<div class="error">'+connectResult.error.message+
'</div>';
195 console.log(
'Failed to connect: ', connectResult.error);
197 document.getElementById(
"card-present-alert").innerHTML =
'';
198 console.log(
'Connected to reader: ', connectResult.reader.label);
199 if (document.getElementById(
"StripeTerminal")) {
200 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>';
207 terminal.connectReader(<?php echo json_encode($stripe->getSelectedReader(
getDolGlobalString($keyforstripeterminalbank), $stripeacc, $servicestatus)); ?>).then(
function(connectResult) {
208 if (connectResult.error) {
209 document.getElementById(
"card-present-alert").innerHTML =
'<div class="error clearboth">'+connectResult.error.message+
'</div>';
210 console.log(
'Failed to connect: ', connectResult.error);
212 document.getElementById(
"card-present-alert").innerHTML =
'';
213 console.log(
'Connected to reader: ', connectResult.reader.label);
214 if (document.getElementById(
"StripeTerminal")) {
215 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>';
226 $arrayOfValidPaymentModes = array();
227$arrayOfValidBankAccount = array();
229$sql =
"SELECT code, libelle as label FROM ".MAIN_DB_PREFIX.
"c_paiement";
230$sql .=
" WHERE entity IN (".getEntity(
'c_paiement').
")";
231$sql .=
" AND active = 1";
232$sql .=
" ORDER BY libelle";
233$resql = $db->query($sql);
236 while ($obj = $db->fetch_object($resql)) {
237 $paycode = $obj->code;
238 if ($paycode ==
'LIQ') {
241 if ($paycode ==
'CB') {
244 if ($paycode ==
'CHQ') {
248 $accountname =
"CASHDESK_ID_BANKACCOUNT_".$paycode.$_SESSION[
"takeposterminal"];
251 $arrayOfValidPaymentModes[] = $obj;
253 if (!isModEnabled(
'bank')) {
254 if ($paycode ==
'CASH' || $paycode ==
'CB') {
255 $arrayOfValidPaymentModes[] = $obj;
266if ($invoice->id > 0) {
267 $remaintopay = $invoice->getRemainToPay();
269$alreadypayed = (is_object($invoice) ? ($invoice->total_ttc - $remaintopay) : 0);
272 print
"var received='';";
274 print
"var received=0;";
278 var alreadypayed = <?php echo $alreadypayed ?>;
280 function addreceived(
price)
284 print
'received+=String(price);'.
"\n";
286 print
'received+=parseFloat(price);'.
"\n";
289 $(
'.change1').html(
pricejs(parseFloat(received),
'MT'));
290 $(
'.change1').val(parseFloat(received));
291 alreadypaydplusreceived=
price2numjs(alreadypayed + parseFloat(received));
294 if (alreadypaydplusreceived > <?php echo $invoice->total_ttc; ?>)
296 var change=parseFloat(alreadypayed + parseFloat(received) - <?php echo $invoice->total_ttc; ?>);
297 $(
'.change2').html(
pricejs(change,
'MT'));
298 $(
'.change2').val(change);
299 $(
'.change1').removeClass(
'colorred');
300 $(
'.change1').addClass(
'colorgreen');
301 $(
'.change2').removeClass(
'colorwhite');
302 $(
'.change2').addClass(
'colorred');
306 $(
'.change2').html(
pricejs(0,
'MT'));
307 $(
'.change2').val(0);
308 if (alreadypaydplusreceived == <?php echo $invoice->total_ttc; ?>)
310 $(
'.change1').removeClass(
'colorred');
311 $(
'.change1').addClass(
'colorgreen');
312 $(
'.change2').removeClass(
'colorred');
313 $(
'.change2').addClass(
'colorwhite');
317 $(
'.change1').removeClass(
'colorgreen');
318 $(
'.change1').addClass(
'colorred');
319 $(
'.change2').removeClass(
'colorred');
320 $(
'.change2').addClass(
'colorwhite');
330 $(
'.change1').html(
pricejs(received,
'MT'));
332 $(
'.change2').html(
pricejs(received,
'MT'));
334 $(
'.change1').removeClass(
'colorgreen');
335 $(
'.change1').addClass(
'colorred');
336 $(
'.change2').removeClass(
'colorred');
337 $(
'.change2').addClass(
'colorwhite');
342 console.log(
"Launch Validate");
344 var invoiceid = <?php echo($invoiceid > 0 ? $invoiceid : 0); ?>;
345 var accountid = $(
"#selectaccountid").val();
346 var amountpayed = $(
"#change1").val();
347 var excess = $(
"#change2").val();
348 if (amountpayed > <?php echo $invoice->total_ttc; ?>) {
349 amountpayed = <?php echo $invoice->total_ttc; ?>;
351 console.log(
"We click on the payment mode to pay amount = "+amountpayed);
352 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() {
353 if (amountpayed > <?php echo $remaintopay; ?> || amountpayed == <?php echo $remaintopay; ?> || amountpayed==0 ) {
354 console.log(
"Close popup");
355 parent.$.colorbox.close();
358 console.log(
"Amount is not complete, so we do NOT close popup and reload it.");
366 function fetchPaymentIntentClientSecret(amount, invoiceid) {
367 const bodyContent = JSON.stringify({ amount : amount, invoiceid : invoiceid });
369 $urlpaymentintent = DOL_URL_ROOT.
'/stripe/ajax/ajax.php?action=createPaymentIntent&token='.
newToken().
'&servicestatus='.urlencode((
string) $servicestatus);
370 if (!empty($stripeacc)) {
371 $urlpaymentintent .=
'&stripeacc='.$stripeacc;
374 return fetch(
'<?php echo $urlpaymentintent; ?>', {
377 'Content-Type':
'application/json'
381 .then(
function(response) {
382 return response.json();
384 .then(
function(data) {
385 return data.client_secret;
390 function capturePaymentIntent(paymentIntentId) {
391 const bodyContent = JSON.stringify({
"id": paymentIntentId})
393 $urlpaymentintent = DOL_URL_ROOT.
'/stripe/ajax/ajax.php?action=capturePaymentIntent&token='.
newToken().
'&servicestatus='.urlencode((
string) ($servicestatus));
394 if (!empty($stripeacc)) {
395 $urlpaymentintent .=
'&stripeacc='.urlencode($stripeacc);
398 return fetch(
'<?php echo $urlpaymentintent; ?>', {
401 'Content-Type':
'application/json'
405 .then(
function(response) {
406 return response.json();
408 .then(
function(data) {
409 return data.client_secret;
414 function ValidateStripeTerminal() {
415 console.log(
"Launch ValidateStripeTerminal");
416 var invoiceid = <?php echo($invoiceid > 0 ? $invoiceid : 0); ?>;
417 var accountid = $(
"#selectaccountid").val();
418 var amountpayed = $(
"#change1").val();
419 var excess = $(
"#change2").val();
420 if (amountpayed > <?php echo $invoice->getRemainToPay(); ?>) {
421 amountpayed = <?php echo $invoice->getRemainToPay(); ?>;
423 if (amountpayed == 0) {
424 amountpayed = <?php echo $invoice->getRemainToPay(); ?>;
427 console.log(
"Pay with terminal ", amountpayed);
429 fetchPaymentIntentClientSecret(amountpayed, invoiceid).then(
function(client_secret) {
430 <?php
if (empty($servicestatus) &&
getDolGlobalString(
'STRIPE_TERMINAL_SIMULATED')) { ?>
431 terminal.setSimulatorConfiguration({testCardNumber:
'<?php echo $conf->global->STRIPE_TERMINAL_SIMULATED; ?>'});
433 document.getElementById(
"card-present-alert").innerHTML =
'<div class="warning clearboth"><?php echo $langs->trans('PaymentSendToStripeTerminal
'); ?></div>';
434 terminal.collectPaymentMethod(client_secret).then(
function(result) {
437 document.getElementById(
"card-present-alert").innerHTML =
'<div class="error clearboth">'+result.error.message+
'</div>';
439 document.getElementById(
"card-present-alert").innerHTML =
'<div class="warning clearboth"><?php echo $langs->trans('PaymentBeingProcessed
'); ?></div>';
440 console.log(
'terminal.collectPaymentMethod', result.paymentIntent);
441 terminal.processPayment(result.paymentIntent).then(function(result) {
443 document.getElementById(
"card-present-alert").innerHTML =
'<div class="error clearboth">'+result.error.message+
'</div>';
444 console.log(result.error)
445 } else if (result.paymentIntent) {
446 paymentIntentId = result.paymentIntent.id;
447 console.log(
'terminal.processPayment', result.paymentIntent);
448 capturePaymentIntent(paymentIntentId).then(function(client_secret) {
451 document.getElementById(
"card-present-alert").innerHTML =
'<div class="error clearboth">'+result.error.message+
'</div>';
452 console.log(
"error when capturing paymentIntent", result.error);
454 document.getElementById(
"card-present-alert").innerHTML =
'<div class="warning clearboth"><?php echo $langs->trans('PaymentValidated
'); ?></div>';
455 console.log(
"Capture paymentIntent successful "+paymentIntentId);
456 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() {
457 if (amountpayed > <?php echo $remaintopay; ?> || amountpayed == <?php echo $remaintopay; ?> || amountpayed==0 ) {
458 console.log(
"Close popup");
459 parent.$.colorbox.close();
462 console.log(
"Amount is not comple, so we do NOT close popup and reload it.");
476 function ValidateSumup() {
477 console.log(
"Launch ValidateSumup");
478 <?php $_SESSION[
'SMP_CURRENT_PAYMENT'] =
"NEW" ?>
479 var invoiceid = <?php echo($invoiceid > 0 ? $invoiceid : 0); ?>;
480 var amountpayed = $(
"#change1").val();
481 if (amountpayed > <?php echo $invoice->total_ttc; ?>) {
482 amountpayed = <?php echo $invoice->total_ttc; ?>;
484 if (amountpayed == 0) {
485 amountpayed = <?php echo $invoice->total_ttc; ?>;
487 var currencycode =
"<?php echo $invoice->multicurrency_code; ?>";
490 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');
492 var loop = window.setInterval(
function () {
495 data: { token:
'<?php echo currentToken(); ?>' },
496 url:
'<?php echo DOL_URL_ROOT ?>/takepos/smpcb.php?status' }).done(
function (data) {
498 if (data ===
"SUCCESS") {
499 parent.$(
"#poslines").load(
"invoice.php?place=<?php echo urlencode($place); ?>&action=valid&token=<?php echo newToken(); ?>&pay=CB&amount=" + amountpayed +
"&invoiceid=" + invoiceid,
function () {
501 parent.$.colorbox.close();
505 }
else if (data ===
"FAILED") {
506 parent.$.colorbox.close();
515 echo
"var line1='".$langs->trans(
'TotalTTC').
"'.substring(0,20);";
516 echo
"line1=line1.padEnd(20);";
517 echo
"var line2='".price($invoice->total_ttc, 1,
'', 1, -1, -1).
"'.substring(0,20);";
518 echo
"line2=line2.padEnd(20);";
521 data: { text: line1+line2 },
522 url: '".getDolGlobalString(
'TAKEPOS_PRINT_SERVER').
"/display/index.php',
529$showothercurrency = 0;
530$sessioncurrency = $_SESSION[
"takeposcustomercurrency"] ??
'';
531if (isModEnabled(
'multicurrency') && $sessioncurrency !=
"" && $conf->currency != $sessioncurrency) {
533 $showothercurrency = 1;
534 include_once DOL_DOCUMENT_ROOT .
'/multicurrency/class/multicurrency.class.php';
536 $multicurrency->fetch(0, $sessioncurrency);
540<div style=
"position:relative; padding-top: 20px; left:5%; height:140px; width:90%;">
541 <div
class=
"paymentbordline paymentbordlinetotal center">
542 <span
class=
"takepospay colorwhite"><?php echo $langs->trans(
'TotalTTC'); ?>: <span
id=
"totaldisplay" class=
"colorwhite"><?php
543 echo
price($invoice->total_ttc, 1,
'', 1, -1, -1, $conf->currency);
544 if ($showothercurrency) {
545 print
' <span id="linecolht-span-total opacitymedium" style="font-size:0.9em; font-style:italic;">(' .
price($invoice->total_ht * $multicurrency->rate->rate) .
' ' . $sessioncurrency .
')</span>';
549 <?php
if ($remaintopay != $invoice->total_ttc) { ?>
550 <div
class=
"paymentbordline paymentbordlineremain center">
551 <span
class=
"takepospay colorwhite"><?php echo $langs->trans(
'RemainToPay'); ?>: <span
id=
"remaintopaydisplay" class=
"colorwhite"><?php
552 echo
price($remaintopay, 1,
'', 1, -1, -1, $invoice->multicurrency_code);
553 if ($showothercurrency) {
554 print
' <span id="linecolht-span-total opacitymedium" style="font-size:0.9em; font-style:italic;">(' .
price($remaintopay * $multicurrency->rate->rate) .
' ' . $sessioncurrency .
')</span>';
559 <div
class=
"paymentbordline paymentbordlinereceived center">
560 <span
class=
"takepospay colorwhite"><?php echo $langs->trans(
"Received"); ?>: <span
class=
"change1 colorred"><?php
561 echo
price(0, 1,
'', 1, -1, -1, $invoice->multicurrency_code);
562 if ($showothercurrency) {
563 print
' <span id="linecolht-span-total opacitymedium" style="font-size:0.9em; font-style:italic;">(' .
price(0 * $multicurrency->rate->rate) .
' ' . $sessioncurrency .
')</span>';
565 ?></span><input
type=
"hidden" id=
"change1" class=
"change1" value=
"0"></span>
567 <div
class=
"paymentbordline paymentbordlinechange center">
568 <span
class=
"takepospay colorwhite"><?php echo $langs->trans(
"Change"); ?>: <span
class=
"change2 colorwhite"><?php
569 echo
price(0, 1,
'', 1, -1, -1, $invoice->multicurrency_code);
570 if ($showothercurrency) {
571 print
' <span id="linecolht-span-total opacitymedium" style="font-size:0.9em; font-style:italic;">(' .
price(0 * $multicurrency->rate->rate) .
' ' . $sessioncurrency .
')</span>';
573 ?></span><input
type=
"hidden" id=
"change2" class=
"change2" value=
"0"></span>
577 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
578 print
'<div class="paymentbordline paddingtop paddingbottom center">';
580 $form =
new Form($db);
581 print
'<span class="takepospay colorwhite">'.$langs->trans(
"BankAccount").
': </span>';
582 $form->select_comptes(0,
'accountid', 0, $filter, 1,
'');
588<div style=
"position:absolute; left:5%; height:52%; width:90%;">
590$action_buttons = array(
592 "function" =>
"reset()",
593 "span" =>
"style='font-size: 150%;'",
595 "class" =>
"poscolorblue"
598 "function" =>
"parent.$.colorbox.close();",
599 "span" =>
"id='printtext' style='font-weight: bold; font-size: 18pt;'",
601 "class" =>
"poscolordelete"
605if (isModEnabled(
'stripe') && isset($keyforstripeterminalbank) &&
getDolGlobalString(
'STRIPE_CARD_PRESENT')) {
606 print
'<span id="card-present-alert">';
607 dol_htmloutput_mesg($langs->trans(
'ConnectingToStripeTerminal',
'Stripe'),
'',
'warning', 1);
610print
'<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ?
'7' :
'10').
')">'.($numpad == 0 ?
'7' :
'10').
'</button>';
611print
'<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ?
'8' :
'20').
')">'.($numpad == 0 ?
'8' :
'20').
'</button>';
612print
'<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ?
'9' :
'50').
')">'.($numpad == 0 ?
'9' :
'50').
'</button>';
614<?php
if (count($arrayOfValidPaymentModes) > 0) {
615 $paycode = $arrayOfValidPaymentModes[0]->code;
617 if ($paycode ==
'LIQ') {
618 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
621 } elseif ($paycode ==
'CB') {
622 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
623 $payIcon =
'credit-card';
625 } elseif ($paycode ==
'CHQ') {
626 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
627 $payIcon =
'money-check';
631 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>';
633 print '<button type="button" class="calcbutton2
">'.$langs->trans("NoPaimementModesDefined
").'</button>';
636print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '4
' : '1
').')
">'.($numpad == 0 ? '4' : '1').'</button>';
637print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '5
' : '2
').')
">'.($numpad == 0 ? '5' : '2').'</button>';
638print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '6
' : '5
').')
">'.($numpad == 0 ? '6' : '5').'</button>';
640<?php if (count($arrayOfValidPaymentModes) > 1) {
641 $paycode = $arrayOfValidPaymentModes[1]->code;
643 if ($paycode == 'LIQ') {
644 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
647 } elseif ($paycode == 'CB') {
648 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
649 $payIcon = 'credit-card';
651 } elseif ($paycode == 'CHQ') {
652 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
653 $payIcon = 'money-check';
657 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>';
659 $button = array_pop($action_buttons);
660 print '<button type="button" class="calcbutton2
" onclick="'.$button["function"].'"><span '.$button["span
"].'>'.$button["text
"].'</span></button>';
663print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '1
' : '0.10
').')
">'.($numpad == 0 ? '1' : '0.10').'</button>';
664print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '2
' : '0.20
').')
">'.($numpad == 0 ? '2' : '0.20').'</button>';
665print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '3
' : '0.50
').')
">'.($numpad == 0 ? '3' : '0.50').'</button>';
667<?php if (count($arrayOfValidPaymentModes) > 2) {
668 $paycode = $arrayOfValidPaymentModes[2]->code;
670 if ($paycode == 'LIQ') {
671 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
674 } elseif ($paycode == 'CB') {
675 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
676 $payIcon = 'credit-card';
678 } elseif ($paycode == 'CHQ') {
679 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
680 $payIcon = 'money-check';
684 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>';
686 $button = array_pop($action_buttons);
687 print '<button type="button" class="calcbutton2
" onclick="'.$button["function"].'"><span '.$button["span
"].'>'.$button["text
"].'</span></button>';
690print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '0
' : '0.01
').')
">'.($numpad == 0 ? '0' : '0.01').'</button>';
691print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '\
'000\'' :
'0.02').
')">'.($numpad == 0 ?
'000' :
'0.02').
'</button>';
692print
'<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ?
'\'.\
'' :
'0.05').
')">'.($numpad == 0 ?
'.' :
'0.05').
'</button>';
695while ($i < count($arrayOfValidPaymentModes)) {
696 $paycode = $arrayOfValidPaymentModes[$i]->code;
698 if ($paycode ==
'LIQ') {
699 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
702 } elseif ($paycode ==
'CB') {
703 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
704 $payIcon =
'credit-card';
706 } elseif ($paycode ==
'CHQ') {
707 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
708 $payIcon =
'money-check';
712 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>';
716if (isModEnabled('stripe') && isset($keyforstripeterminalbank) && getDolGlobalString('STRIPE_CARD_PRESENT')) {
717 $keyforstripeterminalbank = "CASHDESK_ID_BANKACCOUNT_STRIPETERMINAL
".$_SESSION["takeposterminal
"];
718 print '<span id="StripeTerminal
"></span>';
719 if (getDolGlobalString($keyforstripeterminalbank)) {
722 $langs->loadLangs(array("errors
", "admin
"));
723 //print '<button type="button" class="calcbutton2
disabled" title="'.$langs->trans("SetupNotComplete").'">TerminalOff</button>';
727$keyforsumupbank = "CASHDESK_ID_BANKACCOUNT_SUMUP
".$_SESSION["takeposterminal
"];
728if (getDolGlobalInt("TAKEPOS_ENABLE_SUMUP
")) {
729 if (getDolGlobalString($keyforsumupbank)) {
730 print '<button type="button" class="calcbutton2
" onclick="ValidateSumup();
">Sumup</button>';
732 $langs->loadLangs(array("errors
", "admin
"));
733 print '<button type="button" class="calcbutton2
disabled" title="'.$langs->trans("SetupNotComplete").'">Sumup</button>';
737$parameters = array();
738$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $invoice, $action); // Note that $action and $object may have been modified by hook
740 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
743$class = ($i == 3) ? "calcbutton3
" : "calcbutton2
";
744foreach ($action_buttons as $button) {
745 $newclass = $class.($button["class"] ? " ".$button["class"] : "");
746 print '<button type="button" class="'.$newclass.'" onclick="'.$button["function"].'"><span '.$button["span
"].'>'.$button["text
"].'</span></button>';
749if (getDolGlobalString('TAKEPOS_DELAYED_PAYMENT')) {
750 print '<button type="button" class="calcbutton2
" onclick="Validate(\
'delayed\')">'.$langs->trans(
"Reported").
'</button>';
756$parameters = array();
757$hookmanager->executeHooks(
'completePayment', $parameters, $invoice);
758print $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.