From 9c638968ff993a1c96ab07ed36cf8d7ac5da35ea Mon Sep 17 00:00:00 2001 From: tnegre Date: Fri, 26 Jan 2024 16:00:17 +0100 Subject: [PATCH 1/3] Takepos : display errors on payment error --- htdocs/takepos/invoice.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 4130ac5c3cb..db223e58f9c 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -305,7 +305,11 @@ if ($action == 'valid' && $user->rights->facture->creer) { if ($pay != "delayed") { $payment->create($user); - $payment->addPaymentToBank($user, 'payment', '(CustomerInvoicePayment)', $bankaccount, '', ''); + $res = $payment->addPaymentToBank($user, 'payment', '(CustomerInvoicePayment)', $bankaccount, '', ''); + if ($res < 0) { + $error++; + dol_htmloutput_errors($langs->trans('ErrorNoPaymentDefined'), $payment->errors, 1); + } $remaintopay = $invoice->getRemainToPay(); // Recalculate remain to pay after the payment is recorded } } From 8d9ddf4a51225eb9979a7cf58b0b5ca6cecf777f Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Tue, 30 Jan 2024 21:35:19 +0100 Subject: [PATCH 2/3] fix comment about datehour -> datetime --- htdocs/core/class/extrafields.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 1fbadc2ee81..b685b367396 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -221,7 +221,7 @@ class ExtraFields * * @param string $attrname Code of attribute * @param string $label label of attribute - * @param string $type Type of attribute ('boolean','int','varchar','text','html','date','datehour','price','phone','mail','password','url','select','checkbox','separate',...) + * @param string $type Type of attribute ('boolean','int','varchar','text','html','date','datetime','price','phone','mail','password','url','select','checkbox','separate',...) * @param int $pos Position of attribute * @param string $size Size/length definition of attribute ('5', '24,8', ...). For float, it contains 2 numeric separated with a comma. * @param string $elementtype Element type. Same value than object->table_element (Example 'member', 'product', 'thirdparty', ...) @@ -287,7 +287,7 @@ class ExtraFields * This is a private method. For public method, use addExtraField. * * @param string $attrname code of attribute - * @param int $type Type of attribute ('boolean', 'int', 'varchar', 'text', 'html', 'date', 'datehour','price','phone','mail','password','url','select','checkbox', ...) + * @param int $type Type of attribute ('boolean', 'int', 'varchar', 'text', 'html', 'date', 'datetime','price','phone','mail','password','url','select','checkbox', ...) * @param string $length Size/length of attribute ('5', '24,8', ...) * @param string $elementtype Element type ('member', 'product', 'thirdparty', 'contact', ...) * @param int $unique Is field unique or not @@ -379,7 +379,7 @@ class ExtraFields * * @param string $attrname code of attribute * @param string $label label of attribute - * @param int $type Type of attribute ('int', 'varchar', 'text', 'html', 'date', 'datehour', 'float') + * @param int $type Type of attribute ('int', 'varchar', 'text', 'html', 'date', 'datetime', 'float') * @param int $pos Position of attribute * @param string $size Size/length of attribute ('5', '24,8', ...) * @param string $elementtype Element type ('member', 'product', 'thirdparty', ...) @@ -606,7 +606,7 @@ class ExtraFields * * @param string $attrname Name of attribute * @param string $label Label of attribute - * @param string $type Type of attribute ('boolean', 'int', 'varchar', 'text', 'html', 'date', 'datehour','price','phone','mail','password','url','select','checkbox', ...) + * @param string $type Type of attribute ('boolean', 'int', 'varchar', 'text', 'html', 'date', 'datetime','price','phone','mail','password','url','select','checkbox', ...) * @param int $length Length of attribute * @param string $elementtype Element type ('member', 'product', 'thirdparty', 'contact', ...) * @param int $unique Is field unique or not From 1f21e1a9456270a1e8ce94a35ecf1be39f6e25f7 Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Tue, 30 Jan 2024 21:42:57 +0100 Subject: [PATCH 3/3] fix #27883 : zero could be a value stored --- htdocs/core/lib/functions.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 7c0583519bd..9a4e951f377 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -51,7 +51,7 @@ function getDolGlobalString($key) { global $conf; // return $conf->global->$key ?? ''; - return (string) (empty($conf->global->$key) ? '' : $conf->global->$key); + return (string) (isset($conf->global->$key) ? $conf->global->$key : ''); } /** @@ -63,7 +63,7 @@ function getDolGlobalInt($key) { global $conf; // return $conf->global->$key ?? 0; - return (int) (empty($conf->global->$key) ? 0 : $conf->global->$key); + return (int) (isset($conf->global->$key) ? $conf->global->$key : 0); } /**