diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index fe205a912fd..9b57b35208e 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -762,6 +762,16 @@ if (empty($reshook)) { $result = $object->addline($desc, $pu_ht, (float) $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $info_bits, 0, $pu_ttc, $type, -1, $special_code, $label, (int) $fk_unit, 0, $date_start_fill, $date_end_fill, (int) $fournprice, (float) $buyingprice, $fk_parent_line); if ($result > 0) { + // TODO add "insert" function into FactureLigneRec or add "invoicerecline.class.php" (same of "factureligne.class.php") + $objectline = new FactureLigneRec($db); + if ($objectline->fetch($result)) { + $objectline->array_options = $array_options; + $result = $objectline->insertExtraFields(); + if ($result < 0) { + setEventMessages($langs->trans('Error').$result, null, 'errors'); + } + } + // Define output language and generate document /*if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { diff --git a/htdocs/core/class/canvas.class.php b/htdocs/core/class/canvas.class.php index e6e4c2de4ce..b0597730e43 100644 --- a/htdocs/core/class/canvas.class.php +++ b/htdocs/core/class/canvas.class.php @@ -121,8 +121,6 @@ class Canvas */ public function getCanvas($module, $card, $canvas) { - global $conf, $langs; - // Set properties with value specific to dolibarr core: this->targetmodule, this->card, this->canvas $this->targetmodule = $module; $this->canvas = $canvas; @@ -190,7 +188,12 @@ class Canvas return 0; } - if (file_exists($this->template_dir.(!empty($this->card) ? $this->card.'_' : '').$this->_cleanaction($action).'.tpl.php')) { + $newaction = $action; + if ($action && !in_array($action, array('create', 'view', 'edit', 'list'))) { + $newaction = 'view'; + } + + if (file_exists($this->template_dir.(!empty($this->card) ? $this->card.'_' : '').$this->_cleanaction($newaction).'.tpl.php')) { return 1; } else { return 0; @@ -208,11 +211,16 @@ class Canvas public function display_canvas($action) { // phpcs:enable - global $db, $conf, $langs, $user, $canvas; - global $form, $formfile; + global $db, $conf, $langs, $user, $canvas; // used into include + global $form, $formfile; // used into include + + $newaction = $action; + if ($action && !in_array($action, array('create', 'view', 'edit', 'list'))) { + $newaction = 'view'; + } //var_dump($this->card.'-'.$action); - include $this->template_dir.(!empty($this->card) ? $this->card.'_' : '').$this->_cleanaction($action).'.tpl.php'; // Include native PHP template + include $this->template_dir.(!empty($this->card) ? $this->card.'_' : '').$this->_cleanaction($newaction).'.tpl.php'; // Include native PHP template } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index ac2733c108c..de20e647bd5 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4626,9 +4626,12 @@ class Form } $optstart = '