objectline_edit.tpl.php 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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. require_once DOL_DOCUMENT_ROOT."/product/class/html.formproduct.class.php";
  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. global $forceall, $filtertype;
  40. if (empty($forceall)) {
  41. $forceall = 0;
  42. }
  43. if (empty($filtertype)) {
  44. $filtertype = 0;
  45. }
  46. $formproduct = new FormProduct($object->db);
  47. // Define colspan for the button 'Add'
  48. $colspan = 3; // Columns: total ht + col edit + col delete
  49. // Lines for extrafield
  50. $objectline = new BOMLine($this->db);
  51. print "<!-- BEGIN PHP TEMPLATE objectline_edit.tpl.php -->\n";
  52. $coldisplay = 0;
  53. print '<tr class="oddeven tredited">';
  54. // Adds a line numbering column
  55. if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER')) {
  56. print '<td class="linecolnum center">'.($i + 1).'</td>';
  57. $coldisplay++;
  58. }
  59. $coldisplay++;
  60. ?>
  61. <td>
  62. <div id="line_<?php echo $line->id; ?>"></div>
  63. <input type="hidden" name="lineid" value="<?php echo $line->id; ?>">
  64. <input type="hidden" id="product_type" name="type" value="<?php echo $line->product_type; ?>">
  65. <input type="hidden" id="product_id" name="productid" value="<?php echo(!empty($line->fk_product) ? $line->fk_product : 0); ?>" />
  66. <input type="hidden" id="special_code" name="special_code" value="<?php echo $line->special_code; ?>">
  67. <input type="hidden" id="fk_parent_line" name="fk_parent_line" value="<?php echo $line->fk_parent_line; ?>">
  68. <?php
  69. // Predefined product/service
  70. if ($line->fk_product > 0) {
  71. $tmpproduct = new Product($object->db);
  72. $tmpproduct->fetch($line->fk_product);
  73. print $tmpproduct->getNomUrl(1);
  74. }
  75. if (is_object($hookmanager)) {
  76. $fk_parent_line = (GETPOST('fk_parent_line') ? GETPOST('fk_parent_line') : $line->fk_parent_line);
  77. $parameters = array('line'=>$line, 'fk_parent_line'=>$fk_parent_line, 'var'=>$var, 'dateSelector'=>$dateSelector, 'seller'=>$seller, 'buyer'=>$buyer);
  78. $reshook = $hookmanager->executeHooks('formEditProductOptions', $parameters, $this, $action);
  79. }
  80. //Line extrafield
  81. if (is_object($objectline) && !empty($extrafields)) {
  82. $temps = $line->showOptionals($extrafields, 'edit', array('class'=>'tredited'), '', '', 1, 'line');
  83. if (!empty($temps)) {
  84. print '<div style="padding-top: 10px" id="extrafield_lines_area_edit" name="extrafield_lines_area_edit">';
  85. print $temps;
  86. print '</div>';
  87. }
  88. }
  89. print '</td>';
  90. /*if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines
  91. {
  92. $coldisplay++;
  93. ?>
  94. <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>
  95. <?php
  96. */
  97. $coldisplay++;
  98. print '<td class="nobottom linecolqty right">';
  99. if (($line->info_bits & 2) != 2) {
  100. // I comment this because it shows info even when not required
  101. // 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
  102. // must also not be output for most entities (proposal, intervention, ...)
  103. //if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." ";
  104. print '<input size="3" type="text" class="flat right" name="qty" id="qty" value="'.$line->qty.'">';
  105. }
  106. print '</td>';
  107. if ($filtertype != 1) {
  108. if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
  109. $coldisplay++;
  110. print '<td class="nobottom nowrap linecolunit right">';
  111. print $formproduct->selectMeasuringUnits("fk_unit", '', (($line->fk_unit) ? $line->fk_unit : ''), 0, 0);
  112. print '</td>';
  113. }
  114. $coldisplay++;
  115. 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"' : '')) . '>';
  116. print '</td>';
  117. $coldisplay++;
  118. 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"' : '')) . '">';
  119. print '</td>';
  120. $coldisplay++;
  121. print '<td class="nobottom nowrap linecollost right">';
  122. print '<input type="text" size="2" name="efficiency" id="efficiency" class="flat right" value="' . $line->efficiency . '"></td>';
  123. $coldisplay++;
  124. print '<td class="nobottom nowrap linecolcostprice right">';
  125. print '</td>';
  126. } else {
  127. $coldisplay++;
  128. print '<td class="nobottom nowrap linecolunit right">';
  129. print $formproduct->selectMeasuringUnits("fk_unit", "time", ($line->fk_unit) ? $line->fk_unit : '', 0, 0);
  130. print '</td>';
  131. $coldisplay++;
  132. print '<td class="nobottom nowrap linecolworkstation right">';
  133. print $formproduct->selectWorkstations($line->fk_default_workstation, 'idworkstations', 1);
  134. print '</td>';
  135. $coldisplay++;
  136. print '<td class="nobottom nowrap linecolcostprice right">';
  137. print '</td>';
  138. }
  139. $coldisplay += $colspan;
  140. print '<td class="nobottom linecoledit center valignmiddle" colspan="'.$colspan.'">';
  141. $coldisplay += $colspan;
  142. print '<input type="submit" class="reposition button buttongen margintoponly marginbottomonly button-save" id="savelinebutton" name="save" value="'.$langs->trans("Save").'">';
  143. print '<input type="submit" class="reposition button buttongen margintoponly marginbottomonly button-cancel" id="cancellinebutton" name="cancel" value="'.$langs->trans("Cancel").'">';
  144. print '</td>';
  145. print '</tr>';
  146. print "<!-- END PHP TEMPLATE objectline_edit.tpl.php -->\n";