dolibarr 23.0.3
objectline_edit.tpl.php
1<?php
2/* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
3 * Copyright (C) 2010-2012 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
5 * Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
6 * Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
7 * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
8 * Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
9 * Copyright (C) 2024 Vincent Maury <vmaury@timgroup.fr>
10 * Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 3 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program. If not, see <https://www.gnu.org/licenses/>.
24 *
25 * Need to have the following variables defined:
26 * $object (invoice, order, ...)
27 * $conf
28 * $langs
29 * $seller, $buyer
30 * $dateSelector
31 * $forceall (0 by default, 1 for supplier invoices/orders)
32 * $senderissupplier (0 by default, 1 for supplier invoices/orders)
33 * $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax)
34 */
35
36require_once DOL_DOCUMENT_ROOT."/product/class/html.formproduct.class.php";
52// Protection to avoid direct call of template
53if (empty($object) || !is_object($object)) {
54 print "Error, template page can't be called as URL";
55 exit(1);
56}
57
58'
59@phan-var-force CommonObject $this
60@phan-var-force CommonObject $object
61@phan-var-force int $i
62@phan-var-force bool $var
63@phan-var-force BOMLine $line
64@phan-var-force Societe $buyer
65@phan-var-force Societe $seller
66';
67
68global $forceall, $filtertype;
69
70if (empty($forceall)) {
71 $forceall = 0;
72}
73
74if (empty($filtertype)) {
75 $filtertype = 0;
76}
77
78$formproduct = new FormProduct($object->db);
79
80
81// Define colspan for the button 'Add'
82$colspan = 3; // Columns: total ht + col edit + col delete
83
84// Lines for extrafield
85$objectline = new BOMLine($this->db);
86
87print "<!-- BEGIN PHP TEMPLATE bom/tpl/objectline_edit.tpl.php -->\n";
88
89$coldisplay = 0;
90print '<tr class="oddeven tredited">';
91// Adds a line numbering column
92if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER')) {
93 print '<td class="linecolnum center">'.($i + 1).'</td>';
94 $coldisplay++;
95}
96
97$coldisplay++;
98?>
99 <td>
100 <div id="line_<?php echo $line->id; ?>"></div>
101
102 <input type="hidden" name="lineid" value="<?php echo $line->id; ?>">
103 <input type="hidden" id="product_type" name="type" value="<?php echo $line->product_type; ?>">
104 <input type="hidden" id="product_id" name="productid" value="<?php echo(!empty($line->fk_product) ? $line->fk_product : 0); ?>" />
105 <input type="hidden" id="special_code" name="special_code" value="<?php echo $line->special_code; ?>">
106
107<?php
108// Predefined product/service
109if ($line->fk_product > 0) {
110 $tmpproduct = new Product($object->db);
111 $tmpproduct->fetch($line->fk_product);
112 print $tmpproduct->getNomUrl(1);
113}
114
115if (is_object($hookmanager)) {
116 $parameters = array('line' => $line, 'var' => $var, 'seller' => $seller, 'buyer' => $buyer);
117 $reshook = $hookmanager->executeHooks('formEditProductOptions', $parameters, $this, $action);
118}
119
120//Line extrafield
121if (is_object($objectline) && !empty($extrafields)) {
122 $temps = $line->showOptionals($extrafields, 'edit', array('class' => 'tredited'), '', '', '1', 'line');
123 if (!empty($temps)) {
124 print '<div style="padding-top: 10px" id="extrafield_lines_area_edit" name="extrafield_lines_area_edit">';
125 print $temps;
126 print '</div>';
127 }
128}
129
130print '</td>';
131
132/*if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines
133{
134 $coldisplay++;
135?>
136 <td class="right"><input id="fourn_ref" name="fourn_ref" class="flat minwidth75" value="<?php echo ($line->ref_supplier ? $line->ref_supplier : $line->ref_fourn); ?>"></td>
137<?php
138*/
139
140$coldisplay++;
141
142print '<td class="nobottom linecolqty right">';
143if (((int) $line->info_bits & 2) != 2) {
144 // I comment this because it shows info even when not required
145 // 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
146 // must also not be output for most entities (proposal, intervention, ...)
147 //if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." ";
148 print '<input size="3" type="text" class="flat right" name="qty" id="qty" value="'.$line->qty.'">';
149}
150print '</td>';
151
152if ($filtertype != 1) { // Product
153 if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
154 $coldisplay++;
155 print '<td class="nobottom nowrap linecolunit">';
156 print $formproduct->selectMeasuringUnits("fk_unit", '', (($line->fk_unit) ? $line->fk_unit : ''), 0, 0);
157 print '</td>';
158 }
159} else { // Service
160 $coldisplay++;
161 print '<td class="nobottom nowrap linecolunit">';
162 print $formproduct->selectMeasuringUnits("fk_unit", "time", ($line->fk_unit) ? $line->fk_unit : '', 0, 0);
163 print '</td>';
164}
165if ($filtertype != 1 || getDolGlobalString('STOCK_SUPPORTS_SERVICES')) { // Product or stock support for Services is active
166 // Qty frozen
167 $coldisplay++;
168 print '<td class="nobottom linecolqtyfrozen right"><input type="checkbox" name="qty_frozen" id="qty_frozen" class="flat right" value="1"' . (GETPOSTISSET("qty_frozen") ? (GETPOSTINT('qty_frozen') ? ' checked="checked"' : '') : ($line->qty_frozen ? ' checked="checked"' : '')) . '>';
169 print '</td>';
170
171 // Disable stock change
172 $coldisplay++;
173 print '<td class="nobottom linecoldisablestockchange right"><input type="checkbox" name="disable_stock_change" id="disable_stock_change" class="flat right" value="1"' . (GETPOSTISSET('disablestockchange') ? (GETPOSTINT("disable_stock_change") ? ' checked="checked"' : '') : ($line->disable_stock_change ? ' checked="checked"' : '')) . '">';
174 print '</td>';
175
176 // Efficiency
177 $coldisplay++;
178 print '<td class="nobottom nowrap linecollost right">';
179 print '<input type="text" size="2" name="efficiency" id="efficiency" class="flat right" value="' . $line->efficiency . '"></td>';
180}
181
182// Service and workstations are active
183if ($filtertype == 1 && isModEnabled('workstation')) {
184 $coldisplay++;
185 print '<td class="nobottom nowrap linecolworkstation">';
186 print $formproduct->selectWorkstations($line->fk_default_workstation, 'idworkstations', 1);
187 print '</td>';
188}
189// Cost
190$coldisplay++;
191print '<td class="nobottom nowrap linecolcostprice right">';
192print '</td>';
193
194$coldisplay += $colspan;
195print '<td class="nobottom linecoledit center valignmiddle" colspan="'.$colspan.'">';
196$coldisplay += $colspan;
197print '<input type="submit" class="reposition button buttongen margintoponly marginbottomonly button-save" id="savelinebutton" name="save" value="'.$langs->trans("Save").'">';
198print '<input type="submit" class="reposition button buttongen margintoponly marginbottomonly button-cancel" id="cancellinebutton" name="cancel" value="'.$langs->trans("Cancel").'">';
199print '</td>';
200print '</tr>';
201
202print "<!-- END PHP TEMPLATE objectline_edit.tpl.php -->\n";
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
Class for BOMLine.
Class with static methods for building HTML components related to products Only components common to ...
Class to manage products or services.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
if(preg_match('/(crypted|dolcrypt):/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]',...
Definition repair.php:125
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:128