32require_once DOL_DOCUMENT_ROOT.
"/product/class/html.formproduct.class.php";
35if (empty($object) || !is_object($object)) {
36 print
"Error: this template page cannot be called directly as an URL";
41global $forceall, $forcetoshowtitlelines, $filtertype;
43if (empty($forceall)) {
47if (empty($filtertype)) $filtertype = 0;
48if (!empty($object->element) && $object->element ==
'contrat' && empty($conf->global->STOCK_SUPPORT_SERVICES)) {
59$objectline =
new BOMLine($this->db);
61print
"<!-- BEGIN PHP TEMPLATE objectline_create.tpl.php -->\n";
63$nolinesbefore = (count($this->lines) == 0 || $forcetoshowtitlelines);
66 print
'<tr class="liste_titre nodrag nodrop">';
67 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
68 print
'<td class="linecolnum center"></td>';
70 print
'<td class="linecoldescription minwidth500imp">';
71 print
'<div id="add"></div><span class="hideonsmartphone">'.$langs->trans(
'AddNewLine').
'</span>';
73 print
'<td class="linecolqty right">'.$langs->trans(
'Qty').
'</td>';
75 if ($filtertype != 1) {
77 print
'<td class="linecoluseunit left">';
78 print
'<span id="title_units">';
79 print $langs->trans(
'Unit');
82 print
'<td class="linecolqtyfrozen right">' . $form->textwithpicto($langs->trans(
'QtyFrozen'), $langs->trans(
"QuantityConsumedInvariable")) .
'</td>';
83 print
'<td class="linecoldisablestockchange right">' . $form->textwithpicto($langs->trans(
'DisableStockChange'), $langs->trans(
'DisableStockChangeHelp')) .
'</td>';
84 print
'<td class="linecollost right">' . $form->textwithpicto($langs->trans(
'ManufacturingEfficiency'), $langs->trans(
'ValueOfMeansLoss')) .
'</td>';
86 print
'<td class="linecolunit right">' . $form->textwithpicto($langs->trans(
'Unit'),
'').
'</td>';
87 if (isModEnabled(
'workstation')) print
'<td class="linecolworkstation right">' . $form->textwithpicto($langs->trans(
'Workstation'),
'') .
'</td>';
88 print
'<td class="linecoltotalcost right">' . $form->textwithpicto($langs->trans(
'TotalCost'),
'') .
'</td>';
91 print
'<td class="linecoledit" colspan="' . $colspan .
'"> </td>';
94print
'<tr class="pair nodrag nodrop nohoverpair'.(($nolinesbefore || $object->element ==
'contrat') ?
'' :
' liste_titre_create').
'">';
98if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
100 echo
'<td class="bordertop nobottom linecolnum center"></td>';
104print
'<td class="bordertop nobottom linecoldescription minwidth500imp">';
107if (isModEnabled(
"product") || isModEnabled(
"service")) {
108 if ($filtertype == 1) {
109 print $langs->trans(
"Service");
111 print $langs->trans(
"Product");
113 echo
'<span class="prod_entry_mode_predef">';
115 if (!empty($conf->global->ENTREPOT_EXTRA_STATUS)) {
117 print $form->select_produits(
GETPOST(
'idprod',
'int'), (($filtertype == 1) ?
'idprodservice' :
'idprod'), $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2,
'', 1, array(), $buyer->id,
'1', 0,
'maxwidth500', 0,
'warehouseopen,warehouseinternal',
GETPOST(
'combinations',
'array'), 1);
119 print $form->select_produits(
GETPOST(
'idprod',
'int'), (($filtertype == 1) ?
'idprodservice' :
'idprod'), $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2,
'', 1, array(), $buyer->id,
'1', 0,
'maxwidth500', 0,
'',
GETPOST(
'combinations',
'array'), 1);
121 $urltocreateproduct = DOL_URL_ROOT.
'/product/card.php?action=create&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?id='.$object->id);
122 print
'<a href="'.$urltocreateproduct.
'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans(
"AddProduct").
'"></span></a>';
126if (!empty($conf->global->BOM_SUB_BOM) && $filtertype!=1) {
127 print
'<br><span class="opacitymedium">'.$langs->trans(
"or").
'</span><br>'.$langs->trans(
"BOM");
128 print $form->select_bom(
'',
'bom_id', 0, 1, 0,
'1',
'', 1);
131if (is_object($objectline)) {
132 $temps = $objectline->showOptionals($extrafields,
'create', array(),
'',
'', 1,
'line');
134 if (!empty($temps)) {
135 print
'<div style="padding-top: 10px" id="extrafield_lines_area_create" name="extrafield_lines_area_create">';
145print
'<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).
'">';
148if ($filtertype != 1) {
151 print
'<td class="nobottom linecoluseunit left">';
156 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"' :
'') .
'>';
161 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"' :
'') .
'">';
165 print
'<td class="bordertop nobottom nowrap linecollost right">';
166 print
'<input type="text" size="2" name="efficiency" id="efficiency" class="flat right" value="' . ((GETPOSTISSET(
"efficiency") && $action ==
'addline') ?
GETPOST(
"efficiency",
'alpha') : 1) .
'">';
170 print
'<td class="bordertop nobottom nowrap linecolcost right">';
175 require_once DOL_DOCUMENT_ROOT.
'/core/class/cunits.class.php';
176 $cUnit =
new CUnits($this->db);
177 $fk_unit_default = $cUnit->getUnitFromCode(
'h',
'short_label',
'time');
178 print
'<td class="bordertop nobottom nowrap linecolunit right">';
179 print $formproduct->selectMeasuringUnits(
"fk_unit",
"time", $fk_unit_default, 0, 0);
183 print
'<td class="bordertop nobottom nowrap linecolworkstation right">';
188 print
'<td class="bordertop nobottom nowrap linecolcost right">';
193 $coldisplay += $colspan;
194 print
'<td class="bordertop nobottom linecoledit center valignmiddle" colspan="' . $colspan .
'">';
195 print
'<input type="submit" class="button button-add" name="addline" id="addline" value="' . $langs->trans(
'Add') .
'">';
204jQuery(document).ready(
function() {
206 $(
"#idprod").change(
function()
208 console.log(
"#idprod change triggered");
211 if (jQuery(
'#idprod').val() > 0)
214 jQuery(
'#dp_desc').focus();
216 if (typeof CKEDITOR ==
"object" && typeof CKEDITOR.instances !=
"undefined")
218 var editor = CKEDITOR.instances[
'dp_desc'];
219 if (editor) { editor.focus(); }
225 <?php
if ($filtertype == 1) { ?>
226 $(
'#idprodservice').change(
function(){
227 var idproduct = $(
this).val();
230 url :
"<?php echo dol_buildpath('/bom/ajax/ajax.php', 1); ?>"
233 'action':
'getDurationUnitByProduct'
234 ,
'idproduct' : idproduct
236 }).done(
function(data) {
239 var data = JSON.parse(data);
240 $(
"#fk_unit").val(data).change();
248<!-- END PHP TEMPLATE objectline_create.tpl.php -->
Class of dictionary type of thirdparty (used by imports)
getDolGlobalInt($key, $default=0)
Return 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.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type