Merge pull request #24371 from atm-gauthier/fix_cant_update_extrafields_expedition_line

FIX : it was not possible to update extrafields of expedition lines w…
This commit is contained in:
Laurent Destailleur 2023-03-31 02:29:55 +02:00 committed by GitHub
commit 8f0bafd6c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -581,6 +581,7 @@ if (empty($reshook)) {
$num_prod = count($lines);
for ($i = 0; $i < $num_prod; $i++) {
if ($lines[$i]->id == $line_id) { // we have found line to update
$update_done = false;
$line = new ExpeditionLigne($db);
$line->fk_expedition = $object->id;
@ -621,6 +622,8 @@ if (empty($reshook)) {
if ($line->update($user) < 0) {
setEventMessages($line->error, $line->errors, 'errors');
$error++;
} else {
$update_done=true;
}
} else {
setEventMessages($lotStock->error, $lotStock->errors, 'errors');
@ -663,6 +666,8 @@ if (empty($reshook)) {
if ($line->update($user) < 0) {
setEventMessages($line->error, $line->errors, 'errors');
$error++;
} else {
$update_done=true;
}
} else {
setEventMessages($line->error, $line->errors, 'errors');
@ -680,6 +685,8 @@ if (empty($reshook)) {
if ($object->create_line_batch($line, $line->array_options) < 0) {
setEventMessages($object->error, $object->errors, 'errors');
$error++;
} else {
$update_done=true;
}
}
} else {
@ -717,6 +724,8 @@ if (empty($reshook)) {
if ($line->update($user) < 0) {
setEventMessages($line->error, $line->errors, 'errors');
$error++;
} else {
$update_done=true;
}
}
unset($_POST[$stockLocation]);
@ -731,6 +740,8 @@ if (empty($reshook)) {
if ($line->update($user) < 0) {
setEventMessages($line->error, $line->errors, 'errors');
$error++;
} else {
$update_done=true;
}
unset($_POST[$qty]);
}
@ -743,10 +754,17 @@ if (empty($reshook)) {
if ($line->update($user) < 0) {
setEventMessages($line->error, $line->errors, 'errors');
$error++;
} else {
$update_done=true;
}
unset($_POST[$qty]);
}
}
if (empty($update_done)) {
$line->id = $lines[$i]->id;
$line->insertExtraFields();
}
}
}