Skip to content

Commit

Permalink
Fix update extrafield
Browse files Browse the repository at this point in the history
  • Loading branch information
fappels committed Oct 24, 2017
1 parent b2cd229 commit ba18927
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions htdocs/expedition/card.php
Expand Up @@ -621,6 +621,7 @@
{
$error++;
}
unset($_POST["lineid".$details_entrepot->line_id]);
}
}
else if ($lines[$i] == $line_id)
Expand All @@ -631,6 +632,7 @@
{
$error++;
}
unset($_POST["lineid"]);
}
}

Expand Down Expand Up @@ -663,7 +665,16 @@
{
// line to update
$line = new ExpeditionLigne($db);

// Extrafields Lines
$extrafieldsline = new ExtraFields($db);
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
$line->array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline);
// Unset extrafield POST Data
if (is_array($extralabelsline)) {
foreach ($extralabelsline as $key => $value) {
unset($_POST["options_" . $key]);
}
}
$line->fk_product = $lines[$i]->fk_product;
if (is_array($lines[$i]->detail_batch) && count($lines[$i]->detail_batch) > 0)
{
Expand Down Expand Up @@ -695,6 +706,8 @@
$error++;
}
}
unset($_POST[$batch]);
unset($_POST[$qty]);
}
}
else
Expand All @@ -712,6 +725,8 @@
setEventMessages($line->error, $line->errors, 'errors');
$error++;
}
unset($_POST[$stockLocation]);
unset($_POST[$qty]);
}
else if (count($lines[$i]->details_entrepot) > 1)
{
Expand All @@ -732,23 +747,16 @@
$error++;
}
}
unset($_POST[$stockLocation]);
unset($_POST[$qty]);
}
}
}
}
}
}

// Extrafields Lines
$extrafieldsline = new ExtraFields($db);
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
$array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline);
// Unset extrafield POST Data
if (is_array($extralabelsline)) {
foreach ($extralabelsline as $key => $value) {
unset($_POST["options_" . $key]);
}
}
unset($_POST["lineid"]);

if (! $error) {
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
Expand Down Expand Up @@ -2296,7 +2304,7 @@
$line = new ExpeditionLigne($db);
$line->fetch_optionals($lines[$i]->id,$extralabelslines);
print '<tr class="oddeven">';
if ($lines[$i]->id == $line_id)
if ($action == 'editline' && $lines[$i]->id == $line_id)
{
print $line->showOptionals($extrafieldsline, 'edit', array('style'=>$bc[$var], 'colspan'=>$colspan),$indiceAsked);
}
Expand Down

0 comments on commit ba18927

Please sign in to comment.