From 48670dbd2f51023a1452f23a5934c08b2f4cb2be Mon Sep 17 00:00:00 2001 From: Thibault Fiacre <57494317+atm-thibaultf@users.noreply.github.com> Date: Fri, 23 Aug 2024 15:00:33 +0200 Subject: [PATCH 1/4] Fix prevent batch shipment for same product (#30740) * FIX prevent batch shipment for same product * Add variable declaration --- htdocs/expedition/card.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 9e23c96ff8d..c9c9592b90d 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -268,6 +268,8 @@ if (empty($reshook)) { $num = count($objectsrc->lines); $totalqty = 0; + $product_batch_used = array(); + for ($i = 0; $i < $num; $i++) { $idl = "idl".$i; @@ -305,11 +307,16 @@ if (empty($reshook)) { //var_dump($sub_qty[$j]['id_batch']); //var_dump($qty);var_dump($batch);var_dump($sub_qty[$j]['q']);var_dump($sub_qty[$j]['id_batch']); - if ($is_batch_or_serial==2 && $sub_qty[$j]['q']>1) { + if ($is_batch_or_serial==2 && ($sub_qty[$j]['q']>1 || ($sub_qty[$j]['q']>0 && in_array($sub_qty[$j]['id_batch'], $product_batch_used)))) { setEventMessages($langs->trans("TooManyQtyForSerialNumber", $product->ref, ''), null, 'errors'); $totalqty=0; break 2; } + + if ($is_batch_or_serial==2 && $sub_qty[$j]['q']>0) { + $product_batch_used[$j] = $sub_qty[$j]['id_batch']; // we stock the batch id to test if the same serial is shipped on another line for the same product + } + $j++; $batch = "batchl".$i."_".$j; $qty = "qtyl".$i.'_'.$j; From e7e96f650aadb40ed0f32cb2442fd44f2a5d7d01 Mon Sep 17 00:00:00 2001 From: Shanty <111346550+evarisk-micka@users.noreply.github.com> Date: Tue, 27 Aug 2024 03:02:43 +0200 Subject: [PATCH 2/4] FIX #30768 allocate the correct invoice_line_id to the element timespent (#30769) --- htdocs/projet/tasks/time.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index c35cd9e83cb..87764277b65 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -658,7 +658,7 @@ if ($action == 'confirm_generateinvoice') { // Update lineid into line of timespent $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.((int) $lineid).', invoice_id = '.((int) $tmpinvoice->id); - $sql .= ' WHERE rowid IN ('.$db->sanitize(join(',', $toselect)).') AND fk_user = '.((int) $userid); + $sql .= ' WHERE rowid = '.((int) $timespent_id).' AND fk_user = '.((int) $userid); $result = $db->query($sql); if (!$result) { $error++; From 93e8d2baba75bff6c58ebff1ecd1d4254fbd84da Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Aug 2024 03:30:24 +0200 Subject: [PATCH 3/4] FIX #30762 --- htdocs/core/lib/functions.lib.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 0b614f64254..28d2789e161 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6127,11 +6127,12 @@ function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $ if (dol_strlen($decpart) > $nbdecimal) { $nbdecimal = dol_strlen($decpart); } - // Si on depasse max - if ($trunc && $nbdecimal > $conf->global->MAIN_MAX_DECIMALS_SHOWN) { - $nbdecimal = $conf->global->MAIN_MAX_DECIMALS_SHOWN; - if (preg_match('/\.\.\./i', $conf->global->MAIN_MAX_DECIMALS_SHOWN)) { - // Si un affichage est tronque, on montre des ... + // If nbdecimal is higher than max to show + $nbdecimalmaxshown = (int) str_replace('...', '', getDolGlobalString('MAIN_MAX_DECIMALS_SHOWN')); + if ($trunc && $nbdecimal > $nbdecimalmaxshown) { + $nbdecimal = $nbdecimalmaxshown; + if (preg_match('/\.\.\./i', getDolGlobalString('MAIN_MAX_DECIMALS_SHOWN'))) { + // If output is truncated, we show ... $end = '...'; } } @@ -6139,9 +6140,9 @@ function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $ // If force rounding if ((string) $forcerounding != '-1') { if ($forcerounding === 'MU') { - $nbdecimal = $conf->global->MAIN_MAX_DECIMALS_UNIT; + $nbdecimal = getDolGlobalInt('MAIN_MAX_DECIMALS_UNIT'); } elseif ($forcerounding === 'MT') { - $nbdecimal = $conf->global->MAIN_MAX_DECIMALS_TOT; + $nbdecimal = getDolGlobalInt('MAIN_MAX_DECIMALS_TOT'); } elseif ($forcerounding >= 0) { $nbdecimal = $forcerounding; } From 902270593066b55429b33faf35b2109ec8b0cfdb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Aug 2024 03:53:44 +0200 Subject: [PATCH 4/4] FIX #30757 --- htdocs/compta/bank/class/paymentvarious.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index 6332f517b8d..4d7b83c5fcf 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -630,6 +630,7 @@ class PaymentVarious extends CommonObject // phpcs:enable global $langs; + /* if (empty($status)) { $status = 0; } @@ -646,6 +647,8 @@ class PaymentVarious extends CommonObject $statusType = 'status'.$status; return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); + */ + return ''; }