32require_once DOL_DOCUMENT_ROOT.
"/product/class/html.formproduct.class.php";
36 print
"Error: this template page cannot be called directly as an URL";
40'@phan-var-force CommonObject $this
41 @phan-var-force CommonObject $object';
43global $forceall, $forcetoshowtitlelines, $filtertype;
45if (empty($forceall)) {
49if (empty($filtertype)) {
63$objectline =
new BOMLine($this->db);
65print
"<!-- BEGIN PHP TEMPLATE objectline_create.tpl.php -->\n";
67$nolinesbefore = (count($this->lines) == 0 || $forcetoshowtitlelines);
70 print
'<tr class="liste_titre nodrag nodrop">';
72 print
'<td class="linecolnum center"></td>';
74 print
'<td class="linecoldescription minwidth500imp">';
75 print
'<div id="add"></div><span class="hideonsmartphone">'.$langs->trans(
'AddNewLine').
'</span>';
77 print
'<td class="linecolqty right">'.$langs->trans(
'Qty').
'</td>';
79 if ($filtertype != 1) {
81 print
'<td class="linecoluseunit left">';
82 print
'<span id="title_units">';
83 print $langs->trans(
'Unit');
86 print
'<td class="linecolqtyfrozen right">' . $form->textwithpicto($langs->trans(
'QtyFrozen'), $langs->trans(
"QuantityConsumedInvariable")) .
'</td>';
87 print
'<td class="linecoldisablestockchange right">' . $form->textwithpicto($langs->trans(
'DisableStockChange'), $langs->trans(
'DisableStockChangeHelp')) .
'</td>';
88 print
'<td class="linecollost right">' . $form->textwithpicto($langs->trans(
'ManufacturingEfficiency'), $langs->trans(
'ValueOfMeansLoss')) .
'</td>';
90 print
'<td class="linecolunit right">' . $form->textwithpicto($langs->trans(
'Unit'),
'').
'</td>';
91 if (isModEnabled(
'workstation')) {
92 print
'<td class="linecolworkstation right">' . $form->textwithpicto($langs->trans(
'Workstation'),
'') .
'</td>';
94 print
'<td class="linecoltotalcost right">' . $form->textwithpicto($langs->trans(
'TotalCost'),
'') .
'</td>';
97 print
'<td class="linecoledit" colspan="' . $colspan .
'"> </td>';
100print
'<tr class="pair nodrag nodrop nohoverpair'.(($nolinesbefore ||
$object->element ==
'contrat') ?
'' :
' liste_titre_create').
'">';
106 echo
'<td class="bordertop nobottom linecolnum center"></td>';
110print
'<td class="bordertop nobottom linecoldescription bomline minwidth500imp">';
113if (isModEnabled(
"product") || isModEnabled(
"service")) {
114 if ($filtertype == 1) {
115 print $langs->trans(
"Service");
117 print $langs->trans(
"Product");
119 echo
'<span class="prod_entry_mode_predef">';
123 print $form->select_produits(
GETPOSTINT(
'idprod'), (($filtertype == 1) ?
'idprodservice' :
'idprod'), $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2,
'', 1, array(), $buyer->id,
'1', 0,
'maxwidth500', 0,
'warehouseopen,warehouseinternal',
GETPOSTINT(
'combinations'), 1);
125 print $form->select_produits(
GETPOSTINT(
'idprod'), (($filtertype == 1) ?
'idprodservice' :
'idprod'), $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2,
'', 1, array(), $buyer->id,
'1', 0,
'maxwidth500', 0,
'',
GETPOSTINT(
'combinations'), 1);
127 $urltocreateproduct = DOL_URL_ROOT.
'/product/card.php?action=create&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
128 print
'<a href="'.$urltocreateproduct.
'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans(
"AddProduct").
'"></span></a>';
133 print
'<br><span class="opacitymedium">'.$langs->trans(
"or").
'</span><br>'.$langs->trans(
"BOM");
134 print $form->select_bom(
'',
'bom_id', 0, 1, 0,
'1',
'', 1);
137if (is_object($objectline)) {
138 $temps = $objectline->showOptionals($extrafields,
'create', array(),
'',
'', 1,
'line');
140 if (!empty($temps)) {
141 print
'<div style="padding-top: 10px" id="extrafield_lines_area_create" name="extrafield_lines_area_create">';
151print
'<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).
'">';
154if ($filtertype != 1) {
157 print
'<td class="nobottom linecoluseunit">';
162 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"' :
'') .
'>';
167 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"' :
'') .
'">';
171 print
'<td class="bordertop nobottom nowrap linecollost right">';
172 print
'<input type="text" size="2" name="efficiency" id="efficiency" class="flat right" value="' . ((GETPOSTISSET(
"efficiency") && $action ==
'addline') ?
GETPOST(
"efficiency",
'alpha') : 1) .
'">';
176 print
'<td class="bordertop nobottom nowrap linecolcost right">';
181 require_once DOL_DOCUMENT_ROOT.
'/core/class/cunits.class.php';
182 $cUnit =
new CUnits($this->db);
183 $fk_unit_default = $cUnit->getUnitFromCode(
'h',
'short_label',
'time');
184 print
'<td class="bordertop nobottom nowrap linecolunit">';
185 print $formproduct->selectMeasuringUnits(
"fk_unit",
"time", $fk_unit_default, 1);
188 if (isModEnabled(
'workstation')) {
190 print
'<td class="bordertop nobottom nowrap linecolworkstation">';
191 print $formproduct->selectWorkstations(
'',
'idworkstations', 1);
196 print
'<td class="bordertop nobottom nowrap linecolcost right">';
201$coldisplay += $colspan;
202print
'<td class="bordertop nobottom linecoledit right valignmiddle" colspan="' . $colspan .
'">';
203print
'<input type="submit" class="button button-add small" name="addline" id="addline" value="' . $langs->trans(
'Add') .
'">';
212jQuery(document).ready(
function() {
214 $(
"#idprod").change(
function()
216 console.log(
"#idprod change triggered");
219 if (jQuery(
'#idprod').val() > 0)
222 jQuery(
'#dp_desc').focus();
224 if (typeof CKEDITOR ==
"object" && typeof CKEDITOR.instances !=
"undefined")
226 var editor = CKEDITOR.instances[
'dp_desc'];
227 if (editor) { editor.focus(); }
233 <?php
if ($filtertype == 1) { ?>
234 $(
'#idprodservice').change(
function(){
235 var idproduct = $(
this).val();
238 url :
"<?php echo dol_buildpath('/bom/ajax/ajax.php', 1); ?>"
241 'action':
'getDurationUnitByProduct'
242 ,
'token' :
"<?php echo newToken() ?>"
243 ,
'idproduct' : idproduct
245 }).done(
function(data) {
248 $(
"#fk_unit").val(data).change();
252 url :
"<?php echo dol_buildpath('/bom/ajax/ajax.php', 1); ?>"
255 'action':
'getWorkstationByProduct'
256 ,
'token' :
"<?php echo newToken() ?>"
257 ,
'idproduct' : idproduct
259 }).done(
function(data) {
260 $(
'#idworkstations').val(data.defaultWk).select2();
268<!-- 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 dolibarr global constant string value.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type