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';
49$langs->loadLangs(array(
"main",
"bills",
"cashdesk",
"banks"));
51$place = (
GETPOST(
'place',
'aZ09') ?
GETPOST(
'place',
'aZ09') :
'0');
55$hookmanager->initHooks(array(
'takepospay'));
57if (!$user->hasRight(
'takepos',
'run')) {
66$arrayofcss = array(
'/takepos/css/pos.css.php');
74$head =
'<link rel="stylesheet" href="css/pos.css.php">';
76 $head .=
'<link rel="stylesheet" href="css/colorful.css">';
79top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
85$usestripeterminals = 0;
86$keyforstripeterminalbank =
'';
89if (isModEnabled(
'stripe')) {
90 $service =
'StripeTest';
93 $service =
'StripeLive';
98 global $stripearrayofkeysbyenv;
99 $site_account = $stripearrayofkeysbyenv[$servicestatus][
'publishable_key'];
101 $stripe =
new Stripe($db);
102 $stripeacc = $stripe->getStripeAccount($service);
104 include_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
105 $invoicetmp =
new Facture($db);
106 $invoicetmp->fetch($invoiceid);
107 $stripecu = $stripe->getStripeCustomerAccount($invoicetmp->socid, $servicestatus, $site_account);
108 $keyforstripeterminalbank =
"CASHDESK_ID_BANKACCOUNT_STRIPETERMINAL".(empty($_SESSION[
'takeposterminal']) ?
'' : $_SESSION[
'takeposterminal']);
112 if ($usestripeterminals) {
114<script src=
"https://js.stripe.com/terminal/v1/"></script>
116var terminal = StripeTerminal.create({
117 onFetchConnectionToken: fetchConnectionToken,
118 onUnexpectedReaderDisconnect: unexpectedDisconnect,
121function unexpectedDisconnect() {
124 console.log(
"Disconnected from reader")
127function fetchConnectionToken() {
129 $urlconnexiontoken = DOL_URL_ROOT.
'/stripe/ajax/ajax.php?action=getConnexionToken&token='.
newToken().
'&servicestatus='.urlencode((
string) ($servicestatus));
133 if (!empty($stripeacc)) {
134 $urlconnexiontoken .=
'&stripeacc='.urlencode($stripeacc);
137 return fetch(
'<?php echo $urlconnexiontoken; ?>', { method:
"POST" })
138 .then(
function(response) {
139 return response.json();
141 .then(
function(data) {
151if (isModEnabled(
'stripe') && isset($keyforstripeterminalbank) && (!
getDolGlobalString(
'STRIPE_LIVE') ||
GETPOST(
'forcesandbox',
'alpha'))) {
152 dol_htmloutput_mesg($langs->trans(
'YouAreCurrentlyInSandboxMode',
'Stripe'), [],
'warning', 1);
157 $invoice->fetch($invoiceid);
159 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture";
160 $sql .=
" WHERE entity IN (".getEntity(
'invoice').
")";
161 $sql .=
" AND ref = '(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")'";
162 $resql = $db->query($sql);
163 $obj = $db->fetch_object($resql);
165 $invoiceid = $obj->rowid;
170 $invoice->fetch($invoiceid);
177if ($usestripeterminals && $invoice->type != $invoice::TYPE_CREDIT_NOTE) {
180 simulated: <?php
if (empty($servicestatus) &&
getDolGlobalString(
'STRIPE_TERMINAL_SIMULATED')) { ?>
true <?php }
else { ?> false <?php } ?>
181 <?php
if (
getDolGlobalString(
'STRIPE_LOCATION')) { ?>, location:
'<?php echo $conf->global->STRIPE_LOCATION; ?>'<?php } ?>
183 terminal.discoverReaders(config).then(
function(discoverResult) {
184 if (discoverResult.error) {
185 console.log(
'Failed to discover: ', discoverResult.error);
186 }
else if (discoverResult.discoveredReaders.length === 0) {
187 console.log(
'No available readers.');
191 selectedReader = discoverResult.discoveredReaders[0];
194 terminal.connectReader(selectedReader).then(function(connectResult) {
195 if (connectResult.error) {
196 document.getElementById(
"card-present-alert").innerHTML =
'<div class="error">'+connectResult.error.message+
'</div>';
197 console.log(
'Failed to connect: ', connectResult.error);
199 document.getElementById(
"card-present-alert").innerHTML =
'';
200 console.log(
'Connected to reader: ', connectResult.reader.label);
201 if (document.getElementById(
"StripeTerminal")) {
202 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>';
209 terminal.connectReader(<?php echo json_encode($stripe->getSelectedReader(
getDolGlobalString($keyforstripeterminalbank), $stripeacc, $servicestatus)); ?>).then(
function(connectResult) {
210 if (connectResult.error) {
211 document.getElementById(
"card-present-alert").innerHTML =
'<div class="error clearboth">'+connectResult.error.message+
'</div>';
212 console.log(
'Failed to connect: ', connectResult.error);
214 document.getElementById(
"card-present-alert").innerHTML =
'';
215 console.log(
'Connected to reader: ', connectResult.reader.label);
216 if (document.getElementById(
"StripeTerminal")) {
217 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>';
228 $arrayOfValidPaymentModes = array();
229$arrayOfValidBankAccount = array();
231$sql =
"SELECT code, libelle as label FROM ".MAIN_DB_PREFIX.
"c_paiement";
232$sql .=
" WHERE entity IN (".getEntity(
'c_paiement').
")";
233$sql .=
" AND active = 1";
234$sql .=
" ORDER BY libelle";
235$resql = $db->query($sql);
238 while ($obj = $db->fetch_object($resql)) {
239 $paycode = $obj->code;
240 if ($paycode ==
'LIQ') {
243 if ($paycode ==
'CB') {
246 if ($paycode ==
'CHQ') {
250 $accountname =
"CASHDESK_ID_BANKACCOUNT_".$paycode.$_SESSION[
"takeposterminal"];
253 $arrayOfValidPaymentModes[] = $obj;
255 if (!isModEnabled(
'bank')) {
256 if ($paycode ==
'CASH' || $paycode ==
'CB') {
257 $arrayOfValidPaymentModes[] = $obj;
268if ($invoice->id > 0) {
269 $remaintopay = $invoice->getRemainToPay();
271$alreadypayed = (is_object($invoice) ? ($invoice->total_ttc - $remaintopay) : 0);
274 print
"var received='';";
276 print
"var received=0;";
280 var alreadypayed = <?php echo $alreadypayed ?>;
282 function addreceived(
price)
286 print
'received+=String(price);'.
"\n";
288 print
'received+=parseFloat(price);'.
"\n";
291 $(
'.change1').html(
pricejs(parseFloat(received),
'MT'));
292 $(
'.change1').val(parseFloat(received));
293 alreadypaydplusreceived=
price2numjs(alreadypayed + parseFloat(received));
296 if (alreadypaydplusreceived > <?php echo $invoice->total_ttc; ?>)
298 var change=parseFloat(alreadypayed + parseFloat(received) - <?php echo $invoice->total_ttc; ?>);
299 $(
'.change2').html(
pricejs(change,
'MT'));
300 $(
'.change2').val(change);
301 $(
'.change1').removeClass(
'colorred');
302 $(
'.change1').addClass(
'colorgreen');
303 $(
'.change2').removeClass(
'colorwhite');
304 $(
'.change2').addClass(
'colorred');
308 $(
'.change2').html(
pricejs(0,
'MT'));
309 $(
'.change2').val(0);
310 if (alreadypaydplusreceived == <?php echo $invoice->total_ttc; ?>)
312 $(
'.change1').removeClass(
'colorred');
313 $(
'.change1').addClass(
'colorgreen');
314 $(
'.change2').removeClass(
'colorred');
315 $(
'.change2').addClass(
'colorwhite');
319 $(
'.change1').removeClass(
'colorgreen');
320 $(
'.change1').addClass(
'colorred');
321 $(
'.change2').removeClass(
'colorred');
322 $(
'.change2').addClass(
'colorwhite');
332 $(
'.change1').html(
pricejs(received,
'MT'));
334 $(
'.change2').html(
pricejs(received,
'MT'));
336 $(
'.change1').removeClass(
'colorgreen');
337 $(
'.change1').addClass(
'colorred');
338 $(
'.change2').removeClass(
'colorred');
339 $(
'.change2').addClass(
'colorwhite');
344 console.log(
"Launch Validate");
346 var invoiceid = <?php echo($invoiceid > 0 ? $invoiceid : 0); ?>;
347 var accountid = $(
"#selectaccountid").val();
348 var amountpayed = $(
"#change1").val();
349 var excess = $(
"#change2").val();
350 if (amountpayed > <?php echo $invoice->total_ttc; ?>) {
351 amountpayed = <?php echo $invoice->total_ttc; ?>;
353 console.log(
"We click on the payment mode to pay amount = "+amountpayed);
354 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() {
355 if (amountpayed > <?php echo $remaintopay; ?> || amountpayed == <?php echo $remaintopay; ?> || amountpayed==0 ) {
356 console.log(
"Close popup");
357 parent.$.colorbox.close();
360 console.log(
"Amount is not complete, so we do NOT close popup and reload it.");
368 function fetchPaymentIntentClientSecret(amount, invoiceid) {
369 const bodyContent = JSON.stringify({ amount : amount, invoiceid : invoiceid });
371 $urlpaymentintent = DOL_URL_ROOT.
'/stripe/ajax/ajax.php?action=createPaymentIntent&token='.
newToken().
'&servicestatus='.urlencode((
string) $servicestatus);
372 if (!empty($stripeacc)) {
373 $urlpaymentintent .=
'&stripeacc='.$stripeacc;
376 return fetch(
'<?php echo $urlpaymentintent; ?>', {
379 'Content-Type':
'application/json'
383 .then(
function(response) {
384 return response.json();
386 .then(
function(data) {
387 return data.client_secret;
392 function capturePaymentIntent(paymentIntentId) {
393 const bodyContent = JSON.stringify({
"id": paymentIntentId})
395 $urlpaymentintent = DOL_URL_ROOT.
'/stripe/ajax/ajax.php?action=capturePaymentIntent&token='.
newToken().
'&servicestatus='.urlencode((
string) ($servicestatus));
396 if (!empty($stripeacc)) {
397 $urlpaymentintent .=
'&stripeacc='.urlencode($stripeacc);
400 return fetch(
'<?php echo $urlpaymentintent; ?>', {
403 'Content-Type':
'application/json'
407 .then(
function(response) {
408 return response.json();
410 .then(
function(data) {
411 return data.client_secret;
416 function ValidateStripeTerminal() {
417 console.log(
"Launch ValidateStripeTerminal");
418 var invoiceid = <?php echo($invoiceid > 0 ? $invoiceid : 0); ?>;
419 var accountid = $(
"#selectaccountid").val();
420 var amountpayed = $(
"#change1").val();
421 var excess = $(
"#change2").val();
422 if (amountpayed > <?php echo $invoice->getRemainToPay(); ?>) {
423 amountpayed = <?php echo $invoice->getRemainToPay(); ?>;
425 if (amountpayed == 0) {
426 amountpayed = <?php echo $invoice->getRemainToPay(); ?>;
429 console.log(
"Pay with terminal ", amountpayed);
431 fetchPaymentIntentClientSecret(amountpayed, invoiceid).then(
function(client_secret) {
432 <?php
if (empty($servicestatus) &&
getDolGlobalString(
'STRIPE_TERMINAL_SIMULATED')) { ?>
433 terminal.setSimulatorConfiguration({testCardNumber:
'<?php echo $conf->global->STRIPE_TERMINAL_SIMULATED; ?>'});
435 document.getElementById(
"card-present-alert").innerHTML =
'<div class="warning clearboth"><?php echo $langs->trans('PaymentSendToStripeTerminal
'); ?></div>';
436 terminal.collectPaymentMethod(client_secret).then(
function(result) {
439 document.getElementById(
"card-present-alert").innerHTML =
'<div class="error clearboth">'+result.error.message+
'</div>';
441 document.getElementById(
"card-present-alert").innerHTML =
'<div class="warning clearboth"><?php echo $langs->trans('PaymentBeingProcessed
'); ?></div>';
442 console.log(
'terminal.collectPaymentMethod', result.paymentIntent);
443 terminal.processPayment(result.paymentIntent).then(function(result) {
445 document.getElementById(
"card-present-alert").innerHTML =
'<div class="error clearboth">'+result.error.message+
'</div>';
446 console.log(result.error)
447 } else if (result.paymentIntent) {
448 paymentIntentId = result.paymentIntent.id;
449 console.log(
'terminal.processPayment', result.paymentIntent);
450 capturePaymentIntent(paymentIntentId).then(function(client_secret) {
453 document.getElementById(
"card-present-alert").innerHTML =
'<div class="error clearboth">'+result.error.message+
'</div>';
454 console.log(
"error when capturing paymentIntent", result.error);
456 document.getElementById(
"card-present-alert").innerHTML =
'<div class="warning clearboth"><?php echo $langs->trans('PaymentValidated
'); ?></div>';
457 console.log(
"Capture paymentIntent successful "+paymentIntentId);
458 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() {
459 if (amountpayed > <?php echo $remaintopay; ?> || amountpayed == <?php echo $remaintopay; ?> || amountpayed==0 ) {
460 console.log(
"Close popup");
461 parent.$.colorbox.close();
464 console.log(
"Amount is not comple, so we do NOT close popup and reload it.");
478 function ValidateSumup() {
479 console.log(
"Launch ValidateSumup");
480 <?php $_SESSION[
'SMP_CURRENT_PAYMENT'] =
"NEW" ?>
481 var invoiceid = <?php echo($invoiceid > 0 ? $invoiceid : 0); ?>;
482 var amountpayed = $(
"#change1").val();
483 if (amountpayed > <?php echo $invoice->total_ttc; ?>) {
484 amountpayed = <?php echo $invoice->total_ttc; ?>;
486 if (amountpayed == 0) {
487 amountpayed = <?php echo $invoice->total_ttc; ?>;
489 var currencycode =
"<?php echo $invoice->multicurrency_code; ?>";
492 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');
494 var loop = window.setInterval(
function () {
497 data: { token:
'<?php echo currentToken(); ?>' },
498 url:
'<?php echo DOL_URL_ROOT ?>/takepos/smpcb.php?status' }).done(
function (data) {
500 if (data ===
"SUCCESS") {
501 parent.$(
"#poslines").load(
"invoice.php?place=<?php echo urlencode($place); ?>&action=valid&token=<?php echo newToken(); ?>&pay=CB&amount=" + amountpayed +
"&invoiceid=" + invoiceid,
function () {
503 parent.$.colorbox.close();
507 }
else if (data ===
"FAILED") {
508 parent.$.colorbox.close();
517 echo
"var line1='".$langs->trans(
'TotalTTC').
"'.substring(0,20);";
518 echo
"line1=line1.padEnd(20);";
519 echo
"var line2='".price($invoice->total_ttc, 1,
'', 1, -1, -1).
"'.substring(0,20);";
520 echo
"line2=line2.padEnd(20);";
523 data: { text: line1+line2 },
524 url: '".getDolGlobalString(
'TAKEPOS_PRINT_SERVER').
"/display/index.php',
531$showothercurrency = 0;
532$sessioncurrency = $_SESSION[
"takeposcustomercurrency"] ??
'';
533if (isModEnabled(
'multicurrency') && $sessioncurrency !=
"" && $conf->currency != $sessioncurrency) {
535 $showothercurrency = 1;
536 include_once DOL_DOCUMENT_ROOT .
'/multicurrency/class/multicurrency.class.php';
538 $multicurrency->fetch(0, $sessioncurrency);
542<div style=
"position:relative; padding-top: 20px; left:5%; height:140px; width:90%;">
543 <div
class=
"paymentbordline paymentbordlinetotal center">
544 <span
class=
"takepospay colorwhite"><?php echo $langs->trans(
'TotalTTC'); ?>: <span
id=
"totaldisplay" class=
"colorwhite"><?php
545 echo
price($invoice->total_ttc, 1,
'', 1, -1, -1, $conf->currency);
546 if ($showothercurrency) {
547 print
' <span id="linecolht-span-total opacitymedium" style="font-size:0.9em; font-style:italic;">(' .
price($invoice->total_ht * $multicurrency->rate->rate) .
' ' . $sessioncurrency .
')</span>';
551 <?php
if ($remaintopay != $invoice->total_ttc) { ?>
552 <div
class=
"paymentbordline paymentbordlineremain center">
553 <span
class=
"takepospay colorwhite"><?php echo $langs->trans(
'RemainToPay'); ?>: <span
id=
"remaintopaydisplay" class=
"colorwhite"><?php
554 echo
price($remaintopay, 1,
'', 1, -1, -1, $invoice->multicurrency_code);
555 if ($showothercurrency) {
556 print
' <span id="linecolht-span-total opacitymedium" style="font-size:0.9em; font-style:italic;">(' .
price($remaintopay * $multicurrency->rate->rate) .
' ' . $sessioncurrency .
')</span>';
561 <div
class=
"paymentbordline paymentbordlinereceived center">
562 <span
class=
"takepospay colorwhite"><?php echo $langs->trans(
"Received"); ?>: <span
class=
"change1 colorred"><?php
563 echo
price(0, 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(0 * $multicurrency->rate->rate) .
' ' . $sessioncurrency .
')</span>';
567 ?></span><input
type=
"hidden" id=
"change1" class=
"change1" value=
"0"></span>
569 <div
class=
"paymentbordline paymentbordlinechange center">
570 <span
class=
"takepospay colorwhite"><?php echo $langs->trans(
"Change"); ?>: <span
class=
"change2 colorwhite"><?php
571 echo
price(0, 1,
'', 1, -1, -1, $invoice->multicurrency_code);
572 if ($showothercurrency) {
573 print
' <span id="linecolht-span-total opacitymedium" style="font-size:0.9em; font-style:italic;">(' .
price(0 * $multicurrency->rate->rate) .
' ' . $sessioncurrency .
')</span>';
575 ?></span><input
type=
"hidden" id=
"change2" class=
"change2" value=
"0"></span>
579 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
580 print
'<div class="paymentbordline paddingtop paddingbottom center">';
582 $form =
new Form($db);
583 print
'<span class="takepospay colorwhite">'.$langs->trans(
"BankAccount").
': </span>';
584 $form->select_comptes(0,
'accountid', 0, $filter, 1,
'');
590<div style=
"position:absolute; left:5%; height:52%; width:90%;">
592$action_buttons = array(
594"function" =>
"reset()",
595"span" =>
"style='font-size: 150%;'",
597"class" =>
"poscolorblue"
600"function" =>
"parent.$.colorbox.close();",
601"span" =>
"id='printtext' style='font-weight: bold; font-size: 18pt;'",
603"class" =>
"poscolordelete"
607if (isModEnabled(
'stripe') && isset($keyforstripeterminalbank) &&
getDolGlobalString(
'STRIPE_CARD_PRESENT')) {
608 print
'<span id="card-present-alert">';
609 dol_htmloutput_mesg($langs->trans(
'ConnectingToStripeTerminal',
'Stripe'), [],
'warning', 1);
612print
'<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ?
'7' :
'10').
')">'.($numpad == 0 ?
'7' :
'10').
'</button>';
613print
'<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ?
'8' :
'20').
')">'.($numpad == 0 ?
'8' :
'20').
'</button>';
614print
'<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ?
'9' :
'50').
')">'.($numpad == 0 ?
'9' :
'50').
'</button>';
616<?php
if (count($arrayOfValidPaymentModes) > 0) {
617 $paycode = $arrayOfValidPaymentModes[0]->code;
619 if ($paycode ==
'LIQ') {
620 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
623 } elseif ($paycode ==
'CB') {
624 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
625 $payIcon =
'credit-card';
627 } elseif ($paycode ==
'CHQ') {
628 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
629 $payIcon =
'money-check';
633 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>';
635 print '<button type="button" class="calcbutton2
">'.$langs->trans("NoPaimementModesDefined
").'</button>';
638print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '4
' : '1
').')
">'.($numpad == 0 ? '4' : '1').'</button>';
639print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '5
' : '2
').')
">'.($numpad == 0 ? '5' : '2').'</button>';
640print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '6
' : '5
').')
">'.($numpad == 0 ? '6' : '5').'</button>';
642<?php if (count($arrayOfValidPaymentModes) > 1) {
643 $paycode = $arrayOfValidPaymentModes[1]->code;
645 if ($paycode == 'LIQ') {
646 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
649 } elseif ($paycode == 'CB') {
650 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
651 $payIcon = 'credit-card';
653 } elseif ($paycode == 'CHQ') {
654 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
655 $payIcon = 'money-check';
659 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>';
661 $button = array_pop($action_buttons);
662 print '<button type="button" class="calcbutton2
" onclick="'.$button["function"].'"><span '.$button["span
"].'>'.$button["text
"].'</span></button>';
665print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '1
' : '0.10
').')
">'.($numpad == 0 ? '1' : '0.10').'</button>';
666print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '2
' : '0.20
').')
">'.($numpad == 0 ? '2' : '0.20').'</button>';
667print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '3
' : '0.50
').')
">'.($numpad == 0 ? '3' : '0.50').'</button>';
669<?php if (count($arrayOfValidPaymentModes) > 2) {
670 $paycode = $arrayOfValidPaymentModes[2]->code;
672 if ($paycode == 'LIQ') {
673 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
676 } elseif ($paycode == 'CB') {
677 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
678 $payIcon = 'credit-card';
680 } elseif ($paycode == 'CHQ') {
681 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
682 $payIcon = 'money-check';
686 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>';
688 $button = array_pop($action_buttons);
689 print '<button type="button" class="calcbutton2
" onclick="'.$button["function"].'"><span '.$button["span
"].'>'.$button["text
"].'</span></button>';
692print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '0
' : '0.01
').')
">'.($numpad == 0 ? '0' : '0.01').'</button>';
693print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '\
'000\'' :
'0.02').
')">'.($numpad == 0 ?
'000' :
'0.02').
'</button>';
694print
'<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ?
'\'.\
'' :
'0.05').
')">'.($numpad == 0 ?
'.' :
'0.05').
'</button>';
697while ($i < count($arrayOfValidPaymentModes)) {
698 $paycode = $arrayOfValidPaymentModes[$i]->code;
700 if ($paycode ==
'LIQ') {
701 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
704 } elseif ($paycode ==
'CB') {
705 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
706 $payIcon =
'credit-card';
708 } elseif ($paycode ==
'CHQ') {
709 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
710 $payIcon =
'money-check';
714 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>';
718if (isModEnabled('stripe') && isset($keyforstripeterminalbank) && getDolGlobalString('STRIPE_CARD_PRESENT')) {
719 $keyforstripeterminalbank = "CASHDESK_ID_BANKACCOUNT_STRIPETERMINAL
".$_SESSION["takeposterminal
"];
720 print '<span id="StripeTerminal
"></span>';
721 if (getDolGlobalString($keyforstripeterminalbank)) {
724 $langs->loadLangs(array("errors
", "admin
"));
725 //print '<button type="button" class="calcbutton2
disabled" title="'.$langs->trans("SetupNotComplete").'">TerminalOff</button>';
729$keyforsumupbank = "CASHDESK_ID_BANKACCOUNT_SUMUP
".$_SESSION["takeposterminal
"];
730if (getDolGlobalInt("TAKEPOS_ENABLE_SUMUP
")) {
731 if (getDolGlobalString($keyforsumupbank)) {
732 print '<button type="button" class="calcbutton2
" onclick="ValidateSumup();
">Sumup</button>';
734 $langs->loadLangs(array("errors
", "admin
"));
735 print '<button type="button" class="calcbutton2
disabled" title="'.$langs->trans("SetupNotComplete").'">Sumup</button>';
739$parameters = array();
740$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $invoice, $action); // Note that $action and $object may have been modified by hook
742 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
745$class = ($i == 3) ? "calcbutton3
" : "calcbutton2
";
746foreach ($action_buttons as $button) {
747 $newclass = $class.($button["class"] ? " ".$button["class"] : "");
748 print '<button type="button" class="'.$newclass.'" onclick="'.$button["function"].'"><span '.$button["span
"].'>'.$button["text
"].'</span></button>';
751if (getDolGlobalString('TAKEPOS_DELAYED_PAYMENT')) {
752 print '<button type="button" class="calcbutton2
" onclick="Validate(\
'delayed\')">'.$langs->trans(
"Reported").
'</button>';
758$parameters = array();
759$hookmanager->executeHooks(
'completePayment', $parameters, $invoice);
760print $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.
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.