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 01/10] 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 d61d92a7411a1bcaf9b6922fedee5e8d57a44272 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 26 Aug 2024 21:02:58 +0200 Subject: [PATCH 02/10] Fix param position --- htdocs/product/stats/propal.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stats/propal.php b/htdocs/product/stats/propal.php index 184e498dd95..544fe520071 100644 --- a/htdocs/product/stats/propal.php +++ b/htdocs/product/stats/propal.php @@ -100,7 +100,7 @@ if ($id > 0 || !empty($ref)) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } - llxHeader("", "", $langs->trans("CardProduct".$product->type), '', '', 0, 0, '', '', 'mod-product page-stats_propal'); + llxHeader("", "", $langs->trans("CardProduct".$product->type), '', 0, 0, '', '', 'mod-product page-stats_propal'); if ($result > 0) { $head = product_prepare_head($product); From ce7f038a907e0f30e132ee77ebdbca30a39d0b40 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 26 Aug 2024 22:11:16 +0200 Subject: [PATCH 03/10] Fix mime for xz --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index e918ce97d62..e36ecb8daa7 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -11838,7 +11838,7 @@ function dol_mimetype($file, $default = 'application/octet-stream', $mode = 0) $mime = 'video'; $imgmime = 'video.png'; $famime = 'file-video'; - } elseif (preg_match('/\.(zip|rar|gz|tgz|z|cab|bz2|7z|tar|lzh|zst)$/i', $tmpfile)) { // Archive + } elseif (preg_match('/\.(zip|rar|gz|tgz|xz|z|cab|bz2|7z|tar|lzh|zst)$/i', $tmpfile)) { // Archive // application/xxx where zzz is zip, ... $mime = 'archive'; $imgmime = 'archive.png'; From b6151b1d197c865bf16c91d55f3a260cb573ae8c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 26 Aug 2024 23:52:53 +0200 Subject: [PATCH 04/10] Fix avoid html into translation --- htdocs/langs/en_US/stripe.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/stripe.lang b/htdocs/langs/en_US/stripe.lang index 29b5c893eb7..1ed54885735 100644 --- a/htdocs/langs/en_US/stripe.lang +++ b/htdocs/langs/en_US/stripe.lang @@ -22,7 +22,7 @@ ToOfferALinkForOnlinePaymentOnContractLine=URL to offer a %s online payment page ToOfferALinkForOnlinePaymentOnFreeAmount=URL to offer a %s online payment page of any amount with no existing object ToOfferALinkForOnlinePaymentOnMemberSubscription=URL to offer a %s online payment page for a member subscription ToOfferALinkForOnlinePaymentOnDonation=URL to offer a %s online payment page for payment of a donation -YouCanAddTagOnUrl=You can also add url parameter &tag=value to any of those URL (mandatory only for payment not linked to an object) to add your own payment comment tag.
For the URL of payments with no existing object, you may also add the parameter &noidempotency=1 so the same link with same tag can be used several times (some payment mode may limit the payment to 1 for each different link without this parameter) +YouCanAddTagOnUrl=You can also add url parameter &tag=value to any of those URL (mandatory only for payment not linked to an object) to add your own payment comment tag.
For the URL of payments with no existing object, you may also add the parameter &noidempotency=1 so the same link with same tag can be used several times (some payment mode may limit the payment to 1 for each different link without this parameter) YouCanEmbedOnWebsite=If you want to integrate the payment page into a Dolibarr website, you can include the parameter: &ws=website_ref.
Additionally, two pages named paymentok and paymentko must be created in the website to receive the redirect after a successful of failed online payment. SetupStripeToHavePaymentCreatedAutomatically=Setup your Stripe with url %s to have payment created automatically when validated by Stripe. AccountParameter=Account parameters 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 05/10] 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 06/10] 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 07/10] 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 ''; } From a48cee090a4ccebfd683e29938d346672959c047 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Aug 2024 04:28:35 +0200 Subject: [PATCH 08/10] Better fix for #30756 --- htdocs/fichinter/card.php | 2 ++ htdocs/theme/eldy/btn.inc.php | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index e741707d331..cfef617a21b 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -1733,7 +1733,9 @@ if ($action == 'create') { } // Delete + print '
'; print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete); + print '
'; } } } diff --git a/htdocs/theme/eldy/btn.inc.php b/htdocs/theme/eldy/btn.inc.php index 4bca4aa3d5a..87acc0f562a 100644 --- a/htdocs/theme/eldy/btn.inc.php +++ b/htdocs/theme/eldy/btn.inc.php @@ -56,6 +56,11 @@ div.tabsAction > div.divButAction > a.butActionDelete, div.tabsAction > div.divButAction > a.butActionRefused { margin-bottom: 1.4em !important; margin-right: 0px !important; + +} +.divButAction { + padding: 0 !important; + margin: 0 !important; } div.tabsActionNoBottom > a.butAction, div.tabsActionNoBottom > a.butActionRefused { margin-bottom: 0 !important; @@ -78,7 +83,9 @@ span.butAction, span.butActionDelete { :not(.center) > .butActionRefused:last-child, :not(.center) > .butAction:last-child, :not(.center) > .butActionDelete:last-child { margin-: 0px !important; } -.butActionRefused, .butAction, .butAction:link, .butAction:visited, .butAction:hover, .butAction:active, .butActionDelete, .butActionDelete:link, .butActionDelete:visited, .butActionDelete:hover, .butActionDelete:active { +.butActionRefused, .butAction, .butAction:link, .butAction:visited, .butAction:hover, .butAction:active, .butActionDelete, .butActionDelete:link, .butActionDelete:visited, .butActionDelete:hover, .butActionDelete:active, +.divButAction + { text-decoration: none; text-transform: uppercase; font-weight: bold; From a8ddeff35c1a97e44a91e4f689207c32a591159f Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Tue, 27 Aug 2024 04:52:47 +0200 Subject: [PATCH 09/10] Fix some php warning (#30753) * Fix php warning on send email * Fix php warning on getTotalWeightVolume when no lines. * Fix totalOrdered totalToShip should be int --- htdocs/core/class/CMailFile.class.php | 2 +- htdocs/core/class/commonobject.class.php | 12 +++--------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 47eb0cd3ece..b7005ffb076 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -579,7 +579,7 @@ class CMailFile if (!empty($this->atleastonefile)) { foreach ($filename_list as $i => $val) { $content = file_get_contents($filename_list[$i]); - $smtps->setAttachment($content, $mimefilename_list[$i], $mimetype_list[$i], $cid_list[$i]); + $smtps->setAttachment($content, $mimefilename_list[$i], $mimetype_list[$i], (empty($cid_list[$i]) ? '' : $cid_list[$i])); } } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index ce78539d749..a0789afe0c9 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4970,25 +4970,19 @@ abstract class CommonObject $totalWeight = 0; $totalVolume = 0; // defined for shipment only - $totalOrdered = ''; + $totalOrdered = 0; // defined for shipment only - $totalToShip = ''; + $totalToShip = 0; if (empty($this->lines)) { - return array(); + return array('weight' => $totalWeight, 'volume' => $totalVolume, 'ordered' => $totalOrdered, 'toship' => $totalToShip); } foreach ($this->lines as $line) { if (isset($line->qty_asked)) { - if (empty($totalOrdered)) { - $totalOrdered = 0; // Avoid warning because $totalOrdered is '' - } $totalOrdered += $line->qty_asked; // defined for shipment only } if (isset($line->qty_shipped)) { - if (empty($totalToShip)) { - $totalToShip = 0; // Avoid warning because $totalToShip is '' - } $totalToShip += $line->qty_shipped; // defined for shipment only } elseif ($line->element == 'commandefournisseurdispatch' && isset($line->qty)) { if (empty($totalToShip)) { From 1331e128aaeb17fda00d2940c0ca810e50912a9d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Aug 2024 07:07:15 +0200 Subject: [PATCH 10/10] Fix travis --- htdocs/theme/eldy/btn.inc.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/theme/eldy/btn.inc.php b/htdocs/theme/eldy/btn.inc.php index 87acc0f562a..ec865d4c331 100644 --- a/htdocs/theme/eldy/btn.inc.php +++ b/htdocs/theme/eldy/btn.inc.php @@ -56,11 +56,10 @@ div.tabsAction > div.divButAction > a.butActionDelete, div.tabsAction > div.divButAction > a.butActionRefused { margin-bottom: 1.4em !important; margin-right: 0px !important; - } .divButAction { - padding: 0 !important; - margin: 0 !important; + padding: 0 !important; + margin: 0 !important; } div.tabsActionNoBottom > a.butAction, div.tabsActionNoBottom > a.butActionRefused { margin-bottom: 0 !important;