Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX transfer of line extrafields from order to invoice #7333

Merged
merged 3 commits into from
Sep 11, 2017
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion htdocs/compta/facture.php
Original file line number Diff line number Diff line change
Expand Up @@ -1153,7 +1153,9 @@

// Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
$lines[$i]->fetch_optionals($lines[$i]->rowid);
$extrafields = new ExtraFields($db);
$targetExtraLabels = $extrafields->fetch_name_optionals_label($object->table_element_line);
$lines[$i]->fetch_optionals($lines[$i]->rowid, $targetExtraLabels);
$array_options = $lines[$i]->array_options;
}

Expand Down
8 changes: 7 additions & 1 deletion htdocs/fourn/facture/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,13 @@
$date_end=$lines[$i]->date_fin_prevue;
if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel;
if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end;

// Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields = new ExtraFields($db);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because var $extrafields is already defined globally previously, it looks dangerous to use same name here.
If you rename into extrafieldsforlines, does you fix still work ?

$targetExtraLabels = $extrafields->fetch_name_optionals_label($object->table_element_line);
$lines[$i]->fetch_optionals($lines[$i]->rowid, $targetExtraLabels);
}
// FIXME Missing $lines[$i]->ref_supplier and $lines[$i]->label into addline and updateline methods. They are filled when coming from order for example.
$result = $object->addline(
$desc,
Expand Down