dolibarr 25.0.0-alpha
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 * Copyright (C) 2025 Nick Fragoulis
12 * Copyright (C) 2026 Jose MARTINEZ <jose.martinez@pichinov.com>
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 3 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program. If not, see <https://www.gnu.org/licenses/>.
26 *
27 * Need to have the following variables defined:
28 * $object (invoice, order, ...)
29 * $conf
30 * $langs
31 * $seller, $buyer
32 * $dateSelector
33 * $forceall (0 by default, 1 for supplier invoices/orders)
34 * $senderissupplier (0 by default, 1 for supplier invoices/orders)
35 * $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax)
36 */
37
38require_once DOL_DOCUMENT_ROOT."/product/class/html.formproduct.class.php";
39
54// Protection to avoid direct call of template
55if (empty($object) || !is_object($object)) {
56 print "Error, template page can't be called as URL";
57 exit(1);
58}
59
60'
61@phan-var-force receptionlinebatch $line
62@phan-var-force CommonObject $this
63@phan-var-force CommonObject $object
64@phan-var-force int $i
65@phan-var-force bool $var
66@phan-var-force Societe $buyer
67@phan-var-force Societe $seller
68';
69
70global $forceall, $filtertype;
71
72if (empty($forceall)) {
73 $forceall = 0;
74}
75
76if (empty($filtertype)) {
77 $filtertype = 0;
78}
79
80$formproduct = new FormProduct($object->db);
81$form = new Form($object->db);
82
83// Define colspan for the button 'Add'
84$colspan = 3;
85
86// Lines for extrafield
87$objectline = new ReceptionLineBatch($this->db);
88
89print "<!-- BEGIN PHP TEMPLATE reception/tpl/objectline_edit.tpl.php -->\n";
90
91$coldisplay = 0;
92print '<tr class="oddeven tredited">';
93// Adds a line numbering column
94if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER')) {
95 print '<td class="linecolnum center">'.($i + 1).'</td>';
96 $coldisplay++;
97}
98
99$coldisplay++;
100?>
101 <td>
102 <div id="line_<?php echo $line->id; ?>"></div>
103
104 <input type="hidden" name="lineid" value="<?php echo $line->id; ?>">
105 <input type="hidden" id="product_type" name="type" value="<?php echo $line->product_type; ?>">
106 <input type="hidden" id="product_id" name="productid" value="<?php echo(!empty($line->fk_product) ? $line->fk_product : 0); ?>" />
107 <input type="hidden" id="special_code" name="special_code" value="<?php echo $line->special_code; ?>">
108
109<?php
110// Predefined product/service
111if ($line->fk_product > 0) {
112 $tmpproduct = new Product($object->db);
113 $tmpproduct->fetch($line->fk_product);
114 print $tmpproduct->getNomUrl(1);
115 print ' - '.$tmpproduct->label;
116}
117
118//Line extrafield
119if (!empty($extrafields)) {
120 $temps = $line->showOptionals($extrafields, 'edit', array('class' => 'tredited'), '', '', '1', 'line');
121 if (!empty($temps)) {
122 print '<div style="padding-top: 10px" id="extrafield_lines_area_edit" name="extrafield_lines_area_edit">';
123 print $temps;
124 print '</div>';
125 }
126}
127
128print '</td>';
129
130print '<td class="nobottom linecolrefsupplier">';
131$coldisplay++;
132print '<input id="fourn_ref" name="fourn_ref" class="flat minwidth50 maxwidth100" value="'.dol_escape_htmltag((string) (!empty($line->ref_fourn) ? $line->ref_fourn : '')).'">';
133print '</td>';
134print '<td class="nobottom linecolcostprice right">';
135$coldisplay++;
136print '<input size="6" type="text" class="flat right" name="cost_price" id="cost_price" value="'.(!empty($line->cost_price) ? price2num($line->cost_price) : '').'">';
137print '</td>';
138print '<td class="nobottom linecolqty right">';
139$coldisplay++;
140
141if (((int) $line->info_bits & 2) != 2) {
142 print '<input size="3" type="text" class="flat right" name="qty" id="qty" value="'.$line->qty.'">';
143}
144print '</td>';
145
146
147if (getDolGlobalString('PRODUCT_USE_UNITS')) {
148 $unit_type = false;
149 // limit unit select to unit type
150 if (!empty($line->fk_unit) && !getDolGlobalString('MAIN_EDIT_LINE_ALLOW_ALL_UNIT_TYPE')) {
151 include_once DOL_DOCUMENT_ROOT.'/core/class/cunits.class.php';
152 $cUnit = new CUnits($line->db);
153 if ($cUnit->fetch((int) $line->fk_unit) > 0) {
154 if (!empty($cUnit->unit_type)) {
155 $unit_type = $cUnit->unit_type;
156 }
157 }
158 }
159 $coldisplay++;
160 print '<td class="left">';
161 print $form->selectUnits(GETPOSTISSET('units') ? GETPOST('units') : $line->fk_unit, "units", 0, $unit_type);
162 print '</td>';
163}
164print '<td class="nobottom linecolwarehouse right">';
165$coldisplay++;
166require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
167$formproductline = new FormProduct($object->db);
168print $formproductline->selectWarehouses(!empty($line->fk_entrepot) ? $line->fk_entrepot : '', 'entrepot_id', '', 1, 0, (!empty($line->fk_product) ? $line->fk_product : 0), '', 1);
169print '</td>';
170if (isModEnabled('productbatch')) {
171 print '<td class="nobottom linecolbatch">';
172 $coldisplay++;
173 print '<input size="8" type="text" class="flat" name="batch" id="batch" value="'.dol_escape_htmltag((string) (!empty($line->batch) ? $line->batch : '')).'">';
174 print '</td>';
175}
176
177$coldisplay += $colspan;
178print '<td class="nobottom linecoledit center valignmiddle" colspan="'.$colspan.'">';
179print '<input type="submit" class="reposition button buttongen margintoponly marginbottomonly button-save" id="savelinebutton" name="save" value="'.$langs->trans("Save").'">';
180print '<input type="submit" class="reposition button buttongen margintoponly marginbottomonly button-cancel" id="cancellinebutton" name="cancel" value="'.$langs->trans("Cancel").'">';
181print '</td>';
182print '</tr>';
183
184print "<!-- END PHP TEMPLATE objectline_edit.tpl.php -->\n";
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
$propal type
'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]',...
Definition propal.php:280
Class of dictionary type of thirdparty (used by imports)
Class to manage generation of HTML components Only common components must be here.
Class with static methods for building HTML components related to products Only components common to ...
Class to manage products or services.
Class to manage table commandefournisseurdispatch.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:140