34require_once DOL_DOCUMENT_ROOT.
"/product/class/html.formproduct.class.php";
38 print
"Error: this template page cannot be called directly as an URL";
43@phan-var-force CommonObject $this
44@phan-var-force CommonObject $object
45@phan-var-force Societe $buyer
48global $forceall, $forcetoshowtitlelines, $filtertype;
50if (empty($forceall)) {
54if (empty($filtertype)) {
68$objectline =
new BOMLine($this->db);
70print
"<!-- BEGIN PHP TEMPLATE bom/tpl/objectline_create.tpl.php -->\n";
72$nolinesbefore = (count($this->lines) == 0 || $forcetoshowtitlelines);
75 print
'<tr class="liste_titre nodrag nodrop">';
77 print
'<td class="linecolnum center"></td>';
79 print
'<td class="linecoldescription minwidth500imp">';
80 print
'<div id="add"></div><span class="hideonsmartphone">'.$langs->trans(
'AddNewLine').
'</span>';
82 print
'<td class="linecolqty right">'.$langs->trans(
'Qty').
'</td>';
84 if ($filtertype != 1) {
86 print
'<td class="linecoluseunit left">';
87 print
'<span id="title_units">';
88 print $langs->trans(
'Unit');
92 print
'<td class="linecolunit left">' . $form->textwithpicto($langs->trans(
'Unit'),
'').
'</td>';
96 print
'<td class="linecolqtyfrozen right">' . $form->textwithpicto($langs->trans(
'QtyFrozen'), $langs->trans(
"QuantityConsumedInvariable")) .
'</td>';
99 print
'<td class="linecoldisablestockchange right">' . $form->textwithpicto($langs->trans(
'DisableStockChange'), $langs->trans(
'DisableStockChangeHelp')) .
'</td>';
102 print
'<td class="linecollost right">' . $form->textwithpicto($langs->trans(
'ManufacturingEfficiency'), $langs->trans(
'ValueOfMeansLoss')) .
'</td>';
106 if ($filtertype == 1 && isModEnabled(
'workstation')) {
107 print
'<td class="linecolworkstation right">' . $form->textwithpicto($langs->trans(
'Workstation'),
'') .
'</td>';
110 print
'<td class="linecoltotalcost right">' . $form->textwithpicto($langs->trans(
'TotalCost'),
'') .
'</td>';
112 print
'<td class="linecoledit" colspan="' . $colspan .
'"> </td>';
116print
'<tr class="pair nodrag nodrop nohoverpair'.(($nolinesbefore ||
$object->element ==
'contrat') ?
'' :
' liste_titre_create').
'">';
122 echo
'<td class="bordertop nobottom linecolnum center"></td>';
126print
'<td class="bordertop nobottom linecoldescription bomline minwidth500imp">';
129if (isModEnabled(
"product") || isModEnabled(
"service")) {
130 if ($filtertype == 1) {
131 print $langs->trans(
"Service");
133 print $langs->trans(
"Product");
136 echo
'<span class="prod_entry_mode_predef nowraponall">';
141 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',
GETPOSTINT(
'combinations'), 1);
143 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,
'',
GETPOSTINT(
'combinations'), 1);
145 $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);
146 print
'<a href="'.$urltocreateproduct.
'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans(
"AddProduct").
'"></span></a>';
151 print
'<br><span class="opacitymedium">'.$langs->trans(
"or").
'</span><br>'.$langs->trans(
"BOM");
152 print $form->select_bom(
'',
'bom_id', 0, 1, 0,
'1',
'', 1);
155if (is_object($objectline)) {
156 $temps = $objectline->showOptionals($extrafields,
'create', array(),
'',
'', 1,
'line');
158 if (!empty($temps)) {
159 print
'<div style="padding-top: 10px" id="extrafield_lines_area_create" name="extrafield_lines_area_create">';
169print
'<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).
'">';
172if ($filtertype != 1) {
175 print
'<td class="nobottom linecoluseunit">';
180 require_once DOL_DOCUMENT_ROOT.
'/core/class/cunits.class.php';
181 $cUnit =
new CUnits($this->db);
182 $fk_unit_default = $cUnit->getUnitFromCode(
'h',
'short_label',
'time');
183 print
'<td class="bordertop nobottom nowrap linecolunit">';
184 print $formproduct->selectMeasuringUnits(
"fk_unit",
"time", $fk_unit_default, 1);
190 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"' :
'') .
'>';
195 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"' :
'') .
'">';
200 print
'<td class="bordertop nobottom nowrap linecollost right">';
201 print
'<input type="text" size="2" name="efficiency" id="efficiency" class="flat right" value="' . ((GETPOSTISSET(
"efficiency") && $action ==
'addline') ?
GETPOST(
"efficiency",
'alpha') : 1) .
'">';
205if ($filtertype == 1 && isModEnabled(
'workstation')) {
207 print
'<td class="bordertop nobottom nowrap linecolworkstation">';
208 print $formproduct->selectWorkstations(
'',
'idworkstations', 1);
214print
'<td class="bordertop nobottom nowrap linecolcost right">';
219$coldisplay += $colspan;
220print
'<td class="bordertop nobottom linecoledit right valignmiddle" colspan="' . $colspan .
'">';
221print
'<input type="submit" class="button button-add small" name="addline" id="addline" value="' . $langs->trans(
'Add') .
'">';
230jQuery(document).ready(
function() {
232 $(
"#idprod").change(
function()
234 console.log(
"#idprod change triggered");
237 if (jQuery(
'#idprod').val() > 0)
240 jQuery(
'#dp_desc').focus();
242 if (typeof CKEDITOR ==
"object" && typeof CKEDITOR.instances !=
"undefined")
244 var editor = CKEDITOR.instances[
'dp_desc'];
245 if (editor) { editor.focus(); }
251 <?php
if ($filtertype == 1) { ?>
252 $(
'#idprodservice').change(
function(){
253 var idproduct = $(
this).val();
256 url :
"<?php echo dol_buildpath('/bom/ajax/ajax.php', 1); ?>"
259 'action':
'getDurationUnitByProduct'
260 ,
'token' :
"<?php echo newToken() ?>"
261 ,
'idproduct' : idproduct
263 }).done(
function(data) {
266 $(
"#fk_unit").val(data).change();
270 url :
"<?php echo dol_buildpath('/bom/ajax/ajax.php', 1); ?>"
273 'action':
'getWorkstationByProduct'
274 ,
'token' :
"<?php echo newToken() ?>"
275 ,
'idproduct' : idproduct
277 }).done(
function(data) {
278 $(
'#idworkstations').val(data.defaultWk).select2();
286<!-- END PHP TEMPLATE objectline_create.tpl.php -->
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $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.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type