dolibarr 23.0.3
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
51'
52@phan-var-force receptionlinebatch $line
53@phan-var-force int $num
54@phan-var-force int $i
55@phan-var-force CommonObject $this
56@phan-var-force CommonObject $object
57';
58
59// Protection to avoid direct call of template
60if (empty($object) || !is_object($object)) {
61 print "Error, template page can't be called as URL";
62 exit(1);
63}
64
65global $filtertype;
66if (empty($filtertype)) {
67 $filtertype = 0;
68}
69
70
71global $forceall, $senderissupplier, $inputalsopricewithtax, $outputalsopricetotalwithtax, $langs;
72
73if (empty($dateSelector)) {
74 $dateSelector = 0;
75}
76if (empty($forceall)) {
77 $forceall = 0;
78}
79
80
81// add html5 elements
82$domData = ' data-element="'.$line->element.'"';
83$domData .= ' data-id="'.$line->id.'"';
84$domData .= ' data-qty="'.$line->qty.'"';
85$domData .= ' data-product_type="'.$line->product_type.'"';
86
87// Lines for extrafield
88$objectline = new ReceptionLineBatch($this->db);
89
90$coldisplay = 0;
91print "<!-- BEGIN PHP TEMPLATE reception/tpl/objectline_view.tpl.php -->\n";
92print '<tr id="row-'.$line->id.'" class="drag drop oddeven" '.$domData.' >';
93
94// Line nb
95if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER')) {
96 print '<td class="linecolnum center">'.($i + 1).'</td>';
97 $coldisplay++;
98}
99
100// Product
101print '<td class="linecoldescription line minwidth300imp tdoverflowmax300">';
102print '<div id="line_'.$line->id.'"></div>';
103$coldisplay++;
104$tmpproduct = new Product($object->db);
105$tmpproduct->fetch($line->fk_product);
106$tmprecep = new Reception($object->db);
107if ($line->fk_product > 0) {
108 print $tmpproduct->getNomUrl(1);
109 print ' - '.$tmpproduct->label;
110} else {
111 print ' - '.$line->description;
112}
113print '</td>';
114
115// Qty
116print '<td class="linecolqty nowrap right">';
117$coldisplay++;
118echo price($line->qty, 0, '', 0, 0); // Yes, it is a quantity, not a price, but we just want the formatting role of function price
119print '</td>';
120
121// Unit
122if (getDolGlobalInt('PRODUCT_USE_UNITS')) { // For product, unit is shown only if option PRODUCT_USE_UNITS is on
123 print '<td class="linecoluseunit nowrap">';
124 $coldisplay++;
125 $label = measuringUnitString((int) $line->fk_unit, '', null, 1);
126 if ($label !== '') {
127 print $langs->trans($label);
128 }
129 print '</td>';
130}
131
132if ($this->status == 0 && $user->hasRight('reception', 'write') && $action != 'selectlines') {
133 print '<td class="linecoledit center">';
134 $coldisplay++;
135 if (((int) $line->info_bits & 2) == 2 || !empty($disableedit)) {
136 } else {
137 print '<a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=editline&token='.newToken().'&lineid='.$line->id.'">'.img_edit().'</a>';
138 }
139 print '</td>';
140
141 print '<td class="linecoldelete center">';
142 $coldisplay++;
143
144 print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=deleteline&token='.newToken().'&lineid='.$line->id.'">';
145 print img_delete();
146 print '</a>';
147
148 print '</td>';
149
150 if ($num > 1 && $conf->browser->layout != 'phone' && empty($disablemove)) {
151 print '<td class="linecolmove tdlineupdown center">';
152 $coldisplay++;
153 if ($i > 0) {
154 print '<a class="lineupdown" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=up&token='.newToken().'&rowid='.$line->id.'">';
155 echo img_up('default', 0, 'imgupforline');
156 print '</a>';
157 }
158 if ($i < $num - 1) {
159 print '<a class="lineupdown" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=down&token='.newToken().'&rowid='.$line->id.'">';
160 echo img_down('default', 0, 'imgdownforline');
161 print '</a>';
162 }
163 print '</td>';
164 } else {
165 print '<td '.(($conf->browser->layout != 'phone' && empty($disablemove)) ? ' class="linecolmove tdlineupdown center"' : ' class="linecolmove center"').'></td>';
166 $coldisplay++;
167 }
168} else {
169 print '<td colspan="3"></td>';
170 $coldisplay += 3;
171}
172
173if ($action == 'selectlines') {
174 print '<td class="linecolcheck center">';
175 print '<input type="checkbox" class="linecheckbox" name="line_checkbox['.($i + 1).']" value="'.$line->id.'" >';
176 print '</td>';
177}
178
179print '</tr>';
180
181print "<!-- END PHP TEMPLATE objectline_view.tpl.php -->\n";
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
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:171
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
img_down($titlealt='default', $selected=0, $moreclass='')
Show down arrow logo.
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_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
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.