34require_once DOL_DOCUMENT_ROOT.
"/product/class/html.formproduct.class.php";
46 print
"Error: this template page cannot be called directly as an URL";
51@phan-var-force CommonObject $this
52@phan-var-force CommonObject $object
53@phan-var-force Societe $buyer
56global $forceall, $forcetoshowtitlelines, $filtertype;
58if (empty($forceall)) {
62if (empty($filtertype)) {
76$objectline =
new BOMLine($this->db);
78print
"<!-- BEGIN PHP TEMPLATE bom/tpl/objectline_create.tpl.php -->\n";
80$nolinesbefore = (count($this->lines) == 0 || $forcetoshowtitlelines);
83 print
'<tr class="liste_titre nodrag nodrop">';
85 print
'<td class="linecolnum center"></td>';
87 print
'<td class="linecoldescription minwidth500imp">';
88 print
'<div id="add"></div><span class="hideonsmartphone">'.$langs->trans(
'AddNewLine').
'</span>';
90 print
'<td class="linecolqty right">'.$langs->trans(
'Qty').
'</td>';
92 if ($filtertype != 1) {
94 print
'<td class="linecoluseunit left">';
95 print
'<span id="title_units">';
96 print $langs->trans(
'Unit');
100 print
'<td class="linecolunit left">' . $form->textwithpicto($langs->trans(
'Unit'),
'').
'</td>';
104 print
'<td class="linecolqtyfrozen right">' . $form->textwithpicto($langs->trans(
'QtyFrozen'), $langs->trans(
"QuantityConsumedInvariable")) .
'</td>';
107 print
'<td class="linecoldisablestockchange right">' . $form->textwithpicto($langs->trans(
'DisableStockChange'), $langs->trans(
'DisableStockChangeHelp')) .
'</td>';
110 print
'<td class="linecollost right">' . $form->textwithpicto($langs->trans(
'ManufacturingEfficiency'), $langs->trans(
'ValueOfMeansLoss')) .
'</td>';
114 if ($filtertype == 1 && isModEnabled(
'workstation')) {
115 print
'<td class="linecolworkstation right">' . $form->textwithpicto($langs->trans(
'Workstation'),
'') .
'</td>';
118 print
'<td class="linecoltotalcost right">' . $form->textwithpicto($langs->trans(
'TotalCost'),
'') .
'</td>';
120 print
'<td class="linecoledit" colspan="' . $colspan .
'"> </td>';
124print
'<tr class="pair nodrag nodrop nohoverpair'.(($nolinesbefore ||
$object->element ==
'contrat') ?
'' :
' liste_titre_create').
'">';
130 echo
'<td class="bordertop nobottom linecolnum center"></td>';
134print
'<td class="bordertop nobottom linecoldescription bomline minwidth500imp">';
137if (isModEnabled(
"product") || isModEnabled(
"service")) {
138 if ($filtertype == 1) {
139 print $langs->trans(
"Service");
141 print $langs->trans(
"Product");
144 echo
'<span class="prod_entry_mode_predef nowraponall">';
149 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);
151 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);
153 $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);
154 print
'<a href="'.$urltocreateproduct.
'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans(
"AddProduct").
'"></span></a>';
159 print
'<br><span class="opacitymedium">'.$langs->trans(
"or").
'</span><br>'.$langs->trans(
"BOM");
160 print $form->select_bom(
'',
'bom_id', 0, 1, 0,
'1',
'', 1);
163if (is_object($objectline)) {
164 $temps = $objectline->showOptionals($extrafields,
'create', array(),
'',
'', 1,
'line');
166 if (!empty($temps)) {
167 print
'<div style="padding-top: 10px" id="extrafield_lines_area_create" name="extrafield_lines_area_create">';
177print
'<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).
'">';
180if ($filtertype != 1) {
183 print
'<td class="nobottom linecoluseunit">';
188 require_once DOL_DOCUMENT_ROOT.
'/core/class/cunits.class.php';
189 $cUnit =
new CUnits($this->db);
190 $fk_unit_default = $cUnit->getUnitFromCode(
'h',
'short_label',
'time');
191 print
'<td class="bordertop nobottom nowrap linecolunit">';
192 print $formproduct->selectMeasuringUnits(
"fk_unit",
"time", $fk_unit_default, 1);
198 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"' :
'') .
'>';
203 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"' :
'') .
'">';
208 print
'<td class="bordertop nobottom nowrap linecollost right">';
209 print
'<input type="text" size="2" name="efficiency" id="efficiency" class="flat right" value="' . ((GETPOSTISSET(
"efficiency") && $action ==
'addline') ?
GETPOST(
"efficiency",
'alpha') : 1) .
'">';
213if ($filtertype == 1 && isModEnabled(
'workstation')) {
215 print
'<td class="bordertop nobottom nowrap linecolworkstation">';
216 print $formproduct->selectWorkstations(
'',
'idworkstations', 1);
222print
'<td class="bordertop nobottom nowrap linecolcost right">';
227$coldisplay += $colspan;
228print
'<td class="bordertop nobottom linecoledit right valignmiddle" colspan="' . $colspan .
'">';
229print
'<input type="submit" class="button button-add small" name="addline" id="addline" value="' . $langs->trans(
'Add') .
'">';
238jQuery(document).ready(
function() {
240 $(
"#idprod").change(
function()
242 console.log(
"#idprod change triggered");
245 if (jQuery(
'#idprod').val() > 0)
248 jQuery(
'#dp_desc').focus();
250 if (typeof CKEDITOR ==
"object" && typeof CKEDITOR.instances !=
"undefined")
252 var editor = CKEDITOR.instances[
'dp_desc'];
253 if (editor) { editor.focus(); }
259 <?php
if ($filtertype == 1) { ?>
260 $(
'#idprodservice').change(
function(){
261 var idproduct = $(
this).val();
264 url :
"<?php echo dol_buildpath('/bom/ajax/ajax.php', 1); ?>"
267 'action':
'getDurationUnitByProduct'
268 ,
'token' :
"<?php echo newToken() ?>"
269 ,
'idproduct' : idproduct
271 }).done(
function(data) {
274 $(
"#fk_unit").val(data).change();
278 url :
"<?php echo dol_buildpath('/bom/ajax/ajax.php', 1); ?>"
281 'action':
'getWorkstationByProduct'
282 ,
'token' :
"<?php echo newToken() ?>"
283 ,
'idproduct' : idproduct
285 }).done(
function(data) {
286 $(
'#idworkstations').val(data.defaultWk).select2();
294<!-- 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