diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index 7a8814edd4d73626dbb035c6fcece7068aae21a6..3bef2f412c17c4a7dbe43ab91cc139bac5da5045 100644 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -70,6 +70,11 @@ $date_end = dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endda $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) @@ -174,6 +179,9 @@ if (($action == 'create' || $action == 'add') && !$error) $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']; @@ -464,6 +472,12 @@ if ($action == 'create' && !$error) $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>'; diff --git a/htdocs/fourn/commande/orderstoinvoice.php b/htdocs/fourn/commande/orderstoinvoice.php index e11e70b12efc1454a840906ca7e2b0856591b5f4..2d89ad406c0a8c50eadd558fd32d4239dffaf4a2 100644 --- a/htdocs/fourn/commande/orderstoinvoice.php +++ b/htdocs/fourn/commande/orderstoinvoice.php @@ -71,6 +71,11 @@ $date_end = dol_mktime(23, 59, 59, $_REQUEST["date_endmonth"], $_REQUEST["date_e $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 ( @@ -160,6 +165,9 @@ if (($action == 'create' || $action == 'add') && empty($mesgs)) { 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); @@ -337,6 +345,12 @@ if ($action == 'create' && !$error) { ); $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>';