';
}
@@ -363,14 +363,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if ($action != 'editline')
{
// Add products/services form
-// $object->formAddObjectLine(1, $mysoc, $soc);
+ $object->formAddObjectLine(1, $mysoc, $soc, '/bom/tpl');
$parameters = array();
$reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
}
}
- if (! empty($object->lines) && $object->status == 0 && $permissiontoadd && $action != 'selectlines' && $action != 'editline')
+ if (! empty($object->lines) || ($object->status == 0 && $permissiontoadd && $action != 'selectlines' && $action != 'editline'))
{
print '
';
}
diff --git a/htdocs/bom/tpl/objectline_create.tpl.php b/htdocs/bom/tpl/objectline_create.tpl.php
new file mode 100644
index 00000000000..2937f5af45e
--- /dev/null
+++ b/htdocs/bom/tpl/objectline_create.tpl.php
@@ -0,0 +1,216 @@
+
+ * Copyright (C) 2010-2014 Laurent Destailleur
+ * Copyright (C) 2012-2013 Christophe Battarel
+ * Copyright (C) 2012 Cédric Salvador
+ * Copyright (C) 2014 Florian Henry
+ * Copyright (C) 2014 Raphaël Doursenaud
+ * Copyright (C) 2015-2016 Marcos García
+ * Copyright (C) 2018 Frédéric France
+ * Copyright (C) 2018 Ferran Marcet
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ * Need to have following variables defined:
+ * $object (invoice, order, ...)
+ * $conf
+ * $langs
+ * $dateSelector
+ * $forceall (0 by default, 1 for supplier invoices/orders)
+ * $senderissupplier (0 by default, 1 or 2 for supplier invoices/orders)
+ * $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax)
+ */
+
+// Protection to avoid direct call of template
+if (empty($object) || ! is_object($object)) {
+ print "Error: this template page cannot be called directly as an URL";
+ exit;
+}
+
+
+if (! isset($dateSelector)) global $dateSelector; // Take global var only if not already defined into function calling (for example formAddObjectLine)
+global $forceall, $forcetoshowtitlelines, $senderissupplier, $inputalsopricewithtax;
+
+if (! isset($dateSelector)) $dateSelector=1; // For backward compatibility
+elseif (empty($dateSelector)) $dateSelector=0;
+if (empty($forceall)) $forceall=0;
+if (empty($senderissupplier)) $senderissupplier=0;
+if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0;
+
+
+// Define colspan for the button 'Add'
+$colspan = 3; // Columns: total ht + col edit + col delete
+if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) $colspan++;//Add column for Total (currency) if required
+if (in_array($object->element, array('propal','commande','order','facture','facturerec','invoice','supplier_proposal','order_supplier','invoice_supplier'))) $colspan++; // With this, there is a column move button
+//print $object->element;
+
+// Lines for extrafield
+$objectline = new BOMLine($this->db);
+?>
+
+
+lines) == 0 || $forcetoshowtitlelines);
+if ($nolinesbefore) {
+?>
+
+
+showOptionals($extrafieldsline, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1);
+}
+?>
+
+
+
+
diff --git a/htdocs/bom/tpl/objectline_edit.tpl.php b/htdocs/bom/tpl/objectline_edit.tpl.php
new file mode 100644
index 00000000000..3763b771854
--- /dev/null
+++ b/htdocs/bom/tpl/objectline_edit.tpl.php
@@ -0,0 +1,325 @@
+
+ * Copyright (C) 2010-2012 Laurent Destailleur
+ * Copyright (C) 2012 Christophe Battarel
+ * Copyright (C) 2012 Cédric Salvador
+ * Copyright (C) 2012-2014 Raphaël Doursenaud
+ * Copyright (C) 2013 Florian Henry
+ * Copyright (C) 2018 Frédéric France
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ * Need to have following variables defined:
+ * $object (invoice, order, ...)
+ * $conf
+ * $langs
+ * $seller, $buyer
+ * $dateSelector
+ * $forceall (0 by default, 1 for supplier invoices/orders)
+ * $senderissupplier (0 by default, 1 for supplier invoices/orders)
+ * $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax)
+ */
+
+// Protection to avoid direct call of template
+if (empty($object) || ! is_object($object))
+{
+ print "Error, template page can't be called as URL";
+ exit;
+}
+
+
+global $forceall, $senderissupplier, $inputalsopricewithtax;
+if (empty($dateSelector)) $dateSelector=0;
+if (empty($forceall)) $forceall=0;
+if (empty($senderissupplier)) $senderissupplier=0;
+if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0;
+
+
+// Define colspan for the button 'Add'
+$colspan = 3; // Col total ht + col edit + col delete
+if (! empty($inputalsopricewithtax)) $colspan++; // We add 1 if col total ttc
+if (in_array($object->element, array('propal','supplier_proposal','facture','facturerec','invoice','commande','order','order_supplier','invoice_supplier'))) $colspan++; // With this, there is a column move button
+if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) $colspan+=2;
+?>
+
+
+
+
+
+
+ element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines
+ {
+ $coldisplay++;
+ ?>
+
+ info_bits & 2) != 2) {
+ // I comment this because it shows info even when not required
+ // for example always visible on invoice but must be visible only if stock module on and stock decrease option is on invoice validation and status is not validated
+ // must also not be output for most entities (proposal, intervention, ...)
+ //if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." ";
+ print 'fk_prev_id != null ) print ' readonly';
+ print '>';
+ } else { ?>
+
+
+
+
+
+
+
+
diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php
new file mode 100644
index 00000000000..46c25e3674c
--- /dev/null
+++ b/htdocs/bom/tpl/objectline_view.tpl.php
@@ -0,0 +1,330 @@
+
+ * Copyright (C) 2010-2011 Laurent Destailleur
+ * Copyright (C) 2012-2013 Christophe Battarel
+ * Copyright (C) 2012 Cédric Salvador
+ * Copyright (C) 2012-2014 Raphaël Doursenaud
+ * Copyright (C) 2013 Florian Henry
+ * Copyright (C) 2017 Juanjo Menent
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ * Need to have following variables defined:
+ * $object (invoice, order, ...)
+ * $conf
+ * $langs
+ * $dateSelector
+ * $forceall (0 by default, 1 for supplier invoices/orders)
+ * $element (used to test $user->rights->$element->creer)
+ * $permtoedit (used to replace test $user->rights->$element->creer)
+ * $senderissupplier (0 by default, 1 for supplier invoices/orders)
+ * $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax)
+ * $object_rights->creer initialized from = $object->getRights()
+ * $disableedit, $disablemove, $disableremove
+ *
+ * $type, $text, $description, $line
+ */
+
+// Protection to avoid direct call of template
+if (empty($object) || ! is_object($object))
+{
+ print "Error, template page can't be called as URL";
+ exit;
+}
+
+
+global $forceall, $senderissupplier, $inputalsopricewithtax, $outputalsopricetotalwithtax;
+
+if (empty($dateSelector)) $dateSelector=0;
+if (empty($forceall)) $forceall=0;
+if (empty($senderissupplier)) $senderissupplier=0;
+if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0;
+if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0;
+
+// add html5 elements
+$domData = ' data-element="'.$line->element.'"';
+$domData .= ' data-id="'.$line->id.'"';
+$domData .= ' data-qty="'.$line->qty.'"';
+$domData .= ' data-product_type="'.$line->product_type.'"';
+
+
+?>
+
+
+
+ element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines
+ {
+ ?>
+
+ info_bits & 2) != 2) && $line->special_code != 3) {
+ // I comment this because it shows info even when not required
+ // for example always visible on invoice but must be visible only if stock module on and stock decrease option is on invoice validation and status is not validated
+ // must also not be output for most entities (proposal, intervention, ...)
+ //if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." ";
+ echo price($line->qty, 0, '', 0, 0); // Yes, it is a quantity, not a price, but we just want the formating role of function price
+ } else echo ' ';
+ ?>
+