- 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 ' ';
+ 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
?>
-
-
statut == 0 && ($object_rights->creer) && $action != 'selectlines' ) { ?>
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 5a09ea17127..02c7a9ca6dd 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -3911,12 +3911,13 @@ abstract class CommonObject
* @param string $buyer Object of buyer third party
* @param int $selected Object line selected
* @param int $dateSelector 1=Show also date range input fields
+ * @param string $defaulttpldir Directory where to find the template
* @return void
*/
- public function printObjectLines($action, $seller, $buyer, $selected = 0, $dateSelector = 0)
+ public function printObjectLines($action, $seller, $buyer, $selected = 0, $dateSelector = 0, $defaulttpldir = '/core/tpl')
{
- global $conf, $hookmanager, $langs, $user;
- // TODO We should not use global var for this !
+ global $conf, $hookmanager, $langs, $user, $object;
+ // TODO We should not use global var for this
global $inputalsopricewithtax, $usemargins, $disableedit, $disablemove, $disableremove, $outputalsopricetotalwithtax;
// Define usemargins
@@ -3934,90 +3935,26 @@ abstract class CommonObject
$reshook = $hookmanager->executeHooks('printObjectLineTitle', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook))
{
- // Title line
- print "\n";
-
- print '
';
-
- // Adds a line numbering column
- if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) print '
';
-
- // Description
- print '
'.$langs->trans('Description').'
';
-
- if ($this->element == 'supplier_proposal' || $this->element == 'order_supplier' || $this->element == 'invoice_supplier')
+ // Output template part (modules that overwrite templates must declare this into descriptor)
+ // Use global variables + $dateSelector + $seller and $buyer
+ $dirtpls=array_merge($conf->modules_parts['tpl'], array($defaulttpldir));
+ foreach($dirtpls as $module => $reldir)
{
- print '
\n";
- print "\n";
}
$var = true;
@@ -4045,7 +3982,7 @@ abstract class CommonObject
}
if (empty($reshook))
{
- $this->printObjectLine($action, $line, $var, $num, $i, $dateSelector, $seller, $buyer, $selected, $extrafieldsline);
+ $this->printObjectLine($action, $line, $var, $num, $i, $dateSelector, $seller, $buyer, $selected, $extrafieldsline, $defaulttpldir);
}
$i++;
@@ -4067,9 +4004,10 @@ abstract class CommonObject
* @param string $buyer Object of buyer third party
* @param int $selected Object line selected
* @param int $extrafieldsline Object of extrafield line attribute
+ * @param string $defaulttpldir Directory where to find the template
* @return void
*/
- public function printObjectLine($action, $line, $var, $num, $i, $dateSelector, $seller, $buyer, $selected = 0, $extrafieldsline = 0)
+ public function printObjectLine($action, $line, $var, $num, $i, $dateSelector, $seller, $buyer, $selected = 0, $extrafieldsline = 0, $defaulttpldir = '/core/tpl')
{
global $conf,$langs,$user,$object,$hookmanager;
global $form,$bc,$bcdd;
@@ -4157,7 +4095,7 @@ abstract class CommonObject
}
}
- // Ligne en mode update
+ // Line in update mode
if ($this->statut == 0 && $action == 'editline' && $selected == $line->id)
{
$label = (! empty($line->label) ? $line->label : (($line->fk_product > 0) ? $line->product_label : ''));
@@ -4167,7 +4105,7 @@ abstract class CommonObject
// Output template part (modules that overwrite templates must declare this into descriptor)
// Use global variables + $dateSelector + $seller and $buyer
- $dirtpls=array_merge($conf->modules_parts['tpl'], array('/core/tpl'));
+ $dirtpls=array_merge($conf->modules_parts['tpl'], array($defaulttpldir));
foreach($dirtpls as $module => $reldir)
{
if (!empty($module))
diff --git a/htdocs/core/tpl/objectline_title.tpl.php b/htdocs/core/tpl/objectline_title.tpl.php
new file mode 100644
index 00000000000..fd848764721
--- /dev/null
+++ b/htdocs/core/tpl/objectline_title.tpl.php
@@ -0,0 +1,131 @@
+
+ * 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
+ * $element (used to test $user->rights->$element->creer)
+ * $permtoedit (used to replace test $user->rights->$element->creer)
+ * $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax)
+ * $outputalsopricetotalwithtax
+ * $usemargins (0 to disable all margins columns, 1 to show according to margin setup)
+ *
+ * $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;
+}
+?>
+
+\n";
+
+print '
';
+
+// Adds a line numbering column
+if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) print '