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 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 3 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program. If not, see <https://www.gnu.org/licenses/>.
25 *
26 * Need to have the following variables defined:
27 * $object (invoice, order, ...)
28 * $conf
29 * $langs
30 * $forceall (0 by default, 1 for supplier invoices/orders)
31 * $element (used to test $user->hasRight($element, 'creer'))
32 * $permtoedit (used to replace test $user->hasRight($element, 'creer'))
33 * $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax)
34 * $disableedit, $disablemove, $disableremove
35 *
36 * $type, $text, $description, $line
37 */
38
52'
53@phan-var-force expeditionligne $line
54@phan-var-force int $num
55@phan-var-force int $i
56@phan-var-force CommonObject $this
57@phan-var-force CommonObject $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 ExpeditionLigne($object->db);
90
91$coldisplay = 0;
92print "<!-- BEGIN PHP TEMPLATE expedition/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);
106$tmpproduct->fetch($line->fk_product);
107$tmpexpe = new Expedition($object->db);
108if ($line->fk_product > 0) {
109 print $tmpproduct->getNomUrl(1);
110 print ' - '.$tmpproduct->label;
111} else {
112 print ' - '.$line->description;
113}
114
115// Line extrafield
116if (!empty($extrafields)) {
117 $temps = $line->showOptionals($extrafields, 'view', array(), '', '', '1', 'line');
118 if (!empty($temps)) {
119 print '<div style="padding-top: 10px" id="extrafield_lines_area_'.$line->id.'" name="extrafield_lines_area_'.$line->id.'">';
120 print $temps;
121 print '</div>';
122 }
123}
124print '</td>';
125
126// Qty
127print '<td class="linecolqty nowrap right">';
128$coldisplay++;
129echo price($line->qty, 0, '', 0, 0); // Yes, it is a quantity, not a price, but we just want the formatting role of function price
130print '</td>';
131
132// Unit
133if (getDolGlobalInt('PRODUCT_USE_UNITS')) { // For product, unit is shown only if option PRODUCT_USE_UNITS is on
134 print '<td class="linecoluseunit nowrap">';
135 $coldisplay++;
136 $label = measuringUnitString((int) $line->fk_unit, '', null, 1);
137 if ($label !== '') {
138 print $langs->trans($label);
139 }
140 print '</td>';
141}
142
143if ($this->status == 0 && $user->hasRight('expedition', 'write') && $action != 'selectlines') {
144 print '<td class="linecoledit center">';
145 $coldisplay++;
146 if (((int) $line->info_bits & 2) == 2 || !empty($disableedit)) {
147 } else {
148 print '<a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=editline&token='.newToken().'&lineid='.$line->id.'">'.img_edit().'</a>';
149 }
150 print '</td>';
151
152 print '<td class="linecoldelete center">';
153 $coldisplay++;
154
155 print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=deleteline&token='.newToken().'&lineid='.$line->id.'">';
156 print img_delete();
157 print '</a>';
158
159 print '</td>';
160
161 if ($num > 1 && $conf->browser->layout != 'phone' && empty($disablemove)) {
162 print '<td class="linecolmove tdlineupdown center">';
163 $coldisplay++;
164 if ($i > 0) {
165 print '<a class="lineupdown" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=up&token='.newToken().'&rowid='.$line->id.'">';
166 echo img_up('default', 0, 'imgupforline');
167 print '</a>';
168 }
169 if ($i < $num - 1) {
170 print '<a class="lineupdown" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=down&token='.newToken().'&rowid='.$line->id.'">';
171 echo img_down('default', 0, 'imgdownforline');
172 print '</a>';
173 }
174 print '</td>';
175 } else {
176 print '<td '.(($conf->browser->layout != 'phone' && empty($disablemove)) ? ' class="linecolmove tdlineupdown center"' : ' class="linecolmove center"').'></td>';
177 $coldisplay++;
178 }
179} else {
180 print '<td colspan="3"></td>';
181 $coldisplay += 3;
182}
183
184if ($action == 'selectlines') {
185 print '<td class="linecolcheck center">';
186 print '<input type="checkbox" class="linecheckbox" name="line_checkbox['.($i + 1).']" value="'.$line->id.'" >';
187 print '</td>';
188}
189
190print '</tr>';
191
192print "<!-- END PHP TEMPLATE objectline_view.tpl.php -->\n";
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
Class to manage lines of shipment.
Class to manage products or services.
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.
img_down($titlealt='default', $selected=0, $moreclass='')
Show down arrow logo.
img_up($titlealt='default', $selected=0, $moreclass='')
Show top arrow logo.
measuringUnitString($unitid, $measuring_style='', $unitscale=null, $use_short_label=0, $outputlangs=null)
Return translation label of a unit key.