dolibarr 21.0.0-beta
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-2024 Frédéric France <frederic.france@free.fr>
9 * Copyright (C) 2024 Vincent Maury <vmaury@timgroup.fr>
10 * Copyright (C) 2024 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";
51// Protection to avoid direct call of template
52if (empty($object) || !is_object($object)) {
53 print "Error, template page can't be called as URL";
54 exit(1);
55}
56
57'
58@phan-var-force CommonObject $this
59@phan-var-force CommonObject $object
60@phan-var-force int $i
61@phan-var-force bool $var
62@phan-var-force BOMLine $line
63@phan-var-force Societe $buyer
64@phan-var-force Societe $seller
65';
66
67global $forceall, $filtertype;
68
69if (empty($forceall)) {
70 $forceall = 0;
71}
72
73if (empty($filtertype)) {
74 $filtertype = 0;
75}
76
77$formproduct = new FormProduct($object->db);
78
79
80// Define colspan for the button 'Add'
81$colspan = 3; // Columns: total ht + col edit + col delete
82
83// Lines for extrafield
84$objectline = new BOMLine($this->db);
85
86print "<!-- BEGIN PHP TEMPLATE bom/tpl/objectline_edit.tpl.php -->\n";
87
88$coldisplay = 0;
89print '<tr class="oddeven tredited">';
90// Adds a line numbering column
91if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER')) {
92 print '<td class="linecolnum center">'.($i + 1).'</td>';
93 $coldisplay++;
94}
95
96$coldisplay++;
97?>
98 <td>
99 <div id="line_<?php echo $line->id; ?>"></div>
100
101 <input type="hidden" name="lineid" value="<?php echo $line->id; ?>">
102 <input type="hidden" id="product_type" name="type" value="<?php echo $line->product_type; ?>">
103 <input type="hidden" id="product_id" name="productid" value="<?php echo(!empty($line->fk_product) ? $line->fk_product : 0); ?>" />
104 <input type="hidden" id="special_code" name="special_code" value="<?php echo $line->special_code; ?>">
105 <input type="hidden" id="fk_parent_line" name="fk_parent_line" value="<?php echo $line->fk_parent_line; ?>">
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 $fk_parent_line = (GETPOST('fk_parent_line') ? GETPOST('fk_parent_line') : $line->fk_parent_line);
117 $parameters = array('line' => $line, 'fk_parent_line' => $fk_parent_line, 'var' => $var, 'dateSelector' => $dateSelector, 'seller' => $seller, 'buyer' => $buyer);
118 $reshook = $hookmanager->executeHooks('formEditProductOptions', $parameters, $this, $action);
119}
120
121//Line extrafield
122if (is_object($objectline) && !empty($extrafields)) {
123 $temps = $line->showOptionals($extrafields, 'edit', array('class' => 'tredited'), '', '', 1, 'line');
124 if (!empty($temps)) {
125 print '<div style="padding-top: 10px" id="extrafield_lines_area_edit" name="extrafield_lines_area_edit">';
126 print $temps;
127 print '</div>';
128 }
129}
130
131print '</td>';
132
133/*if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines
134{
135 $coldisplay++;
136?>
137 <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>
138<?php
139*/
140
141$coldisplay++;
142
143print '<td class="nobottom linecolqty right">';
144if (($line->info_bits & 2) != 2) {
145 // I comment this because it shows info even when not required
146 // 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
147 // must also not be output for most entities (proposal, intervention, ...)
148 //if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." ";
149 print '<input size="3" type="text" class="flat right" name="qty" id="qty" value="'.$line->qty.'">';
150}
151print '</td>';
152
153if ($filtertype != 1) { // Product
154 if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
155 $coldisplay++;
156 print '<td class="nobottom nowrap linecolunit">';
157 print $formproduct->selectMeasuringUnits("fk_unit", '', (($line->fk_unit) ? $line->fk_unit : ''), 0, 0);
158 print '</td>';
159 }
160} else { // Service
161 $coldisplay++;
162 print '<td class="nobottom nowrap linecolunit">';
163 print $formproduct->selectMeasuringUnits("fk_unit", "time", ($line->fk_unit) ? $line->fk_unit : '', 0, 0);
164 print '</td>';
165}
166if ($filtertype != 1 || getDolGlobalString('STOCK_SUPPORTS_SERVICES')) { // Product or stock support for Services is active
167 // Qty frozen
168 $coldisplay++;
169 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"' : '')) . '>';
170 print '</td>';
171
172 // Disable stock change
173 $coldisplay++;
174 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"' : '')) . '">';
175 print '</td>';
176
177 // Efficiency
178 $coldisplay++;
179 print '<td class="nobottom nowrap linecollost right">';
180 print '<input type="text" size="2" name="efficiency" id="efficiency" class="flat right" value="' . $line->efficiency . '"></td>';
181}
182
183// Service and workstations are active
184if ($filtertype == 1 && isModEnabled('workstation')) {
185 $coldisplay++;
186 print '<td class="nobottom nowrap linecolworkstation">';
187 print $formproduct->selectWorkstations($line->fk_default_workstation, 'idworkstations', 1);
188 print '</td>';
189}
190// Cost
191$coldisplay++;
192print '<td class="nobottom nowrap linecolcostprice right">';
193print '</td>';
194
195$coldisplay += $colspan;
196print '<td class="nobottom linecoledit center valignmiddle" colspan="'.$colspan.'">';
197$coldisplay += $colspan;
198print '<input type="submit" class="reposition button buttongen margintoponly marginbottomonly button-save" id="savelinebutton" name="save" value="'.$langs->trans("Save").'">';
199print '<input type="submit" class="reposition button buttongen margintoponly marginbottomonly button-cancel" id="cancellinebutton" name="cancel" value="'.$langs->trans("Cancel").'">';
200print '</td>';
201print '</tr>';
202
203print "<!-- END PHP TEMPLATE objectline_edit.tpl.php -->\n";
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:66
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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
Definition repair.php:149
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:152