dolibarr 25.0.0-alpha
objectline_view.tpl.php
1<?php
2/* Copyright (C) 2010-2013 Regis Houssin <regis.houssin@inodbox.com>
3 * Copyright (C) 2010-2011 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2012-2013 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) 2017 Juanjo Menent <jmenent@2byte.es>
9 * Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
10 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
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 * $forceall (0 by default, 1 for supplier invoices/orders)
32 * $element (used to test $user->hasRight($element, 'creer'))
33 * $permtoedit (used to replace test $user->hasRight($element, 'creer'))
34 * $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax)
35 * $disableedit, $disablemove, $disableremove
36 *
37 * $type, $text, $description, $line
38 */
39
52'
53@phan-var-force receptionlinebatch $line
54@phan-var-force int $num
55@phan-var-force int $i
56@phan-var-force CommonObject $this
57@phan-var-force Reception $object
58';
59
60// Protection to avoid direct call of template
61if (empty($object) || !is_object($object)) {
62 print "Error, template page can't be called as URL";
63 exit(1);
64}
65
66global $filtertype;
67if (empty($filtertype)) {
68 $filtertype = 0;
69}
70
71
72global $forceall, $senderissupplier, $inputalsopricewithtax, $outputalsopricetotalwithtax, $langs;
73
74if (empty($dateSelector)) {
75 $dateSelector = 0;
76}
77if (empty($forceall)) {
78 $forceall = 0;
79}
80
81
82// add html5 elements
83$domData = ' data-element="'.$line->element.'"';
84$domData .= ' data-id="'.$line->id.'"';
85$domData .= ' data-qty="'.$line->qty.'"';
86$domData .= ' data-product_type="'.$line->product_type.'"';
87
88// Lines for extrafield
89$objectline = new ReceptionLineBatch($this->db);
90
91$coldisplay = 0;
92print "<!-- BEGIN PHP TEMPLATE reception/tpl/objectline_view.tpl.php -->\n";
93print '<tr id="row-'.$line->id.'" class="drag drop oddeven" '.$domData.' >';
94
95// Line nb
96if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER')) {
97 print '<td class="linecolnum center">'.($i + 1).'</td>';
98 $coldisplay++;
99}
100
101// Product
102print '<td class="linecoldescription line minwidth300imp tdoverflowmax300">';
103print '<div id="line_'.$line->id.'"></div>';
104$coldisplay++;
105$tmpproduct = new Product($object->db);
106if (!empty($line->fk_product)) {
107 $tmpproduct->fetch($line->fk_product);
108}
109$tmprecep = new Reception($object->db);
110if ($line->fk_product > 0) {
111 print $tmpproduct->getNomUrl(1);
112 print ' - '.$tmpproduct->label;
113 if (!empty($tmpproduct->barcode)) {
114 // Barcode (EAN/UPC) shown under the product name: handy to check received
115 // goods against the supplier's delivery note without opening each product.
116 print '<br><span class="opacitymedium small">'.$langs->trans("BarCode").' : '.dol_escape_htmltag($tmpproduct->barcode).'</span>';
117 }
118} else {
119 // Free-text line: no leading dash (there is no product name before it)
120 print $line->description;
121}
122print '</td>';
123
124// Qty
125print '<td class="linecolrefsupplier">';
126$coldisplay++;
127print dol_escape_htmltag((string) (!empty($line->ref_fourn) ? $line->ref_fourn : ''));
128if (!empty($line->fk_product) && !empty($object->socid) && getDolGlobalString('RECEPTION_MANAGE_SUPPLIER_PRICES')) {
129 // Button to manage the buying prices of the product, using the standard core popup
130 $urlpfp = DOL_URL_ROOT.'/product/price_suppliers.php?id='.((int) $line->fk_product).'&socid='.((int) $object->socid);
131 print ' '.dolButtonToOpenUrlInDialogPopup('pfpline'.$line->id, $langs->transnoentitiesnoconv('BuyingPrices'), img_picto('', 'edit', 'class="paddingleft"'), $urlpfp, '', 'classlink reposition', '', 'location.reload();');
132}
133print '</td>';
134print '<td class="linecolcostprice nowrap right">'.(!empty($line->cost_price) ? price($line->cost_price) : '').'</td>';
135$coldisplay++;
136print '<td class="linecolqty nowrap right">';
137$coldisplay++;
138echo price($line->qty, 0, '', 0, 0); // Yes, it is a quantity, not a price, but we just want the formatting role of function price
139print '</td>';
140
141// Unit
142if (getDolGlobalInt('PRODUCT_USE_UNITS')) { // For product, unit is shown only if option PRODUCT_USE_UNITS is on
143 print '<td class="linecoluseunit nowrap">';
144 $coldisplay++;
145 $label = measuringUnitString((int) $line->fk_unit, '', null, 1);
146 if ($label !== '') {
147 print $langs->trans($label);
148 }
149 print '</td>';
150}
151print '<td class="linecolwarehouse nowrap right">';
152$coldisplay++;
153if (!empty($line->fk_entrepot)) {
154 require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
155 $tmpwarehouse = new Entrepot($object->db);
156 if ($tmpwarehouse->fetch($line->fk_entrepot) > 0) {
157 print $tmpwarehouse->getNomUrl(1);
158 }
159}
160print '</td>';
161if (isModEnabled('productbatch')) {
162 print '<td class="linecolbatch">'.dol_escape_htmltag((string) (!empty($line->batch) ? $line->batch : '')).'</td>';
163 $coldisplay++;
164}
165
166if ($this->status == 0 && $user->hasRight('reception', 'write') && $action != 'selectlines') {
167 print '<td class="linecoledit center">';
168 $coldisplay++;
169 if (((int) $line->info_bits & 2) == 2 || !empty($disableedit)) {
170 } else {
171 print '<a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=editline&token='.newToken().'&lineid='.$line->id.'">'.img_edit().'</a>';
172 }
173 print '</td>';
174
175 print '<td class="linecoldelete center">';
176 $coldisplay++;
177
178 print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=deleteline&token='.newToken().'&lineid='.$line->id.'">';
179 print img_delete();
180 print '</a>';
181
182 print '</td>';
183
184 if ($num > 1 && $conf->browser->layout != 'phone' && empty($disablemove)) {
185 print '<td class="linecolmove tdlineupdown center">';
186 $coldisplay++;
187 if ($i > 0) {
188 print '<a class="lineupdown" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=up&token='.newToken().'&rowid='.$line->id.'">';
189 echo img_up('default', 0, 'imgupforline');
190 print '</a>';
191 }
192 if ($i < $num - 1) {
193 print '<a class="lineupdown" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=down&token='.newToken().'&rowid='.$line->id.'">';
194 echo img_down('default', 0, 'imgdownforline');
195 print '</a>';
196 }
197 print '</td>';
198 } else {
199 print '<td '.(($conf->browser->layout != 'phone' && empty($disablemove)) ? ' class="linecolmove tdlineupdown center"' : ' class="linecolmove center"').'></td>';
200 $coldisplay++;
201 }
202} else {
203 print '<td colspan="3"></td>';
204 $coldisplay += 3;
205}
206
207if ($action == 'selectlines') {
208 print '<td class="linecolcheck center">';
209 print '<input type="checkbox" class="linecheckbox" name="line_checkbox['.($i + 1).']" value="'.$line->id.'" >';
210 print '</td>';
211}
212
213print '</tr>';
214
215print "<!-- END PHP TEMPLATE objectline_view.tpl.php -->\n";
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
Class to manage warehouses.
Class to manage products or services.
Class to manage receptions.
Class to manage table commandefournisseurdispatch.
print $langs trans("Ref").' m titre as m m statut as status
Or an array listing all the potential status of the object: array: int of the status => translated la...
Definition index.php:169
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
img_down($titlealt='default', $selected=0, $moreclass='')
Show down arrow logo.
img_up($titlealt='default', $selected=0, $moreclass='')
Show top arrow logo.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Definition html.lib.php:181
measuringUnitString($unitid, $measuring_style='', $unitscale=null, $use_short_label=0, $outputlangs=null)
Return translation label of a unit key.