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); } diff --git a/htdocs/core/actions_linkedfiles.inc.php b/htdocs/core/actions_linkedfiles.inc.php index b89d5bf6cb0..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 ($backtopage) { + if (!empty($backtopage)) { header('Location: '.$backtopage); exit; } else { 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); diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index f002dc8fe27..ab8c4a28cbc 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -224,6 +224,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); @@ -259,7 +261,17 @@ if (empty($reshook)) { $stockLocation = "ent1".$i."_0"; $qty = "qtyl".$i; - if (isModEnabled('productbatch') && $objectsrc->lines[$i]->product_tobatch) { // If product need a batch number + $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 product need a batch or serial number + if (isModEnabled('productbatch') && $objectsrc->lines[$i]->product_tobatch) { if (GETPOSTISSET($batch)) { //shipment line with batch-enable product $qty .= '_'.$j; @@ -274,6 +286,12 @@ if (empty($reshook)) { //var_dump($sub_qty[$j]['q']); //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) { + setEventMessages($langs->trans("TooManyQtyForSerialNumber", $product->ref, ''), null, 'errors'); + $totalqty=0; + break 2; + } $j++; $batch = "batchl".$i."_".$j; $qty = "qtyl".$i.'_'.$j; @@ -328,7 +346,6 @@ if (empty($reshook)) { } //var_dump($batch_line[2]); - if ($totalqty > 0 && !$error) { // There is at least one thing to ship and no error for ($i = 0; $i < $num; $i++) { $qty = "qtyl".$i; 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 d98840379a9..24ac0e37ff5 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,7 +195,8 @@ 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; -- Rename const to hide public and private notes (fix allow notes const was used to hide)