Skip to content

Commit

Permalink
Fix: Don't load extrafields on orderstoinvoice
Browse files Browse the repository at this point in the history
  • Loading branch information
fmarcet committed Jul 5, 2016
1 parent ad82909 commit 50c5efc
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
14 changes: 14 additions & 0 deletions htdocs/commande/orderstoinvoice.php
Expand Up @@ -70,6 +70,11 @@
$date_starty = dol_mktime(0,0,0,$_REQUEST["date_start_delymonth"],$_REQUEST["date_start_delyday"],$_REQUEST["date_start_delyyear"]); // Date for local PHP server
$date_endy = dol_mktime(23,59,59,$_REQUEST["date_end_delymonth"],$_REQUEST["date_end_delyday"],$_REQUEST["date_end_delyyear"]);

$extrafields = new ExtraFields($db);

// fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label('facture');

if ($action == 'create')
{
if (is_array($selected) == false)
Expand Down Expand Up @@ -174,6 +179,9 @@
$object->remise_absolue = $_POST['remise_absolue'];
$object->remise_percent = $_POST['remise_percent'];

$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
if ($ret < 0) $error++;

if ($_POST['origin'] && $_POST['originid'])
{
$object->origin = $_POST['origin'];
Expand Down Expand Up @@ -464,6 +472,12 @@
$parameters=array('objectsrc' => $objectsrc, 'idsrc' => $listoforders, 'colspan' => ' colspan="3"');
$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))
{
$object=new Facture($db);
print $object->showOptionals($extrafields,'edit');
}

// Modele PDF
print '<tr><td>'.$langs->trans('Model').'</td>';
print '<td>';
Expand Down
14 changes: 14 additions & 0 deletions htdocs/fourn/commande/orderstoinvoice.php
Expand Up @@ -71,6 +71,11 @@
$date_starty = dol_mktime(0, 0, 0, $_REQUEST["date_start_delymonth"], $_REQUEST["date_start_delyday"], $_REQUEST["date_start_delyyear"]); // Date for local PHP server
$date_endy = dol_mktime(23, 59, 59, $_REQUEST["date_end_delymonth"], $_REQUEST["date_end_delyday"], $_REQUEST["date_end_delyyear"]);

$extrafields = new ExtraFields($db);

// fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label('facture_fourn');

if ($action == 'create') {
if (is_array($selected) == false) {
$mesgs = array (
Expand Down Expand Up @@ -160,6 +165,9 @@
if (empty($object->date_echeance))
$object->date_echeance = $object->calculate_date_lim_reglement();

$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
if ($ret < 0) $error++;

if ($_POST['origin'] && $_POST['originid']) {
$object->linked_objects = $orders_id;
$id = $object->create($user);
Expand Down Expand Up @@ -337,6 +345,12 @@
);
$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))
{
$object=new FactureFournisseur($db);
print $object->showOptionals($extrafields,'edit');
}

// Modele PDF
print '<tr><td>' . $langs->trans('Model') . '</td>';
print '<td>';
Expand Down

0 comments on commit 50c5efc

Please sign in to comment.