Transfer of Extrafields from Order to Shipping

Hi,
I have created some extrafields and an extrafield_line for proposal, order, shipping and invoice modules. In each case, they are the same. When I create an order out of a proposal these extrafields are automatically loaded into the order card and when I create an invoice out of the shipping, these extrafields are likewise automatically loaded into the order invoice card. However, this does not work if I create a shipping out of an order. When I fill the extrafields in the shipping module, they are stored in the database, so extrafields in principle are working, only the transfer or fetch from the order module does not work.
Can anyone please help me? I really tried a lot, but I cannot find a solution. :dry:
Thanks!

I have a similar problem with ExtraFields when I create Proposal > Customer Order > Invoice

I think it has something to do with the sequence of Modules.

I hope using Permutations and combinations of all modules I can get to an answer.
If I get to an answer I will definitely tell you.

1 Like

Hi,

Seems to be a bug, which version of dolibarr are you using?

Hi,
I’m using 5.0.6
In the meantime I fixed the problem by editing the card.php in htdocs\expedition.

Hi,

I made a PR for 6.0.
You can compare your fix with it. Also added fix for transfer to receipts

1 Like

Hi,
thanks a lot!
My fix is a bit different. Maybe I should switch to your one when updating to 6.0

Can you Help me by Describing in details how you fixed it?

It’s surely not the best solution… I edited htdocs/expedition/card.php
In line 757 and 760 (version 5.0.2) I changed $expe to $object:
// Other attributes
$parameters = array(‘objectsrc’ => $objectsrc, ‘colspan’ => ’ colspan=“3”’, ‘socid’=>$socid);
$reshook=$hookmanager->executeHooks(‘formObjectOptions’,$parameters,$object,$action); // Note that $action and $object may have been modified by hook

        if (empty($reshook) && ! empty($extrafields-\>attribute_label)) {
        	print $object-\>showOptionals($extrafields, 'edit');
        }

and in line 1277 I changed $object to $line:
//Display lines extrafields
if (is_array($extralabelslines) && count($extralabelslines)>0)
{
$colspan=5;
//$line = new ExpeditionLigne($db);
$line->fetch_optionals($line->id,$extralabelslines);
print ‘<tr ‘.$bc[$var].’>’;
print $line->showOptionals($extrafieldsline, ‘edit’, array(‘style’=>$bc[$var], ‘colspan’=>$colspan),$indiceAsked);
print ‘</tr>’;
}