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 Frédéric France <frederic.france@netlogic.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";
37
38
39// Protection to avoid direct call of template
40if (empty($object) || !is_object($object)) {
41 print "Error, template page can't be called as URL";
42 exit(1);
43}
44
45'
46@phan-var-force CommonObject $this
47@phan-var-force CommonObject $object
48@phan-var-force int $i
49@phan-var-force bool $var
50@phan-var-force BOMLine $line
51@phan-var-force Societe $buyer
52@phan-var-force Societe $seller
53';
54
55global $forceall, $filtertype;
56
57if (empty($forceall)) {
58 $forceall = 0;
59}
60
61if (empty($filtertype)) {
62 $filtertype = 0;
63}
64
65$formproduct = new FormProduct($object->db);
66
67
68// Define colspan for the button 'Add'
69$colspan = 3; // Columns: total ht + col edit + col delete
70
71// Lines for extrafield
72$objectline = new BOMLine($this->db);
73
74print "<!-- BEGIN PHP TEMPLATE bom/tpl/objectline_edit.tpl.php -->\n";
75
76$coldisplay = 0;
77print '<tr class="oddeven tredited">';
78// Adds a line numbering column
79if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER')) {
80 print '<td class="linecolnum center">'.($i + 1).'</td>';
81 $coldisplay++;
82}
83
84$coldisplay++;
85?>
86 <td>
87 <div id="line_<?php echo $line->id; ?>"></div>
88
89 <input type="hidden" name="lineid" value="<?php echo $line->id; ?>">
90 <input type="hidden" id="product_type" name="type" value="<?php echo $line->product_type; ?>">
91 <input type="hidden" id="product_id" name="productid" value="<?php echo(!empty($line->fk_product) ? $line->fk_product : 0); ?>" />
92 <input type="hidden" id="special_code" name="special_code" value="<?php echo $line->special_code; ?>">
93 <input type="hidden" id="fk_parent_line" name="fk_parent_line" value="<?php echo $line->fk_parent_line; ?>">
94
95<?php
96// Predefined product/service
97if ($line->fk_product > 0) {
98 $tmpproduct = new Product($object->db);
99 $tmpproduct->fetch($line->fk_product);
100 print $tmpproduct->getNomUrl(1);
101}
102
103if (is_object($hookmanager)) {
104 $fk_parent_line = (GETPOST('fk_parent_line') ? GETPOST('fk_parent_line') : $line->fk_parent_line);
105 $parameters = array('line' => $line, 'fk_parent_line' => $fk_parent_line, 'var' => $var, 'dateSelector' => $dateSelector, 'seller' => $seller, 'buyer' => $buyer);
106 $reshook = $hookmanager->executeHooks('formEditProductOptions', $parameters, $this, $action);
107}
108
109//Line extrafield
110if (is_object($objectline) && !empty($extrafields)) {
111 $temps = $line->showOptionals($extrafields, 'edit', array('class' => 'tredited'), '', '', 1, 'line');
112 if (!empty($temps)) {
113 print '<div style="padding-top: 10px" id="extrafield_lines_area_edit" name="extrafield_lines_area_edit">';
114 print $temps;
115 print '</div>';
116 }
117}
118
119print '</td>';
120
121/*if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines
122{
123 $coldisplay++;
124?>
125 <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>
126<?php
127*/
128
129$coldisplay++;
130
131print '<td class="nobottom linecolqty right">';
132if (($line->info_bits & 2) != 2) {
133 // I comment this because it shows info even when not required
134 // 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
135 // must also not be output for most entities (proposal, intervention, ...)
136 //if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." ";
137 print '<input size="3" type="text" class="flat right" name="qty" id="qty" value="'.$line->qty.'">';
138}
139print '</td>';
140
141if ($filtertype != 1) { // Product
142 if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
143 $coldisplay++;
144 print '<td class="nobottom nowrap linecolunit">';
145 print $formproduct->selectMeasuringUnits("fk_unit", '', (($line->fk_unit) ? $line->fk_unit : ''), 0, 0);
146 print '</td>';
147 }
148} else { // Service
149 $coldisplay++;
150 print '<td class="nobottom nowrap linecolunit">';
151 print $formproduct->selectMeasuringUnits("fk_unit", "time", ($line->fk_unit) ? $line->fk_unit : '', 0, 0);
152 print '</td>';
153}
154if ($filtertype != 1 || getDolGlobalString('STOCK_SUPPORTS_SERVICES')) { // Product or stock support for Services is active
155 // Qty frozen
156 $coldisplay++;
157 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"' : '')) . '>';
158 print '</td>';
159
160 // Disable stock change
161 $coldisplay++;
162 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"' : '')) . '">';
163 print '</td>';
164
165 // Efficiency
166 $coldisplay++;
167 print '<td class="nobottom nowrap linecollost right">';
168 print '<input type="text" size="2" name="efficiency" id="efficiency" class="flat right" value="' . $line->efficiency . '"></td>';
169}
170
171// Service and workstations are active
172if ($filtertype == 1 && isModEnabled('workstation')) {
173 $coldisplay++;
174 print '<td class="nobottom nowrap linecolworkstation">';
175 print $formproduct->selectWorkstations($line->fk_default_workstation, 'idworkstations', 1);
176 print '</td>';
177}
178// Cost
179$coldisplay++;
180print '<td class="nobottom nowrap linecolcostprice right">';
181print '</td>';
182
183$coldisplay += $colspan;
184print '<td class="nobottom linecoledit center valignmiddle" colspan="'.$colspan.'">';
185$coldisplay += $colspan;
186print '<input type="submit" class="reposition button buttongen margintoponly marginbottomonly button-save" id="savelinebutton" name="save" value="'.$langs->trans("Save").'">';
187print '<input type="submit" class="reposition button buttongen margintoponly marginbottomonly button-cancel" id="cancellinebutton" name="cancel" value="'.$langs->trans("Cancel").'">';
188print '</td>';
189print '</tr>';
190
191print "<!-- 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