dolibarr  13.0.2
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 {
37  print "Error, template page can't be called as URL";
38  exit;
39 }
40 
41 
42 global $forceall;
43 
44 if (empty($forceall)) $forceall = 0;
45 
46 
47 // Define colspan for the button 'Add'
48 $colspan = 3; // Columns: total ht + col edit + col delete
49 
50 // Lines for extrafield
51 $objectline = new BOMLine($this->db);
52 
53 print "<!-- BEGIN PHP TEMPLATE objectline_edit.tpl.php -->\n";
54 
55 $coldisplay = 0;
56 print '<tr class="oddeven tredited">';
57 // Adds a line numbering column
58 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
59  print '<td class="linecolnum center">'.($i + 1).'</td>';
60  $coldisplay++;
61 }
62 
63 $coldisplay++;
64 ?>
65  <td>
66  <div id="line_<?php echo $line->id; ?>"></div>
67 
68  <input type="hidden" name="lineid" value="<?php echo $line->id; ?>">
69  <input type="hidden" id="product_type" name="type" value="<?php echo $line->product_type; ?>">
70  <input type="hidden" id="product_id" name="productid" value="<?php echo (!empty($line->fk_product) ? $line->fk_product : 0); ?>" />
71  <input type="hidden" id="special_code" name="special_code" value="<?php echo $line->special_code; ?>">
72  <input type="hidden" id="fk_parent_line" name="fk_parent_line" value="<?php echo $line->fk_parent_line; ?>">
73 
74 <?php
75 // Predefined product/service
76 if ($line->fk_product > 0) {
77  $tmpproduct = new Product($object->db);
78  $tmpproduct->fetch($line->fk_product);
79  print $tmpproduct->getNomUrl(1);
80 }
81 
82 if (is_object($hookmanager))
83 {
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 {
113  $coldisplay++;
114  print '<td class="nobottom linecoluseunit left">';
115  print '</td>';
116 }
117 
118 $coldisplay++;
119 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"' : '')).'>';
120 print '</td>';
121 
122 $coldisplay++;
123 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"' : '')).'">';
124 print '</td>';
125 
126 $coldisplay++;
127 print '<td class="nobottom nowrap linecollost right">';
128 print '<input type="text" size="1" name="efficiency" id="efficiency" class="flat right" value="'.$line->efficiency.'"></td>';
129 
130 $coldisplay++;
131 print '<td class="nobottom nowrap linecolcostprice right">';
132 print '</td>';
133 
134 $coldisplay += $colspan;
135 print '<td class="nobottom linecoledit center valignmiddle" colspan="'.$colspan.'">';
136 $coldisplay += $colspan;
137 print '<input type="submit" class="button buttongen marginbottomonly button-save" id="savelinebutton marginbottomonly" name="save" value="'.$langs->trans("Save").'">';
138 print '<br>';
139 print '<input type="submit" class="button buttongen marginbottomonly button-cancel" id="cancellinebutton" name="cancel" value="'.$langs->trans("Cancel").'">';
140 print '</td>';
141 print '</tr>';
142 
143 if (is_object($objectline)) {
144  print $objectline->showOptionals($extrafields, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay), '', '', 1);
145 }
146 
147 print "<!-- END PHP TEMPLATE objectline_edit.tpl.php -->\n";
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Class to manage products or services.
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition: repair.php:108
$conf db
API class for accounts.
Definition: inc.php:54
Class for BOMLine.
Definition: bom.class.php:1075
print
Draft customers invoices.
Definition: index.php:89
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
Definition: repair.php:105