From e1e7ce80748f557e67406b5edf95e28275366d1f Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 14 Oct 2022 12:09:02 +0200 Subject: [PATCH 1/8] FIX: #22581 --- htdocs/expedition/card.php | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 8aa54ca8904..7aecd063490 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -215,6 +215,8 @@ if (empty($reshook)) { $object->size_units = GETPOST('size_units', 'int'); $object->weight_units = GETPOST('weight_units', 'int'); + $product = new Product($db); + // We will loop on each line of the original document to complete the shipping object with various info and quantity to deliver $classname = ucfirst($object->origin); $objectsrc = new $classname($db); @@ -250,10 +252,20 @@ if (empty($reshook)) { $stockLocation = "ent1".$i."_0"; $qty = "qtyl".$i; + $is_batch_or_serial=0; + if (!empty($objectsrc->lines[$i]->fk_product)) { + $resultFetch = $product->fetch($objectsrc->lines[$i]->fk_product, '', '', '', 1, 1, 1); + if ($resultFetch < 0) { + setEventMessages($product->error, $product->errors, 'errors'); + } + $is_batch_or_serial = $product->status_batch; + } + if (!empty($conf->productbatch->enabled) && $objectsrc->lines[$i]->product_tobatch) { // If product need a batch number if (GETPOSTISSET($batch)) { //shipment line with batch-enable product $qty .= '_'.$j; + while (GETPOSTISSET($batch)) { // save line of detail into sub_qty $sub_qty[$j]['q'] = GETPOST($qty, 'int'); // the qty we want to move for this stock record @@ -261,7 +273,11 @@ if (empty($reshook)) { $subtotalqty += $sub_qty[$j]['q']; //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) { + setEventMessages($langs->trans("TooManyQtyForSerialNumber", $product->ref, ''), null, 'errors'); + $totalqty=0; + break 2; + } $j++; $batch = "batchl".$i."_".$j; $qty = "qtyl".$i.'_'.$j; @@ -286,6 +302,7 @@ if (empty($reshook)) { $qty .= '_'.$j; while (GETPOSTISSET($stockLocation)) { // save sub line of warehouse + $stockLine[$i][$j]['qty'] = price2num(GETPOST($qty, 'alpha'), 'MS'); $stockLine[$i][$j]['warehouse_id'] = GETPOST($stockLocation, 'int'); $stockLine[$i][$j]['ix_l'] = GETPOST($idl, 'int'); @@ -316,7 +333,6 @@ if (empty($reshook)) { } //var_dump($batch_line[2]); - if ($totalqty > 0) { // There is at least one thing to ship //var_dump($_POST);exit; for ($i = 0; $i < $num; $i++) { From 012275cb3e91188f8842de1a69b16aa9616440d3 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 14 Oct 2022 12:10:04 +0200 Subject: [PATCH 2/8] FIX: #22581 --- htdocs/expedition/card.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 7aecd063490..fc443f6790b 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -302,7 +302,6 @@ if (empty($reshook)) { $qty .= '_'.$j; while (GETPOSTISSET($stockLocation)) { // save sub line of warehouse - $stockLine[$i][$j]['qty'] = price2num(GETPOST($qty, 'alpha'), 'MS'); $stockLine[$i][$j]['warehouse_id'] = GETPOST($stockLocation, 'int'); $stockLine[$i][$j]['ix_l'] = GETPOST($idl, 'int'); From c002957b49a2540a602bfd279337bc2b96c21d42 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 14 Oct 2022 12:10:26 +0200 Subject: [PATCH 3/8] FIX: #22581 --- htdocs/expedition/card.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index fc443f6790b..29e1bd266b8 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -265,7 +265,6 @@ if (empty($reshook)) { if (GETPOSTISSET($batch)) { //shipment line with batch-enable product $qty .= '_'.$j; - while (GETPOSTISSET($batch)) { // save line of detail into sub_qty $sub_qty[$j]['q'] = GETPOST($qty, 'int'); // the qty we want to move for this stock record From c74cc53b2205fdb30ff0e6f7f7befd630a3538b3 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Fri, 21 Oct 2022 12:16:52 +0200 Subject: [PATCH 4/8] Fix migration script when running on mysql 8 --- htdocs/install/mysql/migration/16.0.0-17.0.0.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql index f9eb9968f4f..1dfcd489ee9 100644 --- a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql +++ b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql @@ -195,4 +195,5 @@ ALTER TABLE llx_bank_url ADD INDEX idx_bank_url_url_id (url_id); ALTER TABLE llx_societe_remise_except ADD COLUMN multicurrency_code varchar(3) NULL; ALTER TABLE llx_societe_remise_except ADD COLUMN multicurrency_tx double(24,8) NULL; -ALTER TABLE llx_hrm_evaluationdet CHANGE COLUMN rank rankorder integer; +-- VMYSQL4.3 ALTER TABLE llx_hrm_evaluationdet CHANGE COLUMN `rank` rankorder integer; +-- VPGSQL8.2 ALTER TABLE llx_hrm_evaluationdet CHANGE COLUMN rank rankorder integer; From 2d7348aff861a851d111333c502c4f09d6a92113 Mon Sep 17 00:00:00 2001 From: emilisev Date: Mon, 24 Oct 2022 20:13:43 +0200 Subject: [PATCH 5/8] Fix Undefined variable $num --- htdocs/adherents/type.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index cc3c697e032..fcdb643a006 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -145,6 +145,7 @@ if ($action == 'add' && $user->rights->adherent->configurer) { $sql = "SELECT libelle FROM ".MAIN_DB_PREFIX."adherent_type WHERE libelle='".$db->escape($object->label)."'"; $sql .= " WHERE entity IN (".getEntity('member_type').")"; $result = $db->query($sql); + $num = null; if ($result) { $num = $db->num_rows($result); } From dba982fcb96c205f239b79ee72ea83f5b5211037 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milise=20Prim?= Date: Mon, 24 Oct 2022 21:13:04 +0200 Subject: [PATCH 6/8] FIX Undefined property: stdClass::$email --- htdocs/core/boxes/box_birthdays_members.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/core/boxes/box_birthdays_members.php b/htdocs/core/boxes/box_birthdays_members.php index 6138664db2d..df8e51f348f 100644 --- a/htdocs/core/boxes/box_birthdays_members.php +++ b/htdocs/core/boxes/box_birthdays_members.php @@ -104,7 +104,6 @@ class box_birthdays_members extends ModeleBoxes $memberstatic->id = $objp->rowid; $memberstatic->firstname = $objp->firstname; $memberstatic->lastname = $objp->lastname; - $memberstatic->email = $objp->email; $dateb = $this->db->jdate($objp->birth); $age = date('Y', dol_now()) - date('Y', $dateb); From c4444e76c9009fc166a7e5508a941f3c19562247 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milise=20Prim?= Date: Mon, 24 Oct 2022 21:53:10 +0200 Subject: [PATCH 7/8] FIX Undefined variable $backtopage --- htdocs/core/actions_linkedfiles.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/actions_linkedfiles.inc.php b/htdocs/core/actions_linkedfiles.inc.php index b89d5bf6cb0..93d1e8463ec 100644 --- a/htdocs/core/actions_linkedfiles.inc.php +++ b/htdocs/core/actions_linkedfiles.inc.php @@ -160,7 +160,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes' && !empty($permissionto } if (is_object($object) && $object->id > 0) { - if ($backtopage) { + if (isset($backtopage)) { header('Location: '.$backtopage); exit; } else { From 1954e5a1aba0c651c56c35515184ffa2b45ff50d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Oct 2022 14:39:19 +0200 Subject: [PATCH 8/8] Update actions_linkedfiles.inc.php --- htdocs/core/actions_linkedfiles.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/actions_linkedfiles.inc.php b/htdocs/core/actions_linkedfiles.inc.php index 93d1e8463ec..4e2cd2873b6 100644 --- a/htdocs/core/actions_linkedfiles.inc.php +++ b/htdocs/core/actions_linkedfiles.inc.php @@ -160,7 +160,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes' && !empty($permissionto } if (is_object($object) && $object->id > 0) { - if (isset($backtopage)) { + if (!empty($backtopage)) { header('Location: '.$backtopage); exit; } else {