dolibarr  13.0.2
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  *
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  * $forceall (0 by default, 1 for supplier invoices/orders)
28  * $element (used to test $user->rights->$element->creer)
29  * $permtoedit (used to replace test $user->rights->$element->creer)
30  * $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax)
31  * $object_rights->creer initialized from = $object->getRights()
32  * $disableedit, $disablemove, $disableremove
33  *
34  * $type, $text, $description, $line
35  */
36 
37 // Protection to avoid direct call of template
38 if (empty($object) || !is_object($object))
39 {
40  print "Error, template page can't be called as URL";
41  exit;
42 }
43 
44 
45 global $forceall, $senderissupplier, $inputalsopricewithtax, $outputalsopricetotalwithtax;
46 
47 if (empty($dateSelector)) $dateSelector = 0;
48 if (empty($forceall)) $forceall = 0;
49 if (empty($senderissupplier)) $senderissupplier = 0;
50 if (empty($inputalsopricewithtax)) $inputalsopricewithtax = 0;
51 if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax = 0;
52 
53 // add html5 elements
54 $domData = ' data-element="'.$line->element.'"';
55 $domData .= ' data-id="'.$line->id.'"';
56 $domData .= ' data-qty="'.$line->qty.'"';
57 $domData .= ' data-product_type="'.$line->product_type.'"';
58 
59 // Lines for extrafield
60 $objectline = new BOMLine($object->db);
61 
62 $coldisplay = 0;
63 print "<!-- BEGIN PHP TEMPLATE objectline_view.tpl.php -->\n";
64 print '<tr id="row-'.$line->id.'" class="drag drop oddeven" '.$domData.' >';
65 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
66  print '<td class="linecolnum center">'.($i + 1).'</td>';
67  $coldisplay++;
68 }
69 print '<td class="linecoldescription minwidth300imp">';
70 print '<div id="line_'.$line->id.'"></div>';
71 $coldisplay++;
72 $tmpproduct = new Product($object->db);
73 $tmpproduct->fetch($line->fk_product);
74 print $tmpproduct->getNomUrl(1);
75 print ' - '.$tmpproduct->label;
76 print '</td>';
77 print '<td class="linecolqty nowrap right">';
78 $coldisplay++;
79 echo price($line->qty, 0, '', 0, 0); // Yes, it is a quantity, not a price, but we just want the formating role of function price
80 print '</td>';
81 
82 if (!empty($conf->global->PRODUCT_USE_UNITS))
83 {
84  print '<td class="linecoluseunit nowrap left">';
85  $label = $tmpproduct->getLabelOfUnit('long');
86  if ($label !== '') {
87  print $langs->trans($label);
88  }
89  print '</td>';
90 }
91 
92 print '<td class="linecolqtyfrozen nowrap right">';
93 $coldisplay++;
94 echo $line->qty_frozen ? yn($line->qty_frozen) : '';
95 print '</td>';
96 print '<td class="linecoldisablestockchange nowrap right">';
97 $coldisplay++;
98 echo $line->disable_stock_change ? yn($line->disable_stock_change) : ''; // Yes, it is a quantity, not a price, but we just want the formating role of function price
99 print '</td>';
100 
101 print '<td class="linecolefficiency nowrap right">';
102 $coldisplay++;
103 echo $line->efficiency;
104 print '</td>';
105 
106 print '<td class="linecolcost nowrap right">';
107 $coldisplay++;
108 echo price($line->total_cost);
109 print '</td>';
110 
111 if ($this->status == 0 && ($object_rights->write) && $action != 'selectlines') {
112  print '<td class="linecoledit center">';
113  $coldisplay++;
114  if (($line->info_bits & 2) == 2 || !empty($disableedit)) {
115  } else {
116  print '<a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=editline&amp;lineid='.$line->id.'">'.img_edit().'</a>';
117  }
118  print '</td>';
119 
120  print '<td class="linecoldelete center">';
121  $coldisplay++;
122  if (($line->fk_prev_id == null) && empty($disableremove)) {
123  //La suppression n'est autorisée que si il n'y a pas de ligne dans une précédente situation
124  print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=deleteline&amp;token='.newToken().'&amp;lineid='.$line->id.'">';
125  print img_delete();
126  print '</a>';
127  }
128  print '</td>';
129 
130  if ($num > 1 && $conf->browser->layout != 'phone' && empty($disablemove)) {
131  print '<td class="linecolmove tdlineupdown center">';
132  $coldisplay++;
133  if ($i > 0) {
134  print '<a class="lineupdown" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=up&amp;rowid='.$line->id.'">';
135  echo img_up('default', 0, 'imgupforline');
136  print '</a>';
137  }
138  if ($i < $num - 1) {
139  print '<a class="lineupdown" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=down&amp;rowid='.$line->id.'">';
140  echo img_down('default', 0, 'imgdownforline');
141  print '</a>';
142  }
143  print '</td>';
144  } else {
145  print '<td '.(($conf->browser->layout != 'phone' && empty($disablemove)) ? ' class="linecolmove tdlineupdown center"' : ' class="linecolmove center"').'></td>';
146  $coldisplay++;
147  }
148 } else {
149  print '<td colspan="3"></td>';
150  $coldisplay = $coldisplay + 3;
151 }
152 
153 if ($action == 'selectlines') {
154  print '<td class="linecolcheck center">';
155  print '<input type="checkbox" class="linecheckbox" name="line_checkbox['.($i + 1).']" value="'.$line->id.'" >';
156  print '</td>';
157 }
158 
159 print '</tr>';
160 
161 //Line extrafield
162 if (!empty($extrafields))
163 {
164  print $line->showOptionals($extrafields, 'view', array('style'=>'class="drag drop oddeven"', 'colspan'=>$coldisplay), '', '', 1);
165 }
166 
167 print "<!-- END PHP TEMPLATE objectline_view.tpl.php -->\n";
img_edit($titlealt= 'default', $float=0, $other= '')
Show logo editer/modifier fiche.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
Class to manage products or services.
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...
img_down($titlealt= 'default', $selected=0, $moreclass= '')
Show down arrow logo.
Class for BOMLine.
Definition: bom.class.php:1075
img_up($titlealt= 'default', $selected=0, $moreclass= '')
Show top arrow logo.
print
Draft customers invoices.
Definition: index.php:89
newToken()
Return the value of token currently saved into session with name &#39;newtoken&#39;.
img_delete($titlealt= 'default', $other= 'class="pictodelete"', $morecss= '')
Show delete logo.