28require_once DOL_DOCUMENT_ROOT.
"/product/class/html.formproduct.class.php";
42@phan-var-force CommonObject $this
43@phan-var-force CommonObject $object
44@phan-var-force Societe $buyer
49 print
"Error: this template page cannot be called directly as an URL";
53global $forceall, $forcetoshowtitlelines, $filtertype;
55if (empty($forceall)) {
59if (empty($filtertype)) {
73$objectline =
new BOMLine($this->db);
75print
"<!-- BEGIN PHP TEMPLATE bom/tpl/objectline_create.tpl.php -->\n";
77$nolinesbefore = (count($this->lines) == 0 || $forcetoshowtitlelines);
80 print
'<tr class="liste_titre nodrag nodrop">';
82 print
'<td class="linecolnum center"></td>';
84 print
'<td class="linecoldescription minwidth500imp">';
85 print
'<div id="add"></div><span class="hideonsmartphone">'.$langs->trans(
'AddNewLine').
'</span>';
87 print
'<td class="linecolqty right">'.$langs->trans(
'Qty').
'</td>';
89 if ($filtertype != 1) {
91 print
'<td class="linecoluseunit left">';
92 print
'<span id="title_units">';
93 print $langs->trans(
'Unit');
97 print
'<td class="linecolunit left">' . $form->textwithpicto($langs->trans(
'Unit'),
'').
'</td>';
101 print
'<td class="linecolqtyfrozen right">' . $form->textwithpicto($langs->trans(
'QtyFrozen'), $langs->trans(
"QuantityConsumedInvariable")) .
'</td>';
104 print
'<td class="linecoldisablestockchange right">' . $form->textwithpicto($langs->trans(
'DisableStockChange'), $langs->trans(
'DisableStockChangeHelp')) .
'</td>';
107 print
'<td class="linecollost right">' . $form->textwithpicto($langs->trans(
'ManufacturingEfficiency'), $langs->trans(
'ValueOfMeansLoss')) .
'</td>';
112 print
'<td class="linecolworkstation">' . $form->textwithpicto($langs->trans(
'Workstation'),
'') .
'</td>';
115 print
'<td class="linecoltotalcost right">' . $form->textwithpicto($langs->trans(
'TotalCost'),
'') .
'</td>';
117 print
'<td class="linecoledit" colspan="' . $colspan .
'"> </td>';
121print
'<tr class="pair nodrag nodrop nohoverpair'.(($nolinesbefore ||
$object->element ==
'contrat') ?
'' :
' liste_titre_create').
'">';
127 echo
'<td class="bordertop nobottom linecolnum center"></td>';
131print
'<td class="bordertop nobottom linecoldescription bomline minwidth500imp">';
135 if ($filtertype == 1) {
136 print $langs->trans(
"Service");
138 print $langs->trans(
"Product");
141 echo
'<span class="prod_entry_mode_predef nowraponall">';
146 print $form->select_produits(
GETPOSTINT(
'idprod'), (($filtertype == 1) ?
'idprodservice' :
'idprod'), $filtertype,
getDolGlobalInt(
'PRODUIT_LIMIT_SIZE'), 0, $statustoshow, 2,
'', 1, array(), 0,
'1', 0,
'maxwidth500 widthcentpercentminusx', 0,
'warehouseopen,warehouseinternal',
GETPOST(
'combinations',
'array:alphanohtml'), 1);
148 print $form->select_produits(
GETPOSTINT(
'idprod'), (($filtertype == 1) ?
'idprodservice' :
'idprod'), $filtertype,
getDolGlobalInt(
'PRODUIT_LIMIT_SIZE'), 0, $statustoshow, 2,
'', 1, array(), 0,
'1', 0,
'maxwidth500 widthcentpercentminusx', 0,
'',
GETPOST(
'combinations',
'array:alphanohtml'), 1);
150 $urltocreateproduct = DOL_URL_ROOT.
'/product/card.php?action=create'.(($filtertype == 1) ?
'&leftmenu=service&type=1' :
'&leftmenu=product&type=0').
'&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
151 print
'<a href="'.$urltocreateproduct.
'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans(
"AddProduct").
'"></span></a>';
156 print
'<br><span class="opacitymedium">'.$langs->trans(
"or").
'</span><br>'.$langs->trans(
"BOM");
157 print $form->select_bom(
'',
'bom_id', 0, 1, 0,
'1',
'',
'1');
160if (is_object($objectline)) {
161 $temps = $objectline->showOptionals($extrafields,
'create', array(),
'',
'',
'1',
'line');
163 if (!empty($temps)) {
164 print
'<div style="padding-top: 10px" id="extrafield_lines_area_create" name="extrafield_lines_area_create">';
174print
'<td class="bordertop nobottom linecolqty right"><input type="text" size="2" name="qty" id="qty" class="flat right" value="'.(GETPOSTISSET(
"qty") ?
GETPOST(
"qty",
'alpha', 2) : 1).
'">';
177if ($filtertype != 1) {
180 print
'<td class="nobottom linecoluseunit">';
185 require_once DOL_DOCUMENT_ROOT.
'/core/class/cunits.class.php';
186 $cUnit =
new CUnits($this->db);
187 $fk_unit_default = $cUnit->getUnitFromCode(
'h',
'short_label',
'time');
188 print
'<td class="bordertop nobottom nowrap linecolunit">';
189 print $formproduct->selectMeasuringUnits(
"fk_unit",
"time", $fk_unit_default, 1);
195 print
'<td class="bordertop nobottom linecolqtyfrozen right"><input type="checkbox" name="qty_frozen" id="qty_frozen" class="flat right" value="1"' . (
GETPOST(
"qty_frozen",
'alpha') ?
' checked="checked"' :
'') .
'>';
200 print
'<td class="bordertop nobottom linecoldisablestockchange right"><input type="checkbox" name="disable_stock_change" id="disable_stock_change" class="flat right" value="1"' . (
GETPOST(
"disable_stock_change",
'alpha') ?
' checked="checked"' :
'') .
'">';
205 print
'<td class="bordertop nobottom nowrap linecollost right">';
206 print
'<input type="text" size="2" name="efficiency" id="efficiency" class="flat right" value="' . ((GETPOSTISSET(
"efficiency") && $action ==
'addline') ?
GETPOST(
"efficiency",
'alpha') : 1) .
'">';
212 print
'<td class="bordertop nobottom nowrap linecolworkstation">';
213 print $formproduct->selectWorkstations(
'',
'idworkstations', 1);
219print
'<td class="bordertop nobottom nowrap linecolcost right">';
224$coldisplay += $colspan;
225print
'<td class="bordertop nobottom linecoledit right valignmiddle" colspan="' . $colspan .
'">';
226print
'<input type="submit" class="button button-add small" name="addline" id="addline" value="' . $langs->trans(
'Add') .
'">';
235jQuery(document).ready(
function() {
237 $(
"#idprod").change(
function()
239 console.log(
"#idprod change triggered");
242 if (jQuery(
'#idprod').val() > 0)
245 jQuery(
'#dp_desc').focus();
247 if (typeof CKEDITOR ==
"object" && typeof CKEDITOR.instances !=
"undefined")
249 var editor = CKEDITOR.instances[
'dp_desc'];
250 if (editor) { editor.focus(); }
256 <?php
if ($filtertype == 1) { ?>
257 $(
'#idprodservice').change(
function(){
258 var idproduct = $(
this).val();
261 url :
"<?php echo dol_buildpath('/bom/ajax/ajax.php', 1); ?>"
264 'action':
'getDurationUnitByProduct'
265 ,
'token' :
"<?php echo newToken() ?>"
266 ,
'idproduct' : idproduct
268 }).done(
function(data) {
271 $(
"#fk_unit").val(data).change();
275 url :
"<?php echo dol_buildpath('/bom/ajax/ajax.php', 1); ?>"
278 'action':
'getWorkstationByProduct'
279 ,
'token' :
"<?php echo newToken() ?>"
280 ,
'idproduct' : idproduct
282 }).done(
function(data) {
283 $(
'#idworkstations').val(data.defaultWk).select2();
291<!-- END PHP TEMPLATE objectline_create.tpl.php -->
if(! $sortfield) if(! $sortorder) $object
Class of dictionary type of thirdparty (used by imports)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
if(preg_match('/(crypted|dolcrypt):/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]',...