From 3be723f3a1b3e1852db9f6d7678c90a7f59e8bd5 Mon Sep 17 00:00:00 2001 From: "jove@bisquerra.com" Date: Tue, 11 Aug 2020 07:49:54 +0200 Subject: [PATCH 1/3] NEW: Delayed payment in TakePOS --- htdocs/langs/en_US/cashdesk.lang | 1 + htdocs/takepos/admin/setup.php | 7 +++++++ htdocs/takepos/invoice.php | 6 +++--- htdocs/takepos/pay.php | 4 ++++ 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index 73d8bdaa0df..9d4856135ef 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -120,3 +120,4 @@ DefineTablePlan=Define tables plan GiftReceiptButton=Gift receipt button GiftReceipt=Gift receipt ModuleReceiptPrinterMustBeEnabled=Module Receipt printer must have been enabled first +AllowDelayedPayment=Allow delayed payment diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index 22355c70d9d..82d31045897 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -372,6 +372,13 @@ print ''; print ajax_constantonoff("TAKEPOS_GIFT_RECEIPT", array(), $conf->entity, 0, 0, 1, 0); print "\n"; +// Delayed Pay Button +print ''; +print $langs->trans('AllowDelayedPayment'); +print ''; +print ajax_constantonoff("TAKEPOS_DELAYED_PAYMENT", array(), $conf->entity, 0, 0, 1, 0); +print "\n"; + // Numbering module //print ''; //print $langs->trans("BillsNumberingModule"); diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index cfde72c9fd3..ce4219ab5cd 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -156,7 +156,7 @@ if ($action == 'valid' && $user->rights->facture->creer) } } - if ($bankaccount <= 0) { + if ($bankaccount <= 0 && $pay != "delayed") { $errormsg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankAccount")); $error++; } @@ -249,8 +249,8 @@ if ($action == 'valid' && $user->rights->facture->creer) $payment->paiementid = $paiementid; $payment->num_payment = $invoice->ref; - $payment->create($user); - $payment->addPaymentToBank($user, 'payment', '(CustomerInvoicePayment)', $bankaccount, '', ''); + if ($pay!="delayed") $payment->create($user); + if ($pay!="delayed") $payment->addPaymentToBank($user, 'payment', '(CustomerInvoicePayment)', $bankaccount, '', ''); $remaintopay = $invoice->getRemainToPay(); // Recalculate remain to pay after the payment is recorded if ($remaintopay == 0) { diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index 0f47c7f2b04..0a1c60a5a57 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -375,6 +375,10 @@ foreach ($action_buttons as $button) { $newclass = $class.($button["class"] ? " ".$button["class"] : ""); print ''; } + +if ($conf->global->TAKEPOS_DELAYED_PAYMENT) { + print ''; +} ?> From f57f729d40801662972dcd6adfcb7d90b8aeb811 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Aug 2020 14:35:15 +0200 Subject: [PATCH 2/3] Update invoice.php --- htdocs/takepos/invoice.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index ce4219ab5cd..ebfb5fa5c5f 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -249,8 +249,8 @@ if ($action == 'valid' && $user->rights->facture->creer) $payment->paiementid = $paiementid; $payment->num_payment = $invoice->ref; - if ($pay!="delayed") $payment->create($user); - if ($pay!="delayed") $payment->addPaymentToBank($user, 'payment', '(CustomerInvoicePayment)', $bankaccount, '', ''); + if ($pay != "delayed") $payment->create($user); + if ($pay != "delayed") $payment->addPaymentToBank($user, 'payment', '(CustomerInvoicePayment)', $bankaccount, '', ''); $remaintopay = $invoice->getRemainToPay(); // Recalculate remain to pay after the payment is recorded if ($remaintopay == 0) { From ea478721e7d59101c63408e10619a4a62459304e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 19 Aug 2020 14:36:03 +0200 Subject: [PATCH 3/3] Update invoice.php --- htdocs/takepos/invoice.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index ebfb5fa5c5f..7d645f0bd70 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -249,8 +249,10 @@ if ($action == 'valid' && $user->rights->facture->creer) $payment->paiementid = $paiementid; $payment->num_payment = $invoice->ref; - if ($pay != "delayed") $payment->create($user); - if ($pay != "delayed") $payment->addPaymentToBank($user, 'payment', '(CustomerInvoicePayment)', $bankaccount, '', ''); + if ($pay != "delayed") { + $payment->create($user); + $payment->addPaymentToBank($user, 'payment', '(CustomerInvoicePayment)', $bankaccount, '', ''); + } $remaintopay = $invoice->getRemainToPay(); // Recalculate remain to pay after the payment is recorded if ($remaintopay == 0) {