Skip to content

Commit

Permalink
Merge branch '6.0' of git@github.com:Dolibarr/dolibarr.git into 6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Sep 20, 2017
2 parents e61032a + 68c9d08 commit 21959ae
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 4 deletions.
17 changes: 16 additions & 1 deletion htdocs/compta/facture/card.php
Expand Up @@ -1356,6 +1356,7 @@
{
$line->origin = $object->origin;
$line->origin_id = $line->id;
$line->fetch_optionals($line->id);
}
}

Expand All @@ -1377,7 +1378,21 @@

$object->situation_counter = $object->situation_counter + 1;
$id = $object->createFromCurrent($user);
if ($id <= 0) $mesg = $object->error;
if ($id <= 0)
{
$mesg = $object->error;
}
else
{
$nextSituationInvoice = new Facture($db);
$nextSituationInvoice->fetch($id);
// create extrafields with data from create form
$extralabels = $extrafields->fetch_name_optionals_label($nextSituationInvoice->table_element);
$ret = $extrafields->setOptionalsFromPost($extralabels, $nextSituationInvoice);
if ($ret > 0) {
$nextSituationInvoice->insertExtraFields();
}
}
}
}

Expand Down
17 changes: 14 additions & 3 deletions htdocs/expedition/card.php
Expand Up @@ -780,9 +780,15 @@
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;

if (empty($reshook) && ! empty($extrafields->attribute_label)) {
print $object->showOptionals($extrafields, 'edit');
}
if (empty($reshook) && ! empty($extrafields->attribute_label)) {
// copy from order
$orderExtrafields = new Extrafields($db);
$orderExtrafieldLabels = $orderExtrafields->fetch_name_optionals_label($object->table_element);
if ($object->fetch_optionals($object->id, $orderExtrafieldLabels) > 0) {
$expe->array_options = array_merge($expe->array_options, $object->array_options);
}
print $object->showOptionals($extrafields, 'edit');
}


// Incoterms
Expand Down Expand Up @@ -1304,8 +1310,13 @@
if (is_array($extralabelslines) && count($extralabelslines)>0)
{
$colspan=5;
$orderLineExtrafields = new Extrafields($db);
$orderLineExtrafieldLabels = $orderLineExtrafields->fetch_name_optionals_label($object->table_element_line);
$srcLine = new OrderLine($db);
$srcLine->fetch_optionals($line->id,$orderLineExtrafieldLabels); // fetch extrafields also available in orderline
$line = new ExpeditionLigne($db);
$line->fetch_optionals($object->id,$extralabelslines);
$line->array_options = array_merge($line->array_options, $srcLine->array_options);
print '<tr class="oddeven">';
print $line->showOptionals($extrafieldsline, 'edit', array('style'=>$bc[$var], 'colspan'=>$colspan),$indiceAsked);
print '</tr>';
Expand Down
15 changes: 15 additions & 0 deletions htdocs/livraison/card.php
Expand Up @@ -565,6 +565,14 @@
}

// Other attributes
if ($action = 'create_delivery') {
// copy from expedition
$expeditionExtrafields = new Extrafields($db);
$expeditionExtrafieldLabels = $expeditionExtrafields->fetch_name_optionals_label($expedition->table_element);
if ($expedition->fetch_optionals($object->origin_id, $expeditionExtrafieldLabels) > 0) {
$object->array_options = array_merge($object->array_options, $expedition->array_options);
}
}
$cols = 2;
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';

Expand Down Expand Up @@ -665,6 +673,13 @@
$mode = ($object->statut == 0) ? 'edit' : 'view';
$line = new LivraisonLigne($db);
$line->fetch_optionals($object->lines[$i]->id,$extralabelslines);
if ($action = 'create_delivery') {
$srcLine = new ExpeditionLigne($db);
$expeditionLineExtrafields = new Extrafields($db);
$expeditionLineExtrafieldLabels = $expeditionLineExtrafields->fetch_name_optionals_label($srcLine->table_element);
$srcLine->fetch_optionals($expedition->lines[$i]->id,$expeditionLineExtrafieldLabels);
$line->array_options = array_merge($line->array_options, $srcLine->array_options);
}
print '<tr class="oddeven">';
print $line->showOptionals($extrafieldsline, $mode, array('style'=>$bc[$var], 'colspan'=>$colspan),$i);
print '</tr>';
Expand Down

0 comments on commit 21959ae

Please sign in to comment.