32 require_once DOL_DOCUMENT_ROOT.
"/product/class/html.formproduct.class.php";
35 if (empty($object) || !is_object($object)) {
36 print
"Error: this template page cannot be called directly as an URL";
41 global $forceall, $forcetoshowtitlelines, $filtertype;
43 if (empty($forceall)) {
47 if (empty($filtertype)) $filtertype = 0;
48 if (!empty($object->element) && $object->element ==
'contrat' && empty($conf->global->STOCK_SUPPORT_SERVICES)) {
61 print
"<!-- 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>';
94 print
'<tr class="pair nodrag nodrop nohoverpair'.(($nolinesbefore || $object->element ==
'contrat') ?
'' :
' liste_titre_create').
'">';
98 if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
100 echo
'<td class="bordertop nobottom linecolnum center"></td>';
104 print
'<td class="bordertop nobottom linecoldescription minwidth500imp">';
108 if ($filtertype == 1) {
109 print $langs->trans(
"Service");
110 } elseif (!empty($conf->global->BOM_SUB_BOM)) {
111 print $langs->trans(
"Product");
113 echo
'<span class="prod_entry_mode_predef">';
115 if (!empty($conf->global->ENTREPOT_EXTRA_STATUS)) {
117 $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'));
119 $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'));
124 if (!empty($conf->global->BOM_SUB_BOM) && $filtertype!=1) {
125 print
'<br><span class="opacitymedium">'.$langs->trans(
"or").
'</span><br>'.$langs->trans(
"BOM");
130 if (is_object($objectline)) {
131 $temps = $objectline->showOptionals($extrafields,
'create', array(),
'',
'', 1,
'line');
133 if (!empty($temps)) {
134 print
'<div style="padding-top: 10px" id="extrafield_lines_area_create" name="extrafield_lines_area_create">';
144 print
'<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).
'">';
147 if ($filtertype != 1) {
150 print
'<td class="nobottom linecoluseunit left">';
155 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"' :
'') .
'>';
160 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"' :
'') .
'">';
164 print
'<td class="bordertop nobottom nowrap linecollost right">';
165 print
'<input type="text" size="2" name="efficiency" id="efficiency" class="flat right" value="' . ((
GETPOSTISSET(
"efficiency") && $action ==
'addline') ?
GETPOST(
"efficiency",
'alpha') : 1) .
'">';
169 print
'<td class="bordertop nobottom nowrap linecolcost right">';
174 require_once DOL_DOCUMENT_ROOT.
'/core/class/cunits.class.php';
176 $fk_unit_default = $cUnit->getUnitFromCode(
'h',
'short_label',
'time');
177 print
'<td class="bordertop nobottom nowrap linecolunit right">';
178 print $formproduct->selectMeasuringUnits(
"fk_unit",
"time", $fk_unit_default, 0, 0);
182 print
'<td class="bordertop nobottom nowrap linecolworkstation right">';
187 print
'<td class="bordertop nobottom nowrap linecolcost right">';
192 $coldisplay += $colspan;
193 print
'<td class="bordertop nobottom linecoledit center valignmiddle" colspan="' . $colspan .
'">';
194 print
'<input type="submit" class="button button-add" name="addline" id="addline" value="' . $langs->trans(
'Add') .
'">';
199 if (is_object($objectline)) {
200 print $objectline->showOptionals($extrafields,
'edit', array(
'style'=>$bcnd[$var],
'colspan'=>$coldisplay),
'',
'', 1,
'line');
207 jQuery(document).ready(
function() {
209 $(
"#idprod").change(
function()
211 console.log(
"#idprod change triggered");
214 if (jQuery(
'#idprod').val() > 0)
217 jQuery(
'#dp_desc').focus();
219 if (typeof CKEDITOR ==
"object" && typeof CKEDITOR.instances !=
"undefined")
221 var editor = CKEDITOR.instances[
'dp_desc'];
222 if (editor) { editor.focus(); }
228 <?php
if ($filtertype == 1) { ?>
229 $(
'#idprodservice').change(
function(){
230 var idproduct = $(
this).val();
233 url :
"<?php echo dol_buildpath('/bom/ajax/ajax.php', 1); ?>"
236 'action':
'getDurationUnitByProduct'
237 ,
'idproduct' : idproduct
239 }).done(
function(data) {
242 var data = JSON.parse(data);
243 $(
"#fk_unit").val(data).change();
251 <!-- END PHP TEMPLATE objectline_create.tpl.php -->
Class of dictionary type of thirdparty (used by imports)
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
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.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isModEnabled($module)
Is Dolibarr module enabled.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
$conf db
API class for accounts.