39if (empty($object) || !is_object($object)) {
40 print
"Error: this template page cannot be called directly as an URL";
45if (isModEnabled(
'margin') && !empty($object->element) && in_array($object->element, array(
'facture',
'facturerec',
'propal',
'commande'))) {
48if (!isset($dateSelector)) {
51global $forceall, $forcetoshowtitlelines, $senderissupplier, $inputalsopricewithtax;
54if (!isset($dateSelector)) {
56} elseif (empty($dateSelector)) {
59if (empty($forceall)) {
62if (empty($senderissupplier)) {
63 $senderissupplier = 0;
65if (empty($inputalsopricewithtax)) {
66 $inputalsopricewithtax = 0;
70if (isModEnabled(
"multicurrency") && $this->multicurrency_code != $conf->currency) {
73if (in_array($object->element, array(
'propal',
'commande',
'order',
'facture',
'facturerec',
'invoice',
'supplier_proposal',
'order_supplier',
'invoice_supplier',
'invoice_supplier_rec'))) {
76if (isModEnabled(
'asset') && $object->element ==
'invoice_supplier') {
83if (!empty($extrafields)) {
84 if ($this->table_element_line ==
'commandedet') {
86 } elseif ($this->table_element_line ==
'propaldet') {
88 } elseif ($this->table_element_line ==
'supplier_proposaldet') {
90 } elseif ($this->table_element_line ==
'facturedet') {
92 } elseif ($this->table_element_line ==
'contratdet') {
94 } elseif ($this->table_element_line ==
'commande_fournisseurdet') {
96 } elseif ($this->table_element_line ==
'facture_fourn_det') {
98 } elseif ($this->table_element_line ==
'facturedet_rec') {
100 } elseif ($this->table_element_line ==
'facture_fourn_det_rec') {
104print
"<!-- BEGIN PHP TEMPLATE objectline_create.tpl.php -->\n";
105$nolinesbefore = (count($this->lines) == 0 || $forcetoshowtitlelines);
108 <tr
class=
"liste_titre<?php echo(($nolinesbefore || $object->element == 'contrat') ? '' : ' liste_titre_add_') ?> nodrag nodrop">
110 <td
class=
"linecolnum center"></td>
112 <td
class=
"linecoldescription minwidth400imp">
113 <div
id=
"add"></div><span
class=
"hideonsmartphone"><?php echo $langs->trans(
'AddNewLine'); ?></span>
116 if ($object->element ==
'supplier_proposal' || $object->element ==
'order_supplier' || $object->element ==
'invoice_supplier' || $object->element ==
'invoice_supplier_rec') {
118 <td
class=
"linecolrefsupplier"><span
id=
"title_fourn_ref"><?php echo $langs->trans(
'SupplierRef'); ?></span></td>
121 <td
class=
"linecolvat right"><span
id=
"title_vat"><?php echo $langs->trans(
'VAT'); ?></span></td>
122 <td
class=
"linecoluht right"><span
id=
"title_up_ht"><?php echo $langs->trans(
'PriceUHT'); ?></span></td>
123 <?php
if (isModEnabled(
"multicurrency") && $this->multicurrency_code != $conf->currency) { ?>
124 <td
class=
"linecoluht_currency right"><span
id=
"title_up_ht_currency"><?php echo $langs->trans(
'PriceUHTCurrency'); ?></span></td>
126 <?php
if (!empty($inputalsopricewithtax) && !
getDolGlobalInt(
'MAIN_NO_INPUT_PRICE_WITH_TAX')) { ?>
127 <td
class=
"linecoluttc right"><span
id=
"title_up_ttc"><?php echo $langs->trans(
'PriceUTTC'); ?></span></td>
129 <td
class=
"linecolqty right"><?php echo $langs->trans(
'Qty'); ?></td>
132 print
'<td class="linecoluseunit left">';
133 print
'<span id="title_units">';
134 print $langs->trans(
'Unit');
135 print
'</span></td>';
137 <td
class=
"linecoldiscount right"><?php echo $langs->trans(
'ReductionShort'); ?></td>
140 if (isset($this->situation_cycle_ref) && $this->situation_cycle_ref) {
141 print
'<td class="linecolcycleref right">'.$langs->trans(
'Progress').
'</td>';
142 print
'<td class="linecolcycleref2 right"></td>';
144 if (!empty($usemargins)) {
145 if (!$user->hasRight(
'margins',
'creer')) {
148 print
'<td class="margininfos linecolmargin1 right">';
150 echo $langs->trans(
'BuyingPrice');
152 echo $langs->trans(
'CostPrice');
156 echo
'<td class="margininfos linecolmargin2 right"><span class="np_marginRate">'.$langs->trans(
'MarginRate').
'</span></td>';
159 echo
'<td class="margininfos linecolmargin2 right"><span class="np_markRate">'.$langs->trans(
'MarkRate').
'</span></td>';
163 <td
class=
"linecoledit" colspan=
"<?php echo $colspan; ?>"> </td>
168<tr
class=
"pair nodrag nodrop nohoverpair<?php echo ($nolinesbefore || $object->element == 'contrat') ? '' : ' liste_titre_create'; ?>">
174 echo
'<td class="nobottom linecolnum center"></td>';
178 <td
class=
"nobottom linecoldescription minwidth400imp">
184 if ($object->element ==
'contrat') {
185 if (!isModEnabled(
'product') && !isModEnabled(
'service') && !
getDolGlobalString(
'CONTRACT_SUPPORT_PRODUCTS')) {
192 echo
'<span class="prod_entry_mode_free">';
194 if ($forceall >= 0 && (isModEnabled(
"product") || isModEnabled(
"service"))) {
195 echo
'<label for="prod_entry_mode_free">';
196 echo
'<input type="radio" class="prod_entry_mode_free" name="prod_entry_mode" id="prod_entry_mode_free" value="free"';
198 echo((
GETPOST(
'prod_entry_mode',
'alpha') ==
'free' ||
getDolGlobalString(
'MAIN_FREE_PRODUCT_CHECKED_BY_DEFAULT')) ?
' checked' :
'');
201 echo
'<span class="textradioforitem">'.$langs->trans(
"FreeLineOfType").
'</span>';
205 echo
'<input type="hidden" id="prod_entry_mode_free" name="prod_entry_mode" value="free">';
207 if ($forceall >= 0) {
208 if (!isModEnabled(
'product') || !isModEnabled(
'service')) {
209 echo $langs->trans(
"Type");
211 echo $langs->trans(
"FreeLineOfType");
216 $form->select_type_of_lines(GETPOSTISSET(
"type") ?
GETPOST(
"type",
'alpha', 2) : -1,
'type', 1, 1, $forceall);
220 if (isModEnabled(
"product") || isModEnabled(
"service")) {
221 if ($forceall >= 0 && $freelines) {
222 echo
'<br><span class="prod_entry_mode_predef paddingtop">';
224 echo
'<span class="prod_entry_mode_predef">';
226 echo
'<label for="prod_entry_mode_predef">';
227 echo
'<input type="radio" class="prod_entry_mode_predef" name="prod_entry_mode" id="prod_entry_mode_predef" value="predef"'.(GETPOST(
'prod_entry_mode') ==
'predef' ?
' checked' :
'').
'> ';
229 if (empty($conf->dol_optimize_smallscreen)) {
230 if (empty($senderissupplier)) {
231 if (isModEnabled(
"product") && !isModEnabled(
'service')) {
232 $labelforradio = $langs->trans(
'PredefinedProductsToSell');
233 } elseif ((!isModEnabled(
'product') && isModEnabled(
'service')) || ($object->element ==
'contrat' && !
getDolGlobalString(
'CONTRACT_SUPPORT_PRODUCTS'))) {
234 $labelforradio = $langs->trans(
'PredefinedServicesToSell');
236 $labelforradio = $langs->trans(
'PredefinedProductsAndServicesToSell');
239 if (isModEnabled(
"product") && !isModEnabled(
'service')) {
240 $labelforradio = $langs->trans(
'PredefinedProductsToPurchase');
241 } elseif (!isModEnabled(
'product') && isModEnabled(
'service')) {
242 $labelforradio = $langs->trans(
'PredefinedServicesToPurchase');
244 $labelforradio = $langs->trans(
'PredefinedProductsAndServicesToPurchase');
248 $labelforradio = $langs->trans(
'PredefinedItem');
250 print
'<span class="textradioforitem">'.$labelforradio.
'</span>';
254 if (!empty($object->element) && $object->element ==
'contrat' && !
getDolGlobalString(
'CONTRACT_SUPPORT_PRODUCTS')) {
257 if (empty($senderissupplier)) {
259 $statuswarehouse =
'warehouseopen,warehouseinternal';
261 $statuswarehouse =
'warehouseopen';
265 $form->select_produits(
GETPOST(
'idprod'),
'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2,
'', 1, array(), $buyer->id,
'1', 0,
'maxwidth500', 0, $statuswarehouse,
GETPOST(
'combinations',
'array'));
267 $form->select_produits(
GETPOST(
'idprod'),
'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2,
'', 1, array(), $buyer->id,
'1', 0,
'maxwidth500', 0,
'',
GETPOST(
'combinations',
'array'));
272 $(document).ready(
function(){
274 $(document).on(
'focus',
'.select2-selection.select2-selection--single',
function (e) {
275 console.log(
'focus on a select2');
276 if ($(
this).attr(
'aria-labelledby') ==
'select2-idprod-container')
278 console.log(
'open combo');
279 $(
'#idprod').select2(
'open');
288 if ($senderissupplier != 2) {
289 $ajaxoptions = array(
290 'update' => array(
'qty'=>
'qty',
'remise_percent' =>
'discount',
'idprod' =>
'idprod'),
291 'option_disabled' =>
'idthatdoesnotexists',
292 'warning' => $langs->trans(
"NoPriceDefinedForThisSupplier")
294 $alsoproductwithnosupplierprice = 0;
296 $ajaxoptions = array(
301 $alsoproductwithnosupplierprice = 1;
303 $form->select_produits_fournisseurs($object->socid,
GETPOST(
'idprodfournprice'),
'idprodfournprice',
'',
'', $ajaxoptions, 1, $alsoproductwithnosupplierprice,
'minwidth300imp maxwidth500');
307 $(document).ready(
function(){
309 $(document).on(
'focus',
'.select2-selection.select2-selection--single',
function (e) {
311 if ($(
this).attr(
'aria-labelledby') ==
'select2-idprodfournprice-container')
313 $(
'#idprodfournprice').select2(
'open');
322 $parentId =
GETPOST(
'parentId',
'int');
324 $addproducton = (isModEnabled(
'product') && $user->hasRight(
'produit',
'creer'));
325 $addserviceon = (isModEnabled(
'service') && $user->hasRight(
'service',
'creer'));
326 if ($addproducton || $addserviceon) {
327 if ($addproducton && $addserviceon) {
328 echo
'<div id="dropdownAddProductAndService" class="dropdown inline-block">';
329 echo
'<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" id="dropdownAddProductAndServiceLink" aria-haspopup="true" aria-expanded="false">';
330 echo
'<span class="fa fa-plus-circle valignmiddle paddingleft"></span>';
332 echo
'<div class="dropdown-menu" aria-labelledby="dropdownAddProductAndServiceLink" style="top:auto; left:auto;">';
333 echo
'<a class="dropdown-item" href="'.DOL_URL_ROOT.
'/product/card.php?action=create&type=0&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?id='.$object->id).
'"> '.$langs->trans(
"NewProduct").
'</a>';
334 echo
'<a class="dropdown-item" href="'.DOL_URL_ROOT.
'/product/card.php?action=create&type=1&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?id='.$object->id).
'"> '.$langs->trans(
"NewService").
'</a>';
339 $url =
'/product/card.php?leftmenu=product&action=create&type=0&backtopage='.urlencode($_SERVER[
"PHP_SELF"]);
340 $newbutton =
'<span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans(
"NewProduct").
'"></span>';
343 $tmpbacktopagejsfields =
'addproduct:id,search_id';
346 print
'<a href="'.DOL_URL_ROOT.
'/product/card.php?action=create&type=0&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?id='.$object->id).
'" title="'.
dol_escape_htmltag($langs->trans(
"NewProduct")).
'"><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>';
350 $url =
'/product/card.php?leftmenu=product&action=create&type=1&backtopage='.urlencode($_SERVER[
"PHP_SELF"]);
351 $newbutton =
'<span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans(
"NewService").
'"></span>';
354 $tmpbacktopagejsfields =
'addproduct:id,search_id';
357 print
'<a href="'.DOL_URL_ROOT.
'/product/card.php?action=create&type=1&backtopage='.urlencode($_SERVER[
"PHP_SELF"].
'?id='.$object->id).
'" title="'.
dol_escape_htmltag($langs->trans(
"NewService")).
'"><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>';
363 $(document).ready(
function(){
364 $(
"#dropdownAddProductAndService .dropdown-toggle").on(
"click",
function(event) {
365 console.log(
"toggle addproduct dropdown");
366 event.preventDefault();
367 $(
"#dropdownAddProductAndService").toggleClass(
"open");
373 echo
'<input type="hidden" name="pbq" id="pbq" value="">';
378 echo
'<br>'.$langs->trans(
'AddLineOnPosition').
' : <input type="number" name="rank" step="1" min="0" style="width: 5em;">';
381 if (is_object($hookmanager) && empty($senderissupplier)) {
382 $parameters = array(
'fk_parent_line'=>
GETPOST(
'fk_parent_line',
'int'));
383 $reshook = $hookmanager->executeHooks(
'formCreateProductOptions', $parameters, $object, $action);
384 if (!empty($hookmanager->resPrint)) {
385 print $hookmanager->resPrint;
388 if (is_object($hookmanager) && !empty($senderissupplier)) {
389 $parameters = array(
'htmlname'=>
'addproduct');
390 $reshook = $hookmanager->executeHooks(
'formCreateProductSupplierOptions', $parameters, $object, $action);
391 if (!empty($hookmanager->resPrint)) {
392 print $hookmanager->resPrint;
395 if (isModEnabled(
"product") || isModEnabled(
"service")) {
397 if (isModEnabled(
'variants')) {
398 echo
'<div id="attributes_box"></div>';
402 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
404 $enabled = (
getDolGlobalString(
'FCKEDITOR_ENABLE_DETAILS') ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0);
406 $nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT;
408 $toolbarname =
'dolibarr_details';
410 $toolbarname =
'dolibarr_notes';
412 $doleditor =
new DolEditor(
'dp_desc',
GETPOST(
'dp_desc',
'restricthtml'),
'', (!
getDolGlobalString(
'MAIN_DOLEDITOR_HEIGHT') ? 100 : $conf->global->MAIN_DOLEDITOR_HEIGHT), $toolbarname,
'', false, true, $enabled, $nbrows,
'98%');
413 $doleditor->Create();
415 if (isModEnabled(
"service") && ($object->element ==
'facturerec' || $object->element ==
'invoice_supplier_rec')) {
416 echo
'<div class="divlinefordates"><br>';
417 echo $langs->trans(
'AutoFillDateFrom').
' ';
419 $line->date_start_fill = 1;
420 $line->date_end_fill = 1;
422 echo $form->selectyesno(
'date_start_fill', $line->date_start_fill, 1);
424 echo $langs->trans(
'AutoFillDateTo').
' ';
425 echo $form->selectyesno(
'date_end_fill', $line->date_end_fill, 1);
428 if (is_object($objectline)) {
429 $temps = $objectline->showOptionals($extrafields,
'create', array(),
'',
'', 1,
'line');
431 if (!empty($temps)) {
432 print
'<div style="padding-top: 10px" id="extrafield_lines_area_create" name="extrafield_lines_area_create">';
438 if ($object->element ==
'supplier_proposal' || $object->element ==
'order_supplier' || $object->element ==
'invoice_supplier' || $object->element ==
'invoice_supplier_rec') {
440 <td
class=
"nobottom linecolrefsupplier"><input
id=
"fourn_ref" name=
"fourn_ref" class=
"flat minwidth50 maxwidth100 maxwidth125onsmartphone" value=
"<?php echo(GETPOSTISSET("fourn_ref
") ? GETPOST("fourn_ref
", 'alpha', 2) : ''); ?>"></td>
443 print
'<td class="nobottom linecolvat right">';
445 if ($seller->tva_assuj ==
"0") {
446 echo
'<input type="hidden" name="tva_tx" id="tva_tx" value="0">'.vatrate(0,
true);
448 echo $form->load_tva(
'tva_tx', (GETPOSTISSET(
"tva_tx") ?
GETPOST(
"tva_tx",
'alpha', 2) : -1), $seller, $buyer, 0, 0,
'', false, 1);
453 <td
class=
"nobottom linecoluht right"><?php $coldisplay++; ?>
454 <input
type=
"text" size=
"5" name=
"price_ht" id=
"price_ht" class=
"flat right" value=
"<?php echo(GETPOSTISSET("price_ht
") ? GETPOST("price_ht
", 'alpha', 2) : ''); ?>">
458 if (isModEnabled(
"multicurrency") && $this->multicurrency_code != $conf->currency) {
460 <td
class=
"nobottom linecoluht_currency right">
461 <input
type=
"text" size=
"5" name=
"multicurrency_price_ht" id=
"multicurrency_price_ht" class=
"flat right" value=
"<?php echo(GETPOSTISSET("multicurrency_price_ht
") ? GETPOST("multicurrency_price_ht
", 'alpha', 2) : ''); ?>">
465 if (!empty($inputalsopricewithtax) && !
getDolGlobalInt(
'MAIN_NO_INPUT_PRICE_WITH_TAX')) {
467 <td
class=
"nobottom linecoluttc right">
468 <input
type=
"text" size=
"5" name=
"price_ttc" id=
"price_ttc" class=
"flat right" value=
"<?php echo(GETPOSTISSET("price_ttc
") ? GETPOST("price_ttc
", 'alpha', 2) : ''); ?>">
474 <td
class=
"nobottom linecolqty right">
475 <?php $default_qty = (!
getDolGlobalString(
'MAIN_OBJECTLINE_CREATE_EMPTY_QTY_BY_DEFAULT') ? 1 :
''); ?>
476 <input
type=
"text" name=
"qty" id=
"qty" class=
"flat width40 right" value=
"<?php echo(GETPOSTISSET("qty
") ? GETPOST("qty
", 'alpha', 2) : $default_qty); ?>">
481 print
'<td class="nobottom linecoluseunit left">';
482 print $form->selectUnits(empty($line->fk_unit) ? $conf->global->PRODUCT_USE_UNITS : $line->fk_unit,
"units");
485 $remise_percent = $buyer->remise_percent;
486 if ($object->element ==
'supplier_proposal' || $object->element ==
'order_supplier' || $object->element ==
'invoice_supplier') {
487 $remise_percent = $seller->remise_supplier_percent;
492 <td
class=
"nobottom nowrap linecoldiscount right"><input
type=
"text" name=
"remise_percent" id=
"remise_percent" class=
"flat width40 right" value=
"<?php echo(GETPOSTISSET("remise_percent
") ? GETPOST("remise_percent
", 'alpha', 2) : ($remise_percent ? $remise_percent : '')); ?>"><span
class=
"opacitymedium hideonsmartphone">%</span></td>
494 if (isset($this->situation_cycle_ref) && $this->situation_cycle_ref) {
496 print
'<td class="nobottom nowrap right"><input class="falt right" type="text" size="1" value="" name="progress"><span class="opacitymedium hideonsmartphone">%</span></td>';
500 if (!empty($usemargins)) {
501 if ($user->hasRight(
'margins',
'creer')) {
503 <td
class=
"nobottom margininfos linecolmargin right">
504 <!-- For predef product -->
505 <?php
if (isModEnabled(
"product") || isModEnabled(
"service")) { ?>
506 <select
id=
"fournprice_predef" name=
"fournprice_predef" class=
"flat minwidth75imp maxwidth150" style=
"display: none;"></select>
508 <!-- For free product -->
509 <input
type=
"text" id=
"buying_price" name=
"buying_price" class=
"flat maxwidth75 right" value=
"<?php echo(GETPOSTISSET("buying_price
") ? GETPOST("buying_price
", 'alpha', 2) : ''); ?>">
513 echo
'<td class="nobottom nowraponall margininfos right"><input class="flat right width40" type="text" id="np_marginRate" name="np_marginRate" value="'.(GETPOSTISSET(
"np_marginRate") ?
GETPOST(
"np_marginRate",
'alpha', 2) :
'').
'"><span class="np_marginRate opacitymedium hideonsmartphone">%</span></td>';
517 echo
'<td class="nobottom nowraponall margininfos right"><input class="flat right width40" type="text" id="np_markRate" name="np_markRate" value="'.(GETPOSTISSET(
"np_markRate") ?
GETPOST(
"np_markRate",
'alpha', 2) :
'').
'"><span class="np_markRate opacitymedium hideonsmartphone">%</span></td>';
522 $coldisplay += $colspan;
524 <td
class=
"nobottom linecoledit center valignmiddle" colspan=
"<?php echo $colspan; ?>">
525 <input
type=
"submit" class=
"button reposition" value=
"<?php echo $langs->trans('Add'); ?>" name=
"addline" id=
"addline">
530if ((isModEnabled(
"service") || ($object->element ==
'contrat')) && $dateSelector &&
GETPOST(
'type') !=
'0') {
531 print
'<tr id="trlinefordates" class="oddeven">'.
"\n";
535 print
'<td colspan="'.($coldisplay - (!
getDolGlobalString(
'MAIN_VIEW_LINE_NUMBER') ? 0 : 1)).
'">';
539 $prefillDates =
false;
541 if (
getDolGlobalString(
'MAIN_FILL_SERVICE_DATES_FROM_LAST_SERVICE_LINE') && !empty($object->lines)) {
542 for ($i = count($object->lines) - 1; $i >= 0; $i--) {
543 $lastline = $object->lines[$i];
545 if ($lastline->product_type ==
Product::TYPE_SERVICE && (!empty($lastline->date_start) || !empty($lastline->date_end))) {
546 $date_start_prefill = $lastline->date_start;
547 $date_end_prefill = $lastline->date_end;
549 $prefillDates =
true;
555 if (!empty($object->element) && $object->element ==
'contrat') {
556 print $langs->trans(
"DateStartPlanned").
' ';
557 print $form->selectDate($date_start,
"date_start", $usehm, $usehm, 1,
"addproduct");
558 print
' '.$langs->trans(
"DateEndPlanned").
' ';
559 print $form->selectDate($date_end,
"date_end", $usehm, $usehm, 1,
"addproduct");
561 print $langs->trans(
'ServiceLimitedDuration').
' '.$langs->trans(
'From').
' ';
562 print $form->selectDate($date_start,
'date_start', !
getDolGlobalString(
'MAIN_USE_HOURMIN_IN_DATE_RANGE') ? 0 : 1, !
getDolGlobalString(
'MAIN_USE_HOURMIN_IN_DATE_RANGE') ? 0 : 1, 1,
"addproduct", 1, 0);
563 print
' '.$langs->trans(
'to').
' ';
564 print $form->selectDate($date_end,
'date_end', !
getDolGlobalString(
'MAIN_USE_HOURMIN_IN_DATE_RANGE') ? 0 : 1, !
getDolGlobalString(
'MAIN_USE_HOURMIN_IN_DATE_RANGE') ? 0 : 1, 1,
"addproduct", 1, 0);
568 echo
' <span class="small"><a href="#" id="prefill_service_dates">'.$langs->trans(
'FillWithLastServiceDates').
'</a></span>';
575 function prefill_service_dates()
577 $(
'#date_start').val(
"<?php echo dol_escape_js(dol_print_date($date_start_prefill, 'day')); ?>").trigger(
'change');
578 $(
'#date_end').val(
"<?php echo dol_escape_js(dol_print_date($date_end_prefill, 'day')); ?>").trigger(
'change');
583 $(document).ready(
function()
585 $(
'#prefill_service_dates').click(prefill_service_dates);
592 if (isset($conf->global->MAIN_DEFAULT_DATE_START_HOUR)) {
593 print
'jQuery("#date_starthour").val("' .
getDolGlobalString(
'MAIN_DEFAULT_DATE_START_HOUR').
'");';
595 if (isset($conf->global->MAIN_DEFAULT_DATE_START_MIN)) {
596 print
'jQuery("#date_startmin").val("' .
getDolGlobalString(
'MAIN_DEFAULT_DATE_START_MIN').
'");';
600 if (isset($conf->global->MAIN_DEFAULT_DATE_END_HOUR)) {
601 print
'jQuery("#date_endhour").val("' .
getDolGlobalString(
'MAIN_DEFAULT_DATE_END_HOUR').
'");';
603 if (isset($conf->global->MAIN_DEFAULT_DATE_END_MIN)) {
604 print
'jQuery("#date_endmin").val("' .
getDolGlobalString(
'MAIN_DEFAULT_DATE_END_MIN').
'");';
614if (!empty($usemargins) && $user->hasRight(
'margins',
'creer')) {
617 jQuery(document).ready(
function() {
620 $(
"input[name='np_marginRate']:first").blur(
function(e) {
621 return checkFreeLine(e,
"np_marginRate");
626 $(
"input[name='np_markRate']:first").blur(
function(e) {
627 return checkFreeLine(e,
"np_markRate");
634 function checkFreeLine(e, npRate)
636 var buying_price = $(
"input[name='buying_price']:first");
637 var remise = $(
"input[name='remise_percent']:first");
639 var rate = $(
"input[name='"+npRate+
"']:first");
640 if (rate.val() ==
'')
643 if (! $.isNumeric(rate.val().replace(
',',
'.')))
645 alert(
'<?php echo dol_escape_js($langs->trans("rateMustBeNumeric")); ?>');
647 setTimeout(
function () { rate.focus() }, 50);
650 if (npRate ==
"np_markRate" && rate.val() >= 100)
652 alert(
'<?php echo dol_escape_js($langs->trans("markRateShouldBeLesserThan100")); ?>');
654 setTimeout(
function () { rate.focus() }, 50);
663 if (remisejs ==
'') remisejs=0;
668 if (npRate ==
"np_marginRate")
669 price = ((bpjs * (1 + ratejs / 100)) / (1 - remisejs / 100));
670 else if (npRate ==
"np_markRate")
671 price = ((bpjs / (1 - ratejs / 100)) / (1 - remisejs / 100));
674 $(
"input[name='price_ht']:first").val(
price);
684 jQuery(document).ready(
function() {
685 jQuery(
"#price_ht").keyup(
function(event) {
687 if (event.which != 9 && (event.which < 37 ||event.which > 40) && jQuery(
"#price_ht").val() !=
'') {
688 jQuery(
"#price_ttc").val(
'');
689 jQuery(
"#multicurrency_subprice").val(
'');
690 jQuery(
"#multicurrency_price_ht").val(
'');
693 jQuery(
"#price_ttc").keyup(
function(event) {
695 if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery(
"#price_ttc").val() !=
'') {
696 jQuery(
"#price_ht").val(
'');
697 jQuery(
"#multicurrency_subprice").val(
'');
698 jQuery(
"#multicurrency_price_ht").val(
'');
701 jQuery(
"#multicurrency_subprice").keyup(
function(event) {
703 if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery(
"#multicurrency_subprice").val() !=
'') {
704 jQuery(
"#price_ht").val(
'');
705 jQuery(
"#price_ttc").val(
'');
708 jQuery(
"#multicurrency_price_ht").keyup(
function(event) {
710 if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery(
"#multicurrency_price_ht").val() !=
'') {
711 jQuery(
"#price_ht").val(
'');
712 jQuery(
"#price_ttc").val(
'');
716 $(
"#prod_entry_mode_free").on(
"click",
function() {
719 $(
"#select_type").change(
function()
723 if (jQuery(
'#select_type').val() >= 0) {
724 console.log(
"Set focus on description field");
726 jQuery(
'#dp_desc').focus();
728 if (typeof CKEDITOR ==
"object" && typeof CKEDITOR.instances !=
"undefined") {
729 var editor = CKEDITOR.instances[
'dp_desc'];
736 console.log(
"Hide/show date according to product type");
737 if (jQuery(
'#select_type').val() ==
'0')
739 jQuery(
'#trlinefordates').hide();
740 jQuery(
'.divlinefordates').hide();
744 jQuery(
'#trlinefordates').show();
745 jQuery(
'.divlinefordates').show();
749 $(
"#prod_entry_mode_predef").on(
"click",
function() {
750 console.log(
"click prod_entry_mode_predef");
752 jQuery(
'#trlinefordates').show();
756 if (!$freelines) { ?>
757 $(
"#prod_entry_mode_predef").click();
761 if (in_array($this->table_element_line, array(
'propaldet',
'commandedet',
'facturedet'))) { ?>
762 $(
"#date_start, #date_end").focusout(
function() {
763 let
type = $(
this).attr(
'type');
764 let mandatoryP = $(
this).attr(
'mandatoryperiod');
765 if (
type == 1 && mandatoryP == 1) {
766 if ($(
this).val() ==
'' && !$(
this).hasClass(
'inputmandatory')) {
767 $(
this).addClass(
'inputmandatory');
769 $(
this).removeClass(
'inputmandatory');
776 $(
"#idprod, #idprodfournprice").change(
function()
778 console.log(
"objectline_create.tpl Call method change() after change on #idprod or #idprodfournprice (senderissupplier=<?php echo $senderissupplier; ?>). this.val = "+$(
this).val());
782 jQuery(
'#trlinefordates').show();
785 if (!
getDolGlobalString(
'MAIN_DISABLE_EDIT_PREDEF_PRICEHT') && empty($senderissupplier)) {
787 var pbq = parseInt($(
'option:selected',
this).attr(
'data-pbq'));
788 if (isNaN(pbq)) { pbq = jQuery(
'#idprod').attr(
'data-pbq'); }
790 if ((jQuery(
'#idprod').val() > 0 || jQuery(
'#idprodfournprice').val()) && ! isNaN(pbq) && pbq > 0)
792 console.log(
"objectline_create.tpl We are in a price per qty context, we do not call ajax/product, init of fields is done few lines later");
795 if (isNaN(pbq)) { console.log(
"We use experimental option PRODUIT_CUSTOMER_PRICES_BY_QTY or PRODUIT_CUSTOMER_PRICES_BY_QTY but we could not get the id of pbq from product combo list, so load of price may be 0 if product has differet prices"); }
798 console.log(
"Load unit price and set it into #price_ht or #price_ttc for product id="+$(
this).val()+
" socid=<?php print $object->socid; ?>");
799 $.post(
'<?php echo DOL_URL_ROOT; ?>/product/ajax/products.php?action=fetch',
800 {
'id': $(
this).val(),
'socid': <?php print $object->socid; ?>,
'token':
'<?php print currentToken(); ?>',
'addalsovatforthirdpartyid': 1 },
802 console.log(
"objectline_create.tpl Load unit price ends, we got value ht="+data.price_ht+
" ttc="+data.price_ttc+
" pricebasetype="+data.pricebasetype);
804 $(
'#date_start').removeAttr(
'type');
805 $(
'#date_end').removeAttr(
'type');
806 $(
'#date_start').attr(
'type', data.type);
807 $(
'#date_end').attr(
'type', data.type);
809 $(
'#date_start').removeAttr(
'mandatoryperiod');
810 $(
'#date_end').removeAttr(
'mandatoryperiod');
811 $(
'#date_start').attr(
'mandatoryperiod', data.mandatory_period);
812 $(
'#date_end').attr(
'mandatoryperiod', data.mandatory_period);
815 if (data.mandatory_period == 1 && data.type == 1) {
816 jQuery(
'#date_start').addClass(
'inputmandatory');
817 jQuery(
'#date_end').addClass(
'inputmandatory');
819 jQuery(
'#date_start').removeClass(
'inputmandatory');
820 jQuery(
'#date_end').removeClass(
'inputmandatory');
823 if (<?php echo (
int) $inputalsopricewithtax; ?> == 1 && data.pricebasetype ==
'TTC' && <?php print
getDolGlobalInt(
'MAIN_NO_INPUT_PRICE_WITH_TAX') ?
'false' :
'true'; ?>) {
824 console.log(
"objectline_create.tpl set content of price_ttc");
825 jQuery(
"#price_ttc").val(data.price_ttc);
827 console.log(
"objectline_create.tpl set content of price_ht");
828 jQuery(
"#price_ht").val(data.price_ht);
831 var tva_tx = data.tva_tx;
832 var default_vat_code = data.default_vat_code;
835 var stringforvatrateselection = tva_tx;
836 if (typeof default_vat_code !=
'undefined' && default_vat_code !=
null && default_vat_code !=
'') {
837 stringforvatrateselection = stringforvatrateselection+
' ('+default_vat_code+
')';
842 console.log(
"MAIN_SALETAX_AUTOSWITCH_I_CS_FOR_INDIA is on so we check if we need to autoswith the vat code");
843 console.log(
"mysoc->country_code=<?php echo $mysoc->country_code; ?> thirdparty->country_code=<?php echo $object->thirdparty->country_code; ?>");
844 new_default_vat_code = default_vat_code;
846 if ($mysoc->country_code ==
'IN' && !empty($object->thirdparty) && $object->thirdparty->country_code ==
'IN' && $mysoc->state_code == $object->thirdparty->state_code) {
849 console.log(
"Countries are both IN and states are same, so we revert I into CS in default_vat_code="+default_vat_code);
850 new_default_vat_code = default_vat_code.replace(/^I\-/,
'C+S-');
852 } elseif ($mysoc->country_code ==
'IN' && !empty($object->thirdparty) && $object->thirdparty->country_code ==
'IN' && $mysoc->state_code != $object->thirdparty->state_code) {
855 console.log(
"Countries are both IN and states differs, so we revert CS into I in default_vat_code="+default_vat_code);
856 new_default_vat_code = default_vat_code.replace(/^C\+S\-/,
'I-');
859 if (new_default_vat_code != default_vat_code && jQuery(
'#tva_tx option:contains("'+new_default_vat_code+
'")').val()) {
860 console.log(
"We found en entry into VAT with new default_vat_code, we will use it");
861 stringforvatrateselection = jQuery(
'#tva_tx option:contains("'+new_default_vat_code+
'")').val();
867 $(
'#tva_tx').val(tva_tx);
870 $(
'#tva_tx option').removeAttr(
'selected');
871 console.log(
"stringforvatrateselection="+stringforvatrateselection+
" -> value of option label for this key="+$(
'#tva_tx option[value="'+stringforvatrateselection+
'"]').val());
872 $(
'#tva_tx option[value="'+stringforvatrateselection+
'"]').prop(
'selected',
true);
877 var proddesc = data.desc_trans;
880 var proddesc = data.desc;
883 console.log(
"objectline_create.tpl Load desciption into text area : "+proddesc);
886 if (typeof CKEDITOR ==
"object" && typeof CKEDITOR.instances !=
"undefined")
888 var editor = CKEDITOR.instances[
'dp_desc'];
890 editor.setData(proddesc);
895 jQuery(
'#dp_desc').text(proddesc);
902 jQuery.each(data.array_options,
function( key, value ) {
903 jQuery(
'div[class*="det'+key.replace(
'options_',
'_extras_')+
'"] > #'+key).val(value);
914 if (!empty($usemargins) && $user->hasRight(
'margins',
'creer')) {
915 $langs->load(
'stocks'); ?>
918 $(
"#fournprice_predef").find(
"option").remove();
919 $(
"#fournprice_predef").hide();
920 $(
"#buying_price").val(
"").show();
923 var token =
'<?php echo currentToken(); ?>';
924 $.post(
'<?php echo DOL_URL_ROOT; ?>/fourn/ajax/getSupplierPrices.php?bestpricefirst=1', {
'idprod': $(
this).val(),
'token': token },
function(data) {
925 if (data && data.length > 0)
927 var options =
''; var defaultkey =
''; var defaultprice =
''; var bestpricefound = 0;
929 var bestpriceid = 0; var bestpricevalue = 0;
930 var pmppriceid = 0; var pmppricevalue = 0;
931 var costpriceid = 0; var costpricevalue = 0;
934 var defaultbuyprice =
'<?php
935 if (isset($conf->global->MARGIN_TYPE)) {
936 if (getDolGlobalString('MARGIN_TYPE
') == '1
') {
937 print 'bestsupplierprice
';
939 if (getDolGlobalString('MARGIN_TYPE
') == 'pmp
') {
942 if (getDolGlobalString('MARGIN_TYPE
') == 'costprice
') {
946 console.log(
"objectline_create.tpl we will set the field for margin. defaultbuyprice="+defaultbuyprice);
949 $(data).each(
function() {
951 if (this.
id !=
'pmpprice' && this.
id !=
'costprice')
954 this.price = parseFloat(this.price);
957 if (bestpricefound == 0 && this.price > 0) { defaultkey = this.id; defaultprice = this.
price; bestpriceid = this.id; bestpricevalue = this.
price; bestpricefound=1; }
959 if (this.
id ==
'pmpprice')
962 console.log(
"id="+this.
id+
"-price="+this.price);
963 if (
'pmp' == defaultbuyprice ||
'costprice' == defaultbuyprice)
965 if (this.price > 0) {
966 defaultkey = this.id; defaultprice = this.
price; pmppriceid = this.id; pmppricevalue = this.
price;
971 if (this.
id ==
'costprice')
974 console.log(
"id="+this.
id+
"-price="+this.price+
"-pmppricevalue="+pmppricevalue);
975 if (
'costprice' == defaultbuyprice)
977 if (this.price > 0) { defaultkey = this.id; defaultprice = this.
price; costpriceid = this.id; costpricevalue = this.
price; }
978 else if (pmppricevalue > 0) { defaultkey =
'pmpprice'; defaultprice = pmppricevalue; }
981 options +=
'<option value="'+this.
id+
'" price="'+this.price+
'">'+this.label+
'</option>';
983 options +=
'<option value="inputprice" price="'+defaultprice+
'"><?php echo dol_escape_js($langs->trans("InputPrice").'...
'); ?></option>';
985 console.log(
"finally selected defaultkey="+defaultkey+
" defaultprice for buying price="+defaultprice);
987 $(
"#fournprice_predef").html(options).show();
988 if (defaultkey !=
'')
990 $(
"#fournprice_predef").val(defaultkey);
994 $(
"#buying_price").hide();
997 var defaultprice = $(
"#fournprice_predef").find(
'option:selected').attr(
"price");
998 $(
"#buying_price").val(defaultprice);
1000 $(
"#fournprice_predef").change(
function() {
1001 console.log(
"change on fournprice_predef");
1003 var linevalue=$(
this).find(
'option:selected').val();
1004 var pricevalue = $(
this).find(
'option:selected').attr(
"price");
1005 if (linevalue !=
'inputprice' && linevalue !=
'pmpprice') {
1006 $(
"#buying_price").val(pricevalue).hide();
1008 if (linevalue ==
'inputprice') {
1009 $(
'#buying_price').show();
1011 if (linevalue ==
'pmpprice') {
1012 $(
"#buying_price").val(pricevalue);
1013 $(
'#buying_price').hide();
1028 var pbq = parseInt($(
'option:selected',
this).attr(
'data-pbq'));
1029 if (isNaN(pbq)) { pbq = jQuery(
'#idprod').attr(
'data-pbq'); }
1030 var pbqup = parseFloat($(
'option:selected',
this).attr(
'data-pbqup'));
1031 if (isNaN(pbqup)) { pbqup = jQuery(
'#idprod').attr(
'data-pbqup'); }
1032 var pbqbase = $(
'option:selected',
this).attr(
'data-pbqbase');
1033 if (isNaN(pbqbase)) { pbqbase = jQuery(
'#idprod').attr(
'data-pbqbase'); }
1034 var pbqqty = parseFloat($(
'option:selected',
this).attr(
'data-pbqqty'));
1035 if (isNaN(pbqqty)) { pbqqty = jQuery(
'#idprod').attr(
'data-pbqqty'); }
1036 var pbqpercent = parseFloat($(
'option:selected',
this).attr(
'data-pbqpercent'));
1037 if (isNaN(pbqpercent)) { pbqpercent = jQuery(
'#idprod').attr(
'data-pbqpercent'); }
1039 if ((jQuery(
'#idprod').val() > 0) && ! isNaN(pbq) && pbq > 0)
1041 var pbqupht = pbqup;
1043 console.log(
"We choose a price by quanty price_by_qty id = "+pbq+
" price_by_qty upht = "+pbqupht+
" price_by_qty qty = "+pbqqty+
" price_by_qty percent = "+pbqpercent);
1044 jQuery(
"#pbq").val(pbq);
1045 jQuery(
"#price_ht").val(pbqupht);
1046 if (jQuery(
"#qty").val() < pbqqty)
1048 jQuery(
"#qty").val(pbqqty);
1050 if (jQuery(
"#remise_percent").val() < pbqpercent)
1052 jQuery(
"#remise_percent").val(pbqpercent);
1054 }
else { jQuery(
"#pbq").val(
''); }
1061 if (jQuery(
'#idprodfournprice').val() > 0)
1063 console.log(
"objectline_create.tpl #idprodfournprice is an ID > 0, so we set some properties into page");
1065 var up = parseFloat($(
'option:selected',
this).attr(
'data-up'));
1066 if (isNaN(up)) { up = parseFloat(jQuery(
'#idprodfournprice').attr(
'data-up'));}
1068 var up_locale = $(
'option:selected',
this).attr(
'data-up-locale');
1069 if (typeof up_locale ===
'undefined') { up_locale = jQuery(
'#idprodfournprice').attr(
'data-up-locale');}
1071 var qty = parseFloat($(
'option:selected',
this).attr(
'data-qty'));
1072 if (isNaN(qty)) { qty = parseFloat(jQuery(
'#idprodfournprice').attr(
'data-qty'));}
1074 var discount = parseFloat($(
'option:selected',
this).attr(
'data-discount'));
1075 if (isNaN(discount)) { discount = parseFloat(jQuery(
'#idprodfournprice').attr(
'data-discount'));}
1077 var tva_tx = parseFloat($(
'option:selected',
this).attr(
'data-tvatx'));
1078 if (isNaN(tva_tx)) { tva_tx = parseFloat(jQuery(
'#idprodfournprice').attr(
'data-tvatx'));}
1080 var default_vat_code = $(
'option:selected',
this).attr(
'data-default-vat-code');
1081 if (typeof default_vat_code ===
'undefined') { default_vat_code = jQuery(
'#idprodfournprice').attr(
'data-default-vat-code');}
1083 var stringforvatrateselection = tva_tx;
1084 if (typeof default_vat_code !=
'undefined' && default_vat_code !=
null && default_vat_code !=
'') {
1085 stringforvatrateselection = stringforvatrateselection+
' ('+default_vat_code+
')';
1088 var supplier_ref = $(
'option:selected',
this).attr(
'data-supplier-ref');
1089 if (typeof supplier_ref ===
'undefined') { supplier_ref = jQuery(
'#idprodfournprice').attr(
'data-supplier-ref');}
1091 var has_multicurrency_up =
false;
1093 if (isModEnabled(
'multicurrency') && $object->multicurrency_code != $conf->currency) {
1095 var object_multicurrency_code =
'<?php print dol_escape_js($object->multicurrency_code); ?>';
1097 var multicurrency_code = $(
'option:selected',
this).attr(
'data-multicurrency-code');
1098 if (multicurrency_code == undefined) { multicurrency_code = jQuery(
'#idprodfournprice').attr(
'data-multicurrency-code'); }
1100 var multicurrency_up = parseFloat($(
'option:selected',
this).attr(
'data-multicurrency-unitprice'));
1101 if (isNaN(multicurrency_up)) { multicurrency_up = parseFloat(jQuery(
'#idprodfournprice').attr(
'data-multicurrency-unitprice')); }
1103 if (multicurrency_code == object_multicurrency_code) {
1104 has_multicurrency_up =
true;
1105 jQuery(
"#multicurrency_price_ht").val(multicurrency_up);
1108 console.log(
"objectline_create.tpl Multicurrency values : object_multicurrency_code = "+object_multicurrency_code+
", multicurrency_code = "+multicurrency_code+
", multicurrency_up = "+multicurrency_up);
1113 console.log(
"objectline_create.tpl We find supplier price : up = "+up+
", up_locale = "+up_locale+
", has_multicurrency_up = "+has_multicurrency_up+
", supplier_ref = "+supplier_ref+
" qty = "+qty+
", tva_tx = "+tva_tx+
", default_vat_code = "+default_vat_code+
", stringforvatrateselection="+stringforvatrateselection+
", discount = "+discount+
" for product supplier ref id = "+jQuery(
'#idprodfournprice').val());
1115 if (has_multicurrency_up ===
false) {
1116 if (typeof up_locale ===
'undefined') {
1117 jQuery(
"#price_ht").val(up);
1119 jQuery(
"#price_ht").val(up_locale);
1124 $(
'#fourn_ref').val(supplier_ref);
1126 $(
'#tva_tx').val(tva_tx);
1129 $(
'#tva_tx option').removeAttr(
'selected');
1130 console.log(
"stringforvatrateselection="+stringforvatrateselection+
" -> value of option label for this key="+$(
'#tva_tx option[value="'+stringforvatrateselection+
'"]').val());
1131 $(
'#tva_tx option[value="'+stringforvatrateselection+
'"]').prop(
'selected',
true);
1133 if (jQuery(
"#qty").val() < qty) {
1134 jQuery(
"#qty").val(qty);
1136 if (jQuery(
"#remise_percent").val() < discount) {
1137 jQuery(
"#remise_percent").val(discount);
1143 var
description = $(
'option:selected',
this).attr(
'data-description');
1144 if (typeof
description ==
'undefined') {
description = jQuery(
'#idprodfournprice').attr(
'data-description'); }
1146 console.log(
"Load desciption into text area : "+
description);
1150 if (typeof CKEDITOR ==
"object" && typeof CKEDITOR.instances !=
"undefined")
1152 var editor = CKEDITOR.instances[
'dp_desc'];
1165 }
else if (jQuery(
'#idprodfournprice').length > 0) {
1166 console.log(
"objectline_create.tpl #idprodfournprice is not an int but is a string so we set only few properties into page");
1168 var tva_tx = parseFloat($(
'option:selected',
this).attr(
'data-tvatx'));
1169 if (isNaN(tva_tx)) { tva_tx = parseFloat(jQuery(
'#idprodfournprice').attr(
'data-tvatx'));}
1171 var default_vat_code = $(
'option:selected',
this).attr(
'data-default-vat-code');
1172 if (typeof default_vat_code ===
'undefined') { default_vat_code = jQuery(
'#idprodfournprice').attr(
'data-default-vat-code');}
1174 var stringforvatrateselection = tva_tx;
1175 if (typeof default_vat_code !=
'undefined' && default_vat_code !=
null && default_vat_code !=
'') {
1176 stringforvatrateselection = stringforvatrateselection+
' ('+default_vat_code+
')';
1179 console.log(
"objectline_create.tpl We find data for price : tva_tx = "+tva_tx+
", default_vat_code = "+default_vat_code+
", stringforvatrateselection="+stringforvatrateselection+
" for product id = "+jQuery(
'#idprodfournprice').val());
1182 $(
'#tva_tx').val(tva_tx);
1185 $(
'#tva_tx option').removeAttr(
'selected');
1186 console.log(
"stringforvatrateselection="+stringforvatrateselection+
" -> value of option label for this key="+$(
'#tva_tx option[value="'+stringforvatrateselection+
'"]').val());
1187 $(
'#tva_tx option[value="'+stringforvatrateselection+
'"]').prop(
'selected',
true);
1192 if (typeof CKEDITOR ==
"object" && typeof CKEDITOR.instances !=
"undefined")
1194 var editor = CKEDITOR.instances[
'dp_desc'];
1202 jQuery(
'#dp_desc').text(
'');
1211 if (jQuery(
'#idprod').val() > 0 || jQuery(
'#idprodfournprice').val() > 0)
1214 jQuery(
'#dp_desc').focus();
1216 if (typeof CKEDITOR ==
"object" && typeof CKEDITOR.instances !=
"undefined")
1218 var editor = CKEDITOR.instances[
'dp_desc'];
1219 if (editor) { editor.focus(); }
1224 <?php
if (
GETPOST(
'prod_entry_mode') ==
'predef') {
1230 function setforfree() {
1231 console.log(
"objectline_create.tpl::setforfree. We show most fields");
1232 jQuery(
"#idprodfournprice").val(
'0');
1233 jQuery(
"#prod_entry_mode_free").prop(
'checked',
true).change();
1234 jQuery(
"#prod_entry_mode_predef").prop(
'checked',
false).change();
1235 jQuery(
"#search_idprod, #idprod, #search_idprodfournprice, #buying_price").val(
'');
1236 jQuery(
"#price_ht, #multicurrency_price_ht, #price_ttc, #multicurrency_price_ttc, #fourn_ref, #tva_tx, #buying_price, #title_fourn_ref, #title_vat, #title_up_ht, #title_up_ht_currency, #title_up_ttc, #title_up_ttc_currency").show();
1237 jQuery(
"#np_marginRate, #np_markRate, .np_marginRate, .np_markRate, #units, #title_units").show();
1238 jQuery(
"#fournprice_predef").hide();
1241 function setforpredef() {
1242 console.log(
"objectline_create.tpl::setforpredef We hide some fields, show dates");
1243 jQuery(
"#select_type").val(-1);
1244 jQuery(
"#prod_entry_mode_free").prop(
'checked',
false).change();
1245 jQuery(
"#prod_entry_mode_predef").prop(
'checked',
true).change();
1247 jQuery(
"#price_ht").val(
'').show();
1248 jQuery(
"#multicurrency_price_ht").val(
'').show();
1249 jQuery(
"#title_up_ht, #title_up_ht_currency").show();
1252 jQuery(
"#multicurrency_price_ht").val(
'').hide();
1253 jQuery(
"#title_up_ht, #title_up_ht_currency").hide();
1256 jQuery(
"#price_ttc").val(
'').show();
1257 jQuery(
"#multicurrency_price_ttc").val(
'').show();
1258 jQuery(
"#title_up_ttc, #title_up_ttc_currency").show();
1260 jQuery(
"#price_ttc").val(
'').hide();
1261 jQuery(
"#multicurrency_price_ttc").val(
'').hide();
1262 jQuery(
"#title_up_ttc, #title_up_ttc_currency").hide();
1266 jQuery(
"#np_marginRate, #np_markRate, .np_marginRate, .np_markRate, #units, #title_units").hide();
1267 jQuery(
"#buying_price").show();
1268 jQuery(
'#trlinefordates, .divlinefordates').show();
1275print
"<!-- END PHP TEMPLATE objectline_create.tpl.php -->\n";
Class to manage line orders.
Class to manage lines of contracts.
Class to manage a WYSIWYG editor.
Class to manage supplier invoice lines of templates.
Class to manage invoice lines.
Class to manage invoice lines of templates.
Class to manage order lines.
const TYPE_SERVICE
Service.
Class to manage commercial proposal lines.
Class to manage line invoices.
Class to manage supplier_proposal lines.
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $disabled='', $morecss='classlink button bordertransp', $jsonopen='', $backtopagejsfields='', $accesskey='')
Return HTML code to output a button to open a dialog popup box.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
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.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
price2numjs(amount)
Function similar to PHP price2num()
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
$conf db name
Only used if Module[ID]Name translation string is not found.