dolibarr 20.0.0
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 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22 *
23 * Need to have following variables defined:
24 * $object (invoice, order, ...)
25 * $conf
26 * $langs
27 * $seller, $buyer
28 * $dateSelector
29 * $forceall (0 by default, 1 for supplier invoices/orders)
30 * $senderissupplier (0 by default, 1 for supplier invoices/orders)
31 * $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax)
32 */
33
34require_once DOL_DOCUMENT_ROOT."/product/class/html.formproduct.class.php";
35
36
37// Protection to avoid direct call of template
38if (empty($object) || !is_object($object)) {
39 print "Error, template page can't be called as URL";
40 exit(1);
41}
42
43'@phan-var-force CommonObject $this
44 @phan-var-force CommonObject $object';
45
46global $forceall, $filtertype;
47
48if (empty($forceall)) {
49 $forceall = 0;
50}
51
52if (empty($filtertype)) {
53 $filtertype = 0;
54}
55
56$formproduct = new FormProduct($object->db);
57
58
59// Define colspan for the button 'Add'
60$colspan = 3; // Columns: total ht + col edit + col delete
61
62// Lines for extrafield
63$objectline = new BOMLine($this->db);
64
65print "<!-- BEGIN PHP TEMPLATE objectline_edit.tpl.php -->\n";
66
67$coldisplay = 0;
68print '<tr class="oddeven tredited">';
69// Adds a line numbering column
70if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER')) {
71 print '<td class="linecolnum center">'.($i + 1).'</td>';
72 $coldisplay++;
73}
74
75$coldisplay++;
76?>
77 <td>
78 <div id="line_<?php echo $line->id; ?>"></div>
79
80 <input type="hidden" name="lineid" value="<?php echo $line->id; ?>">
81 <input type="hidden" id="product_type" name="type" value="<?php echo $line->product_type; ?>">
82 <input type="hidden" id="product_id" name="productid" value="<?php echo(!empty($line->fk_product) ? $line->fk_product : 0); ?>" />
83 <input type="hidden" id="special_code" name="special_code" value="<?php echo $line->special_code; ?>">
84 <input type="hidden" id="fk_parent_line" name="fk_parent_line" value="<?php echo $line->fk_parent_line; ?>">
85
86<?php
87// Predefined product/service
88if ($line->fk_product > 0) {
89 $tmpproduct = new Product($object->db);
90 $tmpproduct->fetch($line->fk_product);
91 print $tmpproduct->getNomUrl(1);
92}
93
94if (is_object($hookmanager)) {
95 $fk_parent_line = (GETPOST('fk_parent_line') ? GETPOST('fk_parent_line') : $line->fk_parent_line);
96 $parameters = array('line'=>$line, 'fk_parent_line'=>$fk_parent_line, 'var'=>$var, 'dateSelector'=>$dateSelector, 'seller'=>$seller, 'buyer'=>$buyer);
97 $reshook = $hookmanager->executeHooks('formEditProductOptions', $parameters, $this, $action);
98}
99
100//Line extrafield
101if (is_object($objectline) && !empty($extrafields)) {
102 $temps = $line->showOptionals($extrafields, 'edit', array('class'=>'tredited'), '', '', 1, 'line');
103 if (!empty($temps)) {
104 print '<div style="padding-top: 10px" id="extrafield_lines_area_edit" name="extrafield_lines_area_edit">';
105 print $temps;
106 print '</div>';
107 }
108}
109
110print '</td>';
111
112/*if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines
113{
114 $coldisplay++;
115?>
116 <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>
117<?php
118*/
119
120$coldisplay++;
121
122print '<td class="nobottom linecolqty right">';
123if (($line->info_bits & 2) != 2) {
124 // I comment this because it shows info even when not required
125 // 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
126 // must also not be output for most entities (proposal, intervention, ...)
127 //if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." ";
128 print '<input size="3" type="text" class="flat right" name="qty" id="qty" value="'.$line->qty.'">';
129}
130print '</td>';
131
132if ($filtertype != 1) {
133 if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
134 $coldisplay++;
135 print '<td class="nobottom nowrap linecolunit">';
136 print $formproduct->selectMeasuringUnits("fk_unit", '', (($line->fk_unit) ? $line->fk_unit : ''), 0, 0);
137 print '</td>';
138 }
139
140 $coldisplay++;
141 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"' : '')) . '>';
142 print '</td>';
143
144 $coldisplay++;
145 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"' : '')) . '">';
146 print '</td>';
147
148 $coldisplay++;
149 print '<td class="nobottom nowrap linecollost right">';
150 print '<input type="text" size="2" name="efficiency" id="efficiency" class="flat right" value="' . $line->efficiency . '"></td>';
151
152 $coldisplay++;
153 print '<td class="nobottom nowrap linecolcostprice right">';
154 print '</td>';
155} else {
156 $coldisplay++;
157 print '<td class="nobottom nowrap linecolunit">';
158 print $formproduct->selectMeasuringUnits("fk_unit", "time", ($line->fk_unit) ? $line->fk_unit : '', 0, 0);
159 print '</td>';
160
161 $coldisplay++;
162 print '<td class="nobottom nowrap linecolworkstation">';
163 print $formproduct->selectWorkstations($line->fk_default_workstation, 'idworkstations', 1);
164 print '</td>';
165
166 $coldisplay++;
167 print '<td class="nobottom nowrap linecolcostprice right">';
168 print '</td>';
169}
170
171$coldisplay += $colspan;
172print '<td class="nobottom linecoledit center valignmiddle" colspan="'.$colspan.'">';
173$coldisplay += $colspan;
174print '<input type="submit" class="reposition button buttongen margintoponly marginbottomonly button-save" id="savelinebutton" name="save" value="'.$langs->trans("Save").'">';
175print '<input type="submit" class="reposition button buttongen margintoponly marginbottomonly button-cancel" id="cancellinebutton" name="cancel" value="'.$langs->trans("Cancel").'">';
176print '</td>';
177print '</tr>';
178
179print "<!-- END PHP TEMPLATE objectline_edit.tpl.php -->\n";
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:58
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 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:139
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:142