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 =
'';
99if (isModEnabled(
'stripe')) {
100 $service =
'StripeTest';
103 $service =
'StripeLive';
108 global $stripearrayofkeysbyenv;
109 $site_account = $stripearrayofkeysbyenv[$servicestatus][
'publishable_key'];
111 $stripe =
new Stripe($db);
112 $stripeacc = $stripe->getStripeAccount($service);
114 include_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
115 $invoicetmp =
new Facture($db);
116 $invoicetmp->fetch($invoiceid);
117 $stripecu = $stripe->getStripeCustomerAccount($invoicetmp->socid, $servicestatus, $site_account);
118 $keyforstripeterminalbank =
"CASHDESK_ID_BANKACCOUNT_STRIPETERMINAL".(empty($_SESSION[
'takeposterminal']) ?
'' : $_SESSION[
'takeposterminal']);
122 if ($usestripeterminals) {
124<script src=
"https://js.stripe.com/terminal/v1/"></script>
126var terminal = StripeTerminal.create({
127 onFetchConnectionToken: fetchConnectionToken,
128 onUnexpectedReaderDisconnect: unexpectedDisconnect,
131function unexpectedDisconnect() {
134 console.log(
"Disconnected from reader")
137function fetchConnectionToken() {
139 $urlconnexiontoken = DOL_URL_ROOT.
'/stripe/ajax/ajax.php?action=getConnexionToken&token='.
newToken().
'&servicestatus='.urlencode((
string) ($servicestatus));
143 if (!empty($stripeacc)) {
144 $urlconnexiontoken .=
'&stripeacc='.urlencode($stripeacc);
147 return fetch(
'<?php echo $urlconnexiontoken; ?>', { method:
"POST" })
148 .then(
function(response) {
149 return response.json();
151 .then(
function(data) {
161if (isModEnabled(
'stripe') && isset($keyforstripeterminalbank) && (!
getDolGlobalString(
'STRIPE_LIVE'))) {
162 dol_htmloutput_mesg($langs->trans(
'YouAreCurrentlyInSandboxMode',
'Stripe'), [],
'warning', 1);
167 $invoice->fetch($invoiceid);
169 $sql =
"SELECT rowid FROM ".MAIN_DB_PREFIX.
"facture";
170 $sql .=
" WHERE entity IN (".getEntity(
'invoice').
")";
171 $sql .=
" AND ref = '(PROV-POS".$_SESSION[
"takeposterminal"].
"-".$place.
")'";
172 $resql = $db->query($sql);
173 $obj = $db->fetch_object($resql);
175 $invoiceid = $obj->rowid;
180 $invoice->fetch($invoiceid);
187if ($usestripeterminals && $invoice->type != $invoice::TYPE_CREDIT_NOTE) {
188 if (!
getDolGlobalString((
string) $keyforstripeterminalbank) || $stripeacc ===
null) { ?>
190 simulated: <?php
if (empty($servicestatus) &&
getDolGlobalString(
'STRIPE_TERMINAL_SIMULATED')) { ?>
true <?php }
else { ?> false <?php } ?>
191 <?php
if (
getDolGlobalString(
'STRIPE_LOCATION')) { ?>, location:
'<?php echo dol_escape_js(getDolGlobalString('STRIPE_LOCATION
')); ?>'<?php } ?>
193 terminal.discoverReaders(config).then(
function(discoverResult) {
194 if (discoverResult.error) {
195 console.log(
'Failed to discover: ', discoverResult.error);
196 }
else if (discoverResult.discoveredReaders.length === 0) {
197 console.log(
'No available readers.');
201 selectedReader = discoverResult.discoveredReaders[0];
204 terminal.connectReader(selectedReader).then(function(connectResult) {
205 if (connectResult.error) {
206 document.getElementById(
"card-present-alert").innerHTML =
'<div class="error">'+connectResult.error.message+
'</div>';
207 console.log(
'Failed to connect: ', connectResult.error);
209 document.getElementById(
"card-present-alert").innerHTML =
'';
210 console.log(
'Connected to reader: ', connectResult.reader.label);
211 if (document.getElementById(
"StripeTerminal")) {
212 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>';
219 terminal.connectReader(<?php echo json_encode($stripe->getSelectedReader(
getDolGlobalString((
string) $keyforstripeterminalbank), $stripeacc, $servicestatus)); ?>).then(
function(connectResult) {
220 if (connectResult.error) {
221 document.getElementById(
"card-present-alert").innerHTML =
'<div class="error clearboth">'+connectResult.error.message+
'</div>';
222 console.log(
'Failed to connect: ', connectResult.error);
224 document.getElementById(
"card-present-alert").innerHTML =
'';
225 console.log(
'Connected to reader: ', connectResult.reader.label);
226 if (document.getElementById(
"StripeTerminal")) {
227 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>';
238 $arrayOfValidPaymentModes = array();
239$arrayOfValidBankAccount = array();
241$sql =
"SELECT code, libelle as label FROM ".MAIN_DB_PREFIX.
"c_paiement";
242$sql .=
" WHERE entity IN (".getEntity(
'c_paiement').
")";
243$sql .=
" AND active = 1";
244$sql .=
" ORDER BY libelle";
245$resql = $db->query($sql);
248 while ($obj = $db->fetch_object($resql)) {
249 $paycode = $obj->code;
250 if ($paycode ==
'LIQ') {
253 if ($paycode ==
'CB') {
256 if ($paycode ==
'CHQ') {
260 $accountname =
"CASHDESK_ID_BANKACCOUNT_".$paycode.$_SESSION[
"takeposterminal"];
263 $arrayOfValidPaymentModes[] = $obj;
265 if (!isModEnabled(
'bank')) {
266 if ($paycode ==
'CASH' || $paycode ==
'CB') {
267 $arrayOfValidPaymentModes[] = $obj;
278if ($invoice->id > 0) {
279 $remaintopay = $invoice->getRemainToPay();
281$alreadypayed = (is_object($invoice) ? ($invoice->total_ttc - $remaintopay) : 0);
284 print
"var received='';";
286 print
"var received=0;";
290 var alreadypayed = <?php echo $alreadypayed ?>;
292 function addreceived(
price)
296 print
'received+=String(price);'.
"\n";
298 print
'received+=parseFloat(price);'.
"\n";
301 $(
'.change1').html(
pricejs(parseFloat(received),
'MT'));
302 $(
'.change1').val(parseFloat(received));
303 alreadypaydplusreceived=
price2numjs(alreadypayed + parseFloat(received));
306 if (alreadypaydplusreceived > <?php echo (
float) $invoice->total_ttc; ?>)
308 var change=parseFloat(alreadypayed + parseFloat(received) - <?php echo (
float) $invoice->total_ttc; ?>);
309 $(
'.change2').html(
pricejs(change,
'MT'));
310 $(
'.change2').val(change);
311 $(
'.change1').removeClass(
'colorred');
312 $(
'.change1').addClass(
'colorgreen');
313 $(
'.change2').removeClass(
'colorwhite');
314 $(
'.change2').addClass(
'colorred');
318 $(
'.change2').html(
pricejs(0,
'MT'));
319 $(
'.change2').val(0);
320 if (alreadypaydplusreceived == <?php echo $invoice->total_ttc; ?>)
322 $(
'.change1').removeClass(
'colorred');
323 $(
'.change1').addClass(
'colorgreen');
324 $(
'.change2').removeClass(
'colorred');
325 $(
'.change2').addClass(
'colorwhite');
329 $(
'.change1').removeClass(
'colorgreen');
330 $(
'.change1').addClass(
'colorred');
331 $(
'.change2').removeClass(
'colorred');
332 $(
'.change2').addClass(
'colorwhite');
342 $(
'.change1').html(
pricejs(received,
'MT'));
344 $(
'.change2').html(
pricejs(received,
'MT'));
346 $(
'.change1').removeClass(
'colorgreen');
347 $(
'.change1').addClass(
'colorred');
348 $(
'.change2').removeClass(
'colorred');
349 $(
'.change2').addClass(
'colorwhite');
354 console.log(
"Launch Validate");
356 var invoiceid = <?php echo($invoiceid > 0 ? $invoiceid : 0); ?>;
357 var accountid = $(
"#selectaccountid").val();
358 var amountpayed = $(
"#change1").val();
359 var excess = $(
"#change2").val();
360 if (amountpayed > <?php echo $invoice->total_ttc; ?>) {
361 amountpayed = <?php echo $invoice->total_ttc; ?>;
363 console.log(
"We click on the payment mode to pay amount = "+amountpayed);
364 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() {
365 if (amountpayed > <?php echo $remaintopay; ?> || amountpayed == <?php echo $remaintopay; ?> || amountpayed==0 ) {
366 console.log(
"Close popup");
367 parent.$(
'#invoiceid').val(
"");
368 parent.$.colorbox.close();
371 console.log(
"Amount is not complete, so we do NOT close popup and reload it.");
379 function fetchPaymentIntentClientSecret(amount, invoiceid) {
380 const bodyContent = JSON.stringify({ amount : amount, invoiceid : invoiceid });
382 $urlpaymentintent = DOL_URL_ROOT.
'/stripe/ajax/ajax.php?action=createPaymentIntent&token='.
newToken().
'&servicestatus='.urlencode((
string) $servicestatus);
383 if (!empty($stripeacc)) {
384 $urlpaymentintent .=
'&stripeacc='.$stripeacc;
387 return fetch(
'<?php echo $urlpaymentintent; ?>', {
390 'Content-Type':
'application/json'
394 .then(
function(response) {
395 return response.json();
397 .then(
function(data) {
398 return data.client_secret;
403 function capturePaymentIntent(paymentIntentId) {
404 const bodyContent = JSON.stringify({
"id": paymentIntentId})
406 $urlpaymentintent = DOL_URL_ROOT.
'/stripe/ajax/ajax.php?action=capturePaymentIntent&token='.
newToken().
'&servicestatus='.urlencode((
string) ($servicestatus));
407 if (!empty($stripeacc)) {
408 $urlpaymentintent .=
'&stripeacc='.urlencode($stripeacc);
411 return fetch(
'<?php echo $urlpaymentintent; ?>', {
414 'Content-Type':
'application/json'
418 .then(
function(response) {
419 return response.json();
421 .then(
function(data) {
422 return data.client_secret;
427 function ValidateStripeTerminal() {
428 console.log(
"Launch ValidateStripeTerminal");
429 var invoiceid = <?php echo($invoiceid > 0 ? $invoiceid : 0); ?>;
430 var accountid = $(
"#selectaccountid").val();
431 var amountpayed = $(
"#change1").val();
432 var excess = $(
"#change2").val();
433 if (amountpayed > <?php echo $invoice->getRemainToPay(); ?>) {
434 amountpayed = <?php echo $invoice->getRemainToPay(); ?>;
436 if (amountpayed == 0) {
437 amountpayed = <?php echo $invoice->getRemainToPay(); ?>;
440 console.log(
"Pay with terminal ", amountpayed);
442 fetchPaymentIntentClientSecret(amountpayed, invoiceid).then(
function(client_secret) {
443 <?php
if (empty($servicestatus) &&
getDolGlobalString(
'STRIPE_TERMINAL_SIMULATED')) { ?>
444 terminal.setSimulatorConfiguration({testCardNumber:
'<?php echo dol_escape_js(getDolGlobalString('STRIPE_TERMINAL_SIMULATED
')); ?>'});
446 document.getElementById(
"card-present-alert").innerHTML =
'<div class="warning clearboth"><?php echo $langs->trans('PaymentSendToStripeTerminal
'); ?></div>';
447 terminal.collectPaymentMethod(client_secret).then(
function(result) {
450 document.getElementById(
"card-present-alert").innerHTML =
'<div class="error clearboth">'+result.error.message+
'</div>';
452 document.getElementById(
"card-present-alert").innerHTML =
'<div class="warning clearboth"><?php echo $langs->trans('PaymentBeingProcessed
'); ?></div>';
453 console.log(
'terminal.collectPaymentMethod', result.paymentIntent);
454 terminal.processPayment(result.paymentIntent).then(function(result) {
456 document.getElementById(
"card-present-alert").innerHTML =
'<div class="error clearboth">'+result.error.message+
'</div>';
457 console.log(result.error)
458 } else if (result.paymentIntent) {
459 paymentIntentId = result.paymentIntent.id;
460 console.log(
'terminal.processPayment', result.paymentIntent);
461 capturePaymentIntent(paymentIntentId).then(function(client_secret) {
464 document.getElementById(
"card-present-alert").innerHTML =
'<div class="error clearboth">'+result.error.message+
'</div>';
465 console.log(
"error when capturing paymentIntent", result.error);
467 document.getElementById(
"card-present-alert").innerHTML =
'<div class="warning clearboth"><?php echo $langs->trans('PaymentValidated
'); ?></div>';
468 console.log(
"Capture paymentIntent successful "+paymentIntentId);
469 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() {
470 if (amountpayed > <?php echo $remaintopay; ?> || amountpayed == <?php echo $remaintopay; ?> || amountpayed==0 ) {
471 console.log(
"Close popup");
472 parent.$.colorbox.close();
475 console.log(
"Amount is not comple, so we do NOT close popup and reload it.");
489 function ValidateSumup() {
490 console.log(
"Launch ValidateSumup");
491 <?php $_SESSION[
'SMP_CURRENT_PAYMENT'] =
"NEW" ?>
492 var invoiceid = <?php echo($invoiceid > 0 ? $invoiceid : 0); ?>;
493 var amountpayed = $(
"#change1").val();
494 if (amountpayed > <?php echo $invoice->total_ttc; ?>) {
495 amountpayed = <?php echo $invoice->total_ttc; ?>;
497 if (amountpayed == 0) {
498 amountpayed = <?php echo $invoice->total_ttc; ?>;
500 var currencycode =
"<?php echo $invoice->multicurrency_code; ?>";
503 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');
505 var loop = window.setInterval(
function () {
508 data: { token:
'<?php echo currentToken(); ?>' },
509 url:
'<?php echo DOL_URL_ROOT ?>/takepos/smpcb.php?status' }).done(
function (data) {
511 if (data ===
"SUCCESS") {
512 parent.$(
"#poslines").load(
"invoice.php?place=<?php echo urlencode($place); ?>&action=valid&token=<?php echo newToken(); ?>&pay=CB&amount=" + amountpayed +
"&invoiceid=" + invoiceid,
function () {
514 parent.$.colorbox.close();
518 }
else if (data ===
"FAILED") {
519 parent.$.colorbox.close();
528 echo
"var line1='".$langs->trans(
'TotalTTC').
"'.substring(0,20);";
529 echo
"line1=line1.padEnd(20);";
530 echo
"var line2='".price($invoice->total_ttc, 1,
'', 1, -1, -1).
"'.substring(0,20);";
531 echo
"line2=line2.padEnd(20);";
534 data: { text: line1+line2 },
535 url: '".getDolGlobalString(
'TAKEPOS_PRINT_SERVER').
"/display/index.php',
542$sessioncurrency = $_SESSION[
"takeposcustomercurrency"] ??
'';
543print
'<!-- conf->currency = '.$conf->currency.
' - sessioncurrency = '.$sessioncurrency.
' -->'.
"\n";
544$multicurrency =
null;
545if (isModEnabled(
'multicurrency') && $sessioncurrency !=
"" &&
$conf->currency != $sessioncurrency) {
547 include_once DOL_DOCUMENT_ROOT .
'/multicurrency/class/multicurrency.class.php';
549 $multicurrency->fetch(0, $sessioncurrency);
553<div style=
"position:relative; padding-top: 20px; left:5%; height:140px; width:90%;">
554 <div
class=
"paymentbordline paymentbordlinetotal center">
555 <span
class=
"takepospay colorwhite"><?php echo $langs->trans(
'TotalTTC'); ?>: <span
id=
"totaldisplay" class=
"colorwhite"><?php
556 echo
price($invoice->total_ttc, 1,
'', 1, -1, -1,
$conf->currency);
557 if ($multicurrency !==
null) {
558 print
' <span id="linecolht-span-total opacitymedium" style="font-size:0.9em; font-style:italic;">(' .
price($invoice->total_ht * $multicurrency->rate->rate) .
' ' . $sessioncurrency .
')</span>';
562 <?php
if ($remaintopay != $invoice->total_ttc) { ?>
563 <div
class=
"paymentbordline paymentbordlineremain center">
564 <span
class=
"takepospay colorwhite"><?php echo $langs->trans(
'RemainToPay'); ?>: <span
id=
"remaintopaydisplay" class=
"colorwhite"><?php
565 echo
price($remaintopay, 1,
'', 1, -1, -1,
$conf->currency);
566 if ($multicurrency !==
null) {
567 print
' <span id="linecolht-span-total opacitymedium" style="font-size:0.9em; font-style:italic;">(' .
price($remaintopay * $multicurrency->rate->rate) .
' ' . $sessioncurrency .
')</span>';
572 <div
class=
"paymentbordline paymentbordlinereceived center">
573 <span
class=
"takepospay colorwhite"><?php echo $langs->trans(
"Received"); ?>: <span
class=
"change1 colorred"><?php
574 echo
price(0, 1,
'', 1, -1, -1,
$conf->currency);
575 if ($multicurrency !==
null) {
576 print
' <span id="linecolht-span-total opacitymedium" style="font-size:0.9em; font-style:italic;">(' .
price(0 * $multicurrency->rate->rate) .
' ' . $sessioncurrency .
')</span>';
578 ?></span><input
type=
"hidden" id=
"change1" class=
"change1" value=
"0"></span>
580 <div
class=
"paymentbordline paymentbordlinechange center">
581 <span
class=
"takepospay colorwhite"><?php echo $langs->trans(
"Change"); ?>: <span
class=
"change2 colorwhite"><?php
582 echo
price(0, 1,
'', 1, -1, -1,
$conf->currency);
583 if ($multicurrency !==
null) {
584 print
' <span id="linecolht-span-total opacitymedium" style="font-size:0.9em; font-style:italic;">(' .
price(0 * $multicurrency->rate->rate) .
' ' . $sessioncurrency .
')</span>';
586 ?></span><input
type=
"hidden" id=
"change2" class=
"change2" value=
"0"></span>
590 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
591 print
'<div class="paymentbordline paddingtop paddingbottom center">';
593 $form =
new Form($db);
594 print
'<span class="takepospay colorwhite">'.$langs->trans(
"BankAccount").
': </span>';
595 $form->select_comptes(0,
'accountid', 0, $filter, 1,
'');
601<div style=
"position:absolute; left:5%; height:52%; width:90%;">
603$action_buttons = array(
605"function" =>
"reset()",
606"span" =>
"style='font-size: 150%;'",
608"class" =>
"poscolorblue"
611"function" =>
"parent.$.colorbox.close();",
612"span" =>
"id='printtext' style='font-weight: bold; font-size: 18pt;'",
614"class" =>
"poscolordelete"
618if (isModEnabled(
'stripe') && isset($keyforstripeterminalbank) &&
getDolGlobalString(
'STRIPE_CARD_PRESENT')) {
619 print
'<span id="card-present-alert">';
620 dol_htmloutput_mesg($langs->trans(
'ConnectingToStripeTerminal',
'Stripe'), [],
'warning', 1);
623print
'<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ?
'7' :
'10').
')">'.($numpad == 0 ?
'7' :
'10').
'</button>';
624print
'<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ?
'8' :
'20').
')">'.($numpad == 0 ?
'8' :
'20').
'</button>';
625print
'<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ?
'9' :
'50').
')">'.($numpad == 0 ?
'9' :
'50').
'</button>';
627<?php
if (count($arrayOfValidPaymentModes) > 0) {
628 $paycode = $arrayOfValidPaymentModes[0]->code;
630 if ($paycode ==
'LIQ') {
631 if (!isset(
$conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
634 } elseif ($paycode ==
'CB') {
635 if (!isset(
$conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
636 $payIcon =
'credit-card';
638 } elseif ($paycode ==
'CHQ') {
639 if (!isset(
$conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
640 $payIcon =
'money-check';
644 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>';
646 print '<button type="button" class="calcbutton2
">'.$langs->trans("NoPaimementModesDefined
").'</button>';
649print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '4
' : '1
').')
">'.($numpad == 0 ? '4' : '1').'</button>';
650print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '5
' : '2
').')
">'.($numpad == 0 ? '5' : '2').'</button>';
651print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '6
' : '5
').')
">'.($numpad == 0 ? '6' : '5').'</button>';
653<?php if (count($arrayOfValidPaymentModes) > 1) {
654 $paycode = $arrayOfValidPaymentModes[1]->code;
656 if ($paycode == 'LIQ') {
657 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
660 } elseif ($paycode == 'CB') {
661 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
662 $payIcon = 'credit-card';
664 } elseif ($paycode == 'CHQ') {
665 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
666 $payIcon = 'money-check';
670 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>';
672 $button = array_pop($action_buttons);
673 print '<button type="button" class="calcbutton2
" onclick="'.$button["function"].'"><span '.$button["span
"].'>'.$button["text
"].'</span></button>';
676print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '1
' : '0.10
').')
">'.($numpad == 0 ? '1' : '0.10').'</button>';
677print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '2
' : '0.20
').')
">'.($numpad == 0 ? '2' : '0.20').'</button>';
678print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '3
' : '0.50
').')
">'.($numpad == 0 ? '3' : '0.50').'</button>';
680<?php if (count($arrayOfValidPaymentModes) > 2) {
681 $paycode = $arrayOfValidPaymentModes[2]->code;
683 if ($paycode == 'LIQ') {
684 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
687 } elseif ($paycode == 'CB') {
688 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
689 $payIcon = 'credit-card';
691 } elseif ($paycode == 'CHQ') {
692 if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || getDolGlobalString('TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
693 $payIcon = 'money-check';
697 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>';
699 $button = array_pop($action_buttons);
700 print '<button type="button" class="calcbutton2
" onclick="'.$button["function"].'"><span '.$button["span
"].'>'.$button["text
"].'</span></button>';
703print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '0
' : '0.01
').')
">'.($numpad == 0 ? '0' : '0.01').'</button>';
704print '<button type="button" class="calcbutton
" onclick="addreceived(
'.($numpad == 0 ? '\
'000\'' :
'0.02').
')">'.($numpad == 0 ?
'000' :
'0.02').
'</button>';
705print
'<button type="button" class="calcbutton" onclick="addreceived('.($numpad == 0 ?
'\'.\
'' :
'0.05').
')">'.($numpad == 0 ?
'.' :
'0.05').
'</button>';
708while ($i < count($arrayOfValidPaymentModes)) {
709 $paycode = $arrayOfValidPaymentModes[$i]->code;
711 if ($paycode ==
'LIQ') {
712 if (!isset(
$conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
715 } elseif ($paycode ==
'CB') {
716 if (!isset(
$conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
717 $payIcon =
'credit-card';
719 } elseif ($paycode ==
'CHQ') {
720 if (!isset(
$conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) ||
getDolGlobalString(
'TAKEPOS_NUMPAD_USE_PAYMENT_ICON')) {
721 $payIcon =
'money-check';
725 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>';
729if (isModEnabled('stripe') && isset($keyforstripeterminalbank) && getDolGlobalString('STRIPE_CARD_PRESENT')) {
730 $keyforstripeterminalbank = "CASHDESK_ID_BANKACCOUNT_STRIPETERMINAL
".$_SESSION["takeposterminal
"];
731 print '<span id="StripeTerminal
"></span>';
732 if (getDolGlobalString((string) $keyforstripeterminalbank)) {
735 $langs->loadLangs(array("errors
", "admin
"));
736 //print '<button type="button" class="calcbutton2
disabled" title="'.$langs->trans("SetupNotComplete").'">TerminalOff</button>';
740$keyforsumupbank = "CASHDESK_ID_BANKACCOUNT_SUMUP
".$_SESSION["takeposterminal
"];
741if (getDolGlobalInt("TAKEPOS_ENABLE_SUMUP
")) {
742 if (getDolGlobalString($keyforsumupbank)) {
743 print '<button type="button" class="calcbutton2
" onclick="ValidateSumup();
">Sumup</button>';
745 $langs->loadLangs(array("errors
", "admin
"));
746 print '<button type="button" class="calcbutton2
disabled" title="'.$langs->trans("SetupNotComplete").'">Sumup</button>';
750$parameters = array();
751$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $invoice, $action); // Note that $action and $object may have been modified by hook
753 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
756$class = ($i == 3) ? "calcbutton3
" : "calcbutton2
";
757foreach ($action_buttons as $button) {
758 $newclass = $class.($button["class"] ? " ".$button["class"] : "");
759 print '<button type="button" class="'.$newclass.'" onclick="'.$button["function"].'"><span '.$button["span
"].'>'.$button["text
"].'</span></button>';
762if (getDolGlobalString('TAKEPOS_DELAYED_PAYMENT')) {
763 print '<button type="button" class="calcbutton2
" onclick="Validate(\
'delayed\')">'.$langs->trans(
"Reported").
'</button>';
769$parameters = array();
770$hookmanager->executeHooks(
'completePayment', $parameters, $invoice);
771print $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 extend 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|dolcrypt):/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.