dolibarr  16.0.5
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 Frédéric France <frederic.france@netlogic.fr>
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  * $seller, $buyer
28  * $dateSelector
29  * $forceall (0 by default, 1 for supplier invoices/orders)
30  * $senderissupplier (0 by default, 1 for supplier invoices/orders)
31  * $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax)
32  */
33 
34 // Protection to avoid direct call of template
35 if (empty($object) || !is_object($object)) {
36  print "Error, template page can't be called as URL";
37  exit;
38 }
39 
40 
41 global $forceall;
42 
43 if (empty($forceall)) {
44  $forceall = 0;
45 }
46 
47 
48 // Define colspan for the button 'Add'
49 $colspan = 3; // Columns: total ht + col edit + col delete
50 
51 // Lines for extrafield
52 $objectline = new BOMLine($this->db);
53 
54 print "<!-- BEGIN PHP TEMPLATE objectline_edit.tpl.php -->\n";
55 
56 $coldisplay = 0;
57 print '<tr class="oddeven tredited">';
58 // Adds a line numbering column
59 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
60  print '<td class="linecolnum center">'.($i + 1).'</td>';
61  $coldisplay++;
62 }
63 
64 $coldisplay++;
65 ?>
66  <td>
67  <div id="line_<?php echo $line->id; ?>"></div>
68 
69  <input type="hidden" name="lineid" value="<?php echo $line->id; ?>">
70  <input type="hidden" id="product_type" name="type" value="<?php echo $line->product_type; ?>">
71  <input type="hidden" id="product_id" name="productid" value="<?php echo (!empty($line->fk_product) ? $line->fk_product : 0); ?>" />
72  <input type="hidden" id="special_code" name="special_code" value="<?php echo $line->special_code; ?>">
73  <input type="hidden" id="fk_parent_line" name="fk_parent_line" value="<?php echo $line->fk_parent_line; ?>">
74 
75 <?php
76 // Predefined product/service
77 if ($line->fk_product > 0) {
78  $tmpproduct = new Product($object->db);
79  $tmpproduct->fetch($line->fk_product);
80  print $tmpproduct->getNomUrl(1);
81 }
82 
83 if (is_object($hookmanager)) {
84  $fk_parent_line = (GETPOST('fk_parent_line') ? GETPOST('fk_parent_line') : $line->fk_parent_line);
85  $parameters = array('line'=>$line, 'fk_parent_line'=>$fk_parent_line, 'var'=>$var, 'dateSelector'=>$dateSelector, 'seller'=>$seller, 'buyer'=>$buyer);
86  $reshook = $hookmanager->executeHooks('formEditProductOptions', $parameters, $this, $action);
87 }
88 
89 print '</td>';
90 
91 /*if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines
92 {
93  $coldisplay++;
94 ?>
95  <td class="right"><input id="fourn_ref" name="fourn_ref" class="flat minwidth75" value="<?php echo ($line->ref_supplier ? $line->ref_supplier : $line->ref_fourn); ?>"></td>
96 <?php
97 */
98 
99 $coldisplay++;
100 
101 print '<td class="nobottom linecolqty right">';
102 if (($line->info_bits & 2) != 2) {
103  // I comment this because it shows info even when not required
104  // for example always visible on invoice but must be visible only if stock module on and stock decrease option is on invoice validation and status is not validated
105  // must also not be output for most entities (proposal, intervention, ...)
106  //if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." ";
107  print '<input size="3" type="text" class="flat right" name="qty" id="qty" value="'.$line->qty.'">';
108 }
109 print '</td>';
110 
111 if (!empty($conf->global->PRODUCT_USE_UNITS)) {
112  $coldisplay++;
113  print '<td class="nobottom linecoluseunit left">';
114  print '</td>';
115 }
116 
117 $coldisplay++;
118 print '<td class="nobottom linecolqtyfrozen right"><input type="checkbox" name="qty_frozen" id="qty_frozen" class="flat right" value="1"'.(GETPOSTISSET("qty_frozen") ? (GETPOST('qty_frozen', 'int') ? ' checked="checked"' : '') : ($line->qty_frozen ? ' checked="checked"' : '')).'>';
119 print '</td>';
120 
121 $coldisplay++;
122 print '<td class="nobottom linecoldisablestockchange right"><input type="checkbox" name="disable_stock_change" id="disable_stock_change" class="flat right" value="1"'.(GETPOSTISSET('disablestockchange') ? (GETPOST("disable_stock_change", 'int') ? ' checked="checked"' : '') : ($line->disable_stock_change ? ' checked="checked"' : '')).'">';
123 print '</td>';
124 
125 $coldisplay++;
126 print '<td class="nobottom nowrap linecollost right">';
127 print '<input type="text" size="2" name="efficiency" id="efficiency" class="flat right" value="'.$line->efficiency.'"></td>';
128 
129 $coldisplay++;
130 print '<td class="nobottom nowrap linecolcostprice right">';
131 print '</td>';
132 
133 $coldisplay += $colspan;
134 print '<td class="nobottom linecoledit center valignmiddle" colspan="'.$colspan.'">';
135 $coldisplay += $colspan;
136 print '<input type="submit" class="button buttongen margintoponly marginbottomonly button-save" id="savelinebutton" name="save" value="'.$langs->trans("Save").'">';
137 print '<input type="submit" class="button buttongen margintoponly marginbottomonly button-cancel" id="cancellinebutton" name="cancel" value="'.$langs->trans("Cancel").'">';
138 print '</td>';
139 print '</tr>';
140 
141 if (is_object($objectline)) {
142  print $objectline->showOptionals($extrafields, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay), '', '', 1, 'line');
143 }
144 
145 print "<!-- END PHP TEMPLATE objectline_edit.tpl.php -->\n";
db
$conf db
API class for accounts.
Definition: inc.php:41
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:484
BOMLine
Class for BOMLine.
Definition: bom.class.php:1202
name
$conf db name
Definition: repair.php:122
Product
Class to manage products or services.
Definition: product.class.php:46
type
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
Definition: repair.php:119