FIX #18934
Non-registration in the extrafieldsline database for deliveries
This commit is contained in:
parent
c75db78cea
commit
b027db49b5
@ -114,7 +114,7 @@ if ($action == 'add') {
|
|||||||
$idl = "idl".$i;
|
$idl = "idl".$i;
|
||||||
$qtytouse = price2num(GETPOST($qty));
|
$qtytouse = price2num(GETPOST($qty));
|
||||||
if ($qtytouse > 0) {
|
if ($qtytouse > 0) {
|
||||||
$object->addline(GETPOST($idl), price2num($qtytouse));
|
$object->addline(GETPOST($idl), price2num($qtytouse), $arrayoptions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -603,7 +603,7 @@ if ($action == 'create') { // Create. Seems to no be used
|
|||||||
print "</tr>";
|
print "</tr>";
|
||||||
|
|
||||||
// Display lines extrafields
|
// Display lines extrafields
|
||||||
if (!empty($extrafields)) {
|
//if (!empty($extrafields)) {
|
||||||
$colspan = 2;
|
$colspan = 2;
|
||||||
$mode = ($object->statut == 0) ? 'edit' : 'view';
|
$mode = ($object->statut == 0) ? 'edit' : 'view';
|
||||||
|
|
||||||
@ -618,8 +618,13 @@ if ($action == 'create') { // Create. Seems to no be used
|
|||||||
|
|
||||||
$object->lines[$i]->array_options = array_merge($object->lines[$i]->array_options, $srcLine->array_options);
|
$object->lines[$i]->array_options = array_merge($object->lines[$i]->array_options, $srcLine->array_options);
|
||||||
}
|
}
|
||||||
print $object->lines[$i]->showOptionals($extrafields, $mode, array('style' => 'class="oddeven"', 'colspan' => $colspan), $i);
|
else {
|
||||||
}
|
$srcLine = new DeliveryLine($db);
|
||||||
|
$extrafields->fetch_name_optionals_label($srcLine->table_element);
|
||||||
|
|
||||||
|
}
|
||||||
|
print $object->lines[$i]->showOptionals($extrafields, $mode, array('style' => 'class="oddeven"', 'colspan' => $colspan), '');
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
|
|||||||
@ -211,7 +211,7 @@ class Delivery extends CommonObject
|
|||||||
$origin_id = $this->lines[$i]->commande_ligne_id; // For backward compatibility
|
$origin_id = $this->lines[$i]->commande_ligne_id; // For backward compatibility
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->create_line($origin_id, $this->lines[$i]->qty, $this->lines[$i]->fk_product, $this->lines[$i]->description)) {
|
if (!$this->create_line($origin_id, $this->lines[$i]->qty, $this->lines[$i]->fk_product, $this->lines[$i]->description, $this->lines[$i]->array_options)) {
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -264,7 +264,7 @@ class Delivery extends CommonObject
|
|||||||
* @param string $description Description
|
* @param string $description Description
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function create_line($origin_id, $qty, $fk_product, $description)
|
public function create_line($origin_id, $qty, $fk_product, $description, $array_options = 0)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
$error = 0;
|
$error = 0;
|
||||||
@ -282,6 +282,15 @@ class Delivery extends CommonObject
|
|||||||
if (!$this->db->query($sql)) {
|
if (!$this->db->query($sql)) {
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$id = $this->db->last_insert_id(MAIN_DB_PREFIX."deliverydet");
|
||||||
|
|
||||||
|
if (is_array($array_options) && count($array_options) > 0) {
|
||||||
|
$line = new DeliveryLine($this->db);
|
||||||
|
$line->id = $id;
|
||||||
|
$line->array_options = $array_options;
|
||||||
|
$result = $line->insertExtraFields();
|
||||||
|
}
|
||||||
|
|
||||||
if ($error == 0) {
|
if ($error == 0) {
|
||||||
return 1;
|
return 1;
|
||||||
@ -531,7 +540,9 @@ class Delivery extends CommonObject
|
|||||||
$line->description = $expedition->lines[$i]->description;
|
$line->description = $expedition->lines[$i]->description;
|
||||||
$line->qty = $expedition->lines[$i]->qty_shipped;
|
$line->qty = $expedition->lines[$i]->qty_shipped;
|
||||||
$line->fk_product = $expedition->lines[$i]->fk_product;
|
$line->fk_product = $expedition->lines[$i]->fk_product;
|
||||||
|
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($expedition->lines[$i]->array_options) && count($expedition->lines[$i]->array_options) > 0) { // For avoid conflicts if trigger used
|
||||||
|
$line->array_options = $expedition->lines[$i]->array_options;
|
||||||
|
}
|
||||||
$this->lines[$i] = $line;
|
$this->lines[$i] = $line;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -593,14 +604,18 @@ class Delivery extends CommonObject
|
|||||||
* @param int $qty Qty
|
* @param int $qty Qty
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function addline($origin_id, $qty)
|
public function addline($origin_id, $qty, $array_options = 0)
|
||||||
{
|
{
|
||||||
$num = count($this->lines);
|
global $conf;
|
||||||
|
|
||||||
|
$num = count($this->lines);
|
||||||
$line = new DeliveryLine($this->db);
|
$line = new DeliveryLine($this->db);
|
||||||
|
|
||||||
$line->origin_id = $origin_id;
|
$line->origin_id = $origin_id;
|
||||||
$line->qty = $qty;
|
$line->qty = $qty;
|
||||||
|
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options) > 0) { // For avoid conflicts if trigger used
|
||||||
|
$line->array_options = $array_options;
|
||||||
|
}
|
||||||
$this->lines[$num] = $line;
|
$this->lines[$num] = $line;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user