49 print
"Error: this template page cannot be called directly as an URL";
53'@phan-var-force CommonObject $this
54 @phan-var-force CommonObject $object';
57if (isModEnabled(
'margin') && !empty(
$object->element) && in_array(
$object->element, array(
'facture',
'facturerec',
'propal',
'commande'))) {
60if (!isset($dateSelector)) {
63global $forceall, $forcetoshowtitlelines, $senderissupplier, $inputalsopricewithtax;
66if (!isset($dateSelector)) {
68} elseif (empty($dateSelector)) {
71if (empty($forceall)) {
74if (empty($senderissupplier)) {
75 $senderissupplier = 0;
77if (empty($inputalsopricewithtax)) {
78 $inputalsopricewithtax = 0;
82if (isModEnabled(
"multicurrency") && $this->multicurrency_code !=
$conf->currency) {
85if (in_array(
$object->element, array(
'propal',
'commande',
'order',
'facture',
'facturerec',
'invoice',
'supplier_proposal',
'order_supplier',
'invoice_supplier',
'invoice_supplier_rec'))) {
88if (isModEnabled(
'asset') &&
$object->element ==
'invoice_supplier') {
95if (!empty($extrafields)) {
96 if ($this->table_element_line ==
'commandedet') {
98 } elseif ($this->table_element_line ==
'propaldet') {
100 } elseif ($this->table_element_line ==
'supplier_proposaldet') {
102 } elseif ($this->table_element_line ==
'facturedet') {
104 } elseif ($this->table_element_line ==
'contratdet') {
106 } elseif ($this->table_element_line ==
'commande_fournisseurdet') {
108 } elseif ($this->table_element_line ==
'facture_fourn_det') {
110 } elseif ($this->table_element_line ==
'facturedet_rec') {
112 } elseif ($this->table_element_line ==
'facture_fourn_det_rec') {
116print
"<!-- BEGIN PHP TEMPLATE objectline_create.tpl.php -->\n";
117$nolinesbefore = (count($this->lines) == 0 || $forcetoshowtitlelines);
120 <tr
class=
"liste_titre<?php echo(($nolinesbefore || $object->element == 'contrat') ? '' : ' liste_titre_add_') ?> nodrag nodrop">
122 <td
class=
"linecolnum center"></td>
124 <td
class=
"linecoldescription minwidth400imp">
125 <div
id=
"add"></div><span
class=
"hideonsmartphone"><?php echo $langs->trans(
'AddNewLine'); ?></span>
128 if (
$object->element ==
'supplier_proposal' ||
$object->element ==
'order_supplier' ||
$object->element ==
'invoice_supplier' ||
$object->element ==
'invoice_supplier_rec') {
130 <td
class=
"linecolrefsupplier"><span
id=
"title_fourn_ref"><?php echo $langs->trans(
'SupplierRef'); ?></span></td>
133 <td
class=
"linecolvat right"><span
id=
"title_vat"><?php echo $langs->trans(
'VAT'); ?></span></td>
134 <td
class=
"linecoluht right"><span
id=
"title_up_ht"><?php echo $langs->trans(
'PriceUHT'); ?></span></td>
135 <?php
if (isModEnabled(
"multicurrency") && $this->multicurrency_code !=
$conf->currency) { ?>
136 <td
class=
"linecoluht_currency right"><span
id=
"title_up_ht_currency"><?php echo $langs->trans(
'PriceUHTCurrency'); ?></span></td>
138 <?php
if (!empty($inputalsopricewithtax) && !
getDolGlobalInt(
'MAIN_NO_INPUT_PRICE_WITH_TAX')) { ?>
139 <td
class=
"linecoluttc right"><span
id=
"title_up_ttc"><?php echo $langs->trans(
'PriceUTTC'); ?></span></td>
141 <td
class=
"linecolqty right"><?php echo $langs->trans(
'Qty'); ?></td>
144 print
'<td class="linecoluseunit left">';
145 print
'<span id="title_units">';
146 print $langs->trans(
'Unit');
147 print
'</span></td>';
149 <td
class=
"linecoldiscount right"><?php echo $langs->trans(
'ReductionShort'); ?></td>
152 if (isset($this->situation_cycle_ref) && $this->situation_cycle_ref) {
153 print
'<td class="linecolcycleref right">'.$langs->trans(
'Progress').
'</td>';
155 print
'<td class="nobottom nowrap right"></td>';
157 print
'<td class="linecolcycleref2 right"></td>';
159 if (!empty($usemargins)) {
160 if (!$user->hasRight(
'margins',
'creer')) {
163 print
'<td class="margininfos linecolmargin1 right">';
165 echo $langs->trans(
'BuyingPrice');
167 echo $langs->trans(
'CostPrice');
171 echo
'<td class="margininfos linecolmargin2 right"><span class="np_marginRate">'.$langs->trans(
'MarginRate').
'</span></td>';
174 echo
'<td class="margininfos linecolmark1 right"><span class="np_markRate">'.$langs->trans(
'MarkRate').
'</span></td>';
178 <td
class=
"linecoledit" colspan=
"<?php echo $colspan; ?>"> </td>
183<tr
class=
"pair nodrag nodrop nohoverpair<?php echo ($nolinesbefore || $object->element == 'contrat') ? '' : ' liste_titre_create'; ?>">
189 echo
'<td class="nobottom linecolnum center"></td>';
193 <td
class=
"nobottom linecoldescription minwidth400imp">
199 if (
$object->element ==
'contrat') {
200 if (!isModEnabled(
'product') && !isModEnabled(
'service') && !
getDolGlobalString(
'CONTRACT_SUPPORT_PRODUCTS')) {
209 print
'<span class="prod_entry_mode_free">';
211 if ($forceall >= 0 && (isModEnabled(
"product") || isModEnabled(
"service"))) {
212 print
'<label for="prod_entry_mode_free">';
213 print
'<input type="radio" class="prod_entry_mode_free" name="prod_entry_mode" id="prod_entry_mode_free" value="free"';
215 print((
GETPOST(
'prod_entry_mode',
'alpha') ==
'free' ||
getDolGlobalString(
'MAIN_FREE_PRODUCT_CHECKED_BY_DEFAULT')) ?
' checked' :
'');
219 $labelforempty = $langs->trans(
"FreeLineOfType");
223 echo
'<input type="hidden" id="prod_entry_mode_free" name="prod_entry_mode" value="free">';
225 if ($forceall >= 0) {
226 if (!isModEnabled(
'product') || !isModEnabled(
'service')) {
227 $labelforempty = $langs->trans(
"Type");
229 $labelforempty = $langs->trans(
"FreeLineOfType");
235 $form->select_type_of_lines(GETPOSTISSET(
"type") ?
GETPOST(
"type",
'alpha', 2) : -1,
'type', $labelforempty, 1, $forceall,
'');
239 if (isModEnabled(
"product") || isModEnabled(
"service")) {
240 print
'<span class="nowraponall">';
241 if ($forceall >= 0 && $freelines) {
242 print
'<br><span class="prod_entry_mode_predef paddingtop">';
244 print
'<span class="prod_entry_mode_predef">';
246 print
'<label for="prod_entry_mode_predef">';
247 print
'<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' :
'').
'> ';
249 if (empty(
$conf->dol_optimize_smallscreen)) {
250 if (isModEnabled(
"product") && !isModEnabled(
'service')) {
251 $labelforradio = $langs->trans(
'PredefinedProducts');
252 } elseif ((!isModEnabled(
'product') && isModEnabled(
'service')) || (
$object->element ==
'contrat' && !
getDolGlobalString(
'CONTRACT_SUPPORT_PRODUCTS'))) {
253 $labelforradio = $langs->trans(
'PredefinedServices');
255 $labelforradio = $langs->trans(
'PredefinedProductsAndServices');
258 $labelforradio = $langs->trans(
'PredefinedItem');
260 if (empty($senderissupplier)) {
269 if (empty($senderissupplier)) {
271 $statuswarehouse =
'warehouseopen,warehouseinternal';
273 $statuswarehouse =
'warehouseopen';
277 $form->select_produits(
GETPOST(
'idprod'),
'idprod', $filtertype,
getDolGlobalInt(
'PRODUIT_LIMIT_SIZE'), $buyer->price_level, $statustoshow, 2,
'', 1, array(), $buyer->id, $labelforradio, 0,
'maxwidth500 widthcentpercentminusx', 0, $statuswarehouse,
GETPOST(
'combinations',
'array'));
279 $form->select_produits(
GETPOST(
'idprod'),
'idprod', $filtertype,
getDolGlobalInt(
'PRODUIT_LIMIT_SIZE'), $buyer->price_level, $statustoshow, 2,
'', 1, array(), $buyer->id, $labelforradio, 0,
'maxwidth500 widthcentpercentminusx', 0,
'',
GETPOST(
'combinations',
'array'));
284 $(document).ready(
function(){
286 $(document).on(
'focus',
'.select2-selection.select2-selection--single',
function (e) {
287 console.log(
'focus on a select2');
288 if ($(
this).attr(
'aria-labelledby') ==
'select2-idprod-container')
290 console.log(
'open combo');
291 $(
'#idprod').select2(
'open');
300 if ($senderissupplier != 2) {
301 $ajaxoptions = array(
302 'update' => array(
'qty' =>
'qty',
'remise_percent' =>
'discount',
'idprod' =>
'idprod'),
303 'option_disabled' =>
'idthatdoesnotexists',
304 'warning' => $langs->trans(
"NoPriceDefinedForThisSupplier")
306 $alsoproductwithnosupplierprice = 0;
308 $ajaxoptions = array(
313 $alsoproductwithnosupplierprice = 1;
316 $form->select_produits_fournisseurs(
$object->socid,
GETPOST(
'idprodfournprice'),
'idprodfournprice',
'',
'', $ajaxoptions, 1, $alsoproductwithnosupplierprice,
'minwidth100 maxwidth500 widthcentpercentminusx', $labelforradio);
321 $(document).ready(
function(){
323 $(document).on(
'focus',
'.select2-selection.select2-selection--single',
function (e) {
325 if ($(
this).attr(
'aria-labelledby') ==
'select2-idprodfournprice-container')
327 $(
'#idprodfournprice').select2(
'open');
338 $addproducton = (isModEnabled(
'product') && $user->hasRight(
'produit',
'creer'));
339 $addserviceon = (isModEnabled(
'service') && $user->hasRight(
'service',
'creer'));
340 if ($addproducton || $addserviceon) {
341 if ($addproducton && $addserviceon) {
342 echo
'<div id="dropdownAddProductAndService" class="dropdown inline-block">';
343 echo
'<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" id="dropdownAddProductAndServiceLink" aria-haspopup="true" aria-expanded="false">';
344 echo
'<span class="fa fa-plus-circle valignmiddle paddingleft"></span>';
346 echo
'<div class="dropdown-menu" aria-labelledby="dropdownAddProductAndServiceLink" style="top:auto; left:auto;">';
347 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>';
348 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>';
353 $url =
'/product/card.php?leftmenu=product&action=create&type=0&backtopage='.urlencode($_SERVER[
"PHP_SELF"]);
354 $newbutton =
'<span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans(
"NewProduct").
'"></span>';
357 $tmpbacktopagejsfields =
'addproduct:id,search_id';
361 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>';
365 $url =
'/product/card.php?leftmenu=product&action=create&type=1&backtopage='.urlencode($_SERVER[
"PHP_SELF"]);
366 $newbutton =
'<span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans(
"NewService").
'"></span>';
369 $tmpbacktopagejsfields =
'addproduct:id,search_id';
373 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>';
381 $(document).ready(
function(){
382 $(
"#dropdownAddProductAndService .dropdown-toggle").on(
"click",
function(event) {
383 console.log(
"toggle addproduct dropdown");
384 event.preventDefault();
385 $(
"#dropdownAddProductAndService").toggleClass(
"open");
391 echo
'<input type="hidden" name="pbq" id="pbq" value="">';
396 echo
'<br>'.$langs->trans(
'AddLineOnPosition').
' : <input type="number" name="rank" step="1" min="0" style="width: 5em;">';
399 if (is_object($hookmanager) && empty($senderissupplier)) {
400 $parameters = array(
'fk_parent_line' =>
GETPOSTINT(
'fk_parent_line'));
401 $reshook = $hookmanager->executeHooks(
'formCreateProductOptions', $parameters,
$object, $action);
402 if (!empty($hookmanager->resPrint)) {
403 print $hookmanager->resPrint;
406 if (is_object($hookmanager) && !empty($senderissupplier)) {
407 $parameters = array(
'htmlname' =>
'addproduct');
408 $reshook = $hookmanager->executeHooks(
'formCreateProductSupplierOptions', $parameters,
$object, $action);
409 if (!empty($hookmanager->resPrint)) {
410 print $hookmanager->resPrint;
413 if (isModEnabled(
"product") || isModEnabled(
"service")) {
415 if (isModEnabled(
'variants')) {
416 echo
'<div id="attributes_box"></div>';
420 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
426 $toolbarname =
'dolibarr_details';
428 $toolbarname =
'dolibarr_notes';
430 $doleditor =
new DolEditor(
'dp_desc',
GETPOST(
'dp_desc',
'restricthtml'),
'',
getDolGlobalInt(
'MAIN_DOLEDITOR_HEIGHT', 100), $toolbarname,
'',
false,
true, $enabled, $nbrows,
'98%');
431 $doleditor->Create();
433 if (isModEnabled(
"service") && (
$object->element ==
'facturerec' ||
$object->element ==
'invoice_supplier_rec')) {
434 echo
'<div class="divlinefordates"><br>';
435 echo $langs->trans(
'AutoFillDateFrom').
' ';
437 $line->date_start_fill = 1;
438 $line->date_end_fill = 1;
440 echo $form->selectyesno(
'date_start_fill', $line->date_start_fill, 1);
442 echo $langs->trans(
'AutoFillDateTo').
' ';
443 echo $form->selectyesno(
'date_end_fill', $line->date_end_fill, 1);
446 if (is_object($objectline)) {
447 $temps = $objectline->showOptionals($extrafields,
'create', array(),
'',
'', 1,
'line');
449 if (!empty($temps)) {
450 print
'<div style="padding-top: 10px" id="extrafield_lines_area_create" name="extrafield_lines_area_create">';
456 if (
$object->element ==
'supplier_proposal' ||
$object->element ==
'order_supplier' ||
$object->element ==
'invoice_supplier' ||
$object->element ==
'invoice_supplier_rec') {
458 <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>
461 print
'<td class="nobottom linecolvat right">';
463 if (
$object->element ==
'propal' ||
$object->element ==
'commande' ||
$object->element ==
'facture' ||
$object->element ==
'facturerec') {
465 } elseif (
$object->element ==
'supplier_proposal' ||
$object->element ==
'order_supplier' ||
$object->element ==
'invoice_supplier' ||
$object->element ==
'invoice_supplier_rec') {
468 if ($seller->tva_assuj ==
"0") {
469 echo
'<input type="hidden" name="tva_tx" id="tva_tx" value="0">'.vatrate(
'0',
true);
471 echo $form->load_tva(
'tva_tx', (GETPOSTISSET(
"tva_tx") ?
GETPOST(
"tva_tx",
'alpha', 2) : -1), $seller, $buyer, 0, 0,
'', false, 1, $type_tva);
476 <td
class=
"nobottom linecoluht right"><?php $coldisplay++; ?>
477 <input
type=
"text" name=
"price_ht" id=
"price_ht" class=
"flat right width50" value=
"<?php echo(GETPOSTISSET("price_ht
") ? GETPOST("price_ht
", 'alpha', 2) : ''); ?>">
481 if (isModEnabled(
"multicurrency") && $this->multicurrency_code !=
$conf->currency) {
483 <td
class=
"nobottom linecoluht_currency right">
484 <input
type=
"text" name=
"multicurrency_price_ht" id=
"multicurrency_price_ht" class=
"flat right width50" value=
"<?php echo(GETPOSTISSET("multicurrency_price_ht
") ? GETPOST("multicurrency_price_ht
", 'alpha', 2) : ''); ?>">
488 if (!empty($inputalsopricewithtax) && !
getDolGlobalInt(
'MAIN_NO_INPUT_PRICE_WITH_TAX')) {
490 <td
class=
"nobottom linecoluttc right">
491 <input
type=
"text" name=
"price_ttc" id=
"price_ttc" class=
"flat right width50" value=
"<?php echo(GETPOSTISSET("price_ttc
") ? GETPOST("price_ttc
", 'alpha', 2) : ''); ?>">
497 <td
class=
"nobottom linecolqty right">
498 <?php $default_qty = (!
getDolGlobalString(
'MAIN_OBJECTLINE_CREATE_EMPTY_QTY_BY_DEFAULT') ? 1 :
''); ?>
499 <input
type=
"text" name=
"qty" id=
"qty" class=
"flat width40 right" value=
"<?php echo(GETPOSTISSET("qty
") ? GETPOST("qty
", 'alpha', 2) : $default_qty); ?>">
504 print
'<td class="nobottom linecoluseunit left">';
505 print $form->selectUnits(empty($line->fk_unit) ?
$conf->global->PRODUCT_USE_UNITS : $line->fk_unit,
"units");
508 $remise_percent = $buyer->remise_percent;
509 if (
$object->element ==
'supplier_proposal' ||
$object->element ==
'order_supplier' ||
$object->element ==
'invoice_supplier') {
510 $remise_percent = $seller->remise_supplier_percent;
515 <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>
517 if (isset($this->situation_cycle_ref) && $this->situation_cycle_ref) {
519 print
'<td class="nobottom nowrap right"><input class="flat right" type="text" size="1" value="" name="progress"><span class="opacitymedium hideonsmartphone">%</span></td>';
522 print
'<td class="nobottom nowrap right"></td>';
527 if (!empty($usemargins)) {
528 if ($user->hasRight(
'margins',
'creer')) {
530 <td
class=
"nobottom margininfos linecolmargin right">
531 <!-- For predef product -->
532 <?php
if (isModEnabled(
"product") || isModEnabled(
"service")) { ?>
533 <select
id=
"fournprice_predef" name=
"fournprice_predef" class=
"flat minwidth75imp maxwidth150" style=
"display: none;"></select>
535 <!-- For free product -->
536 <input
type=
"text" id=
"buying_price" name=
"buying_price" class=
"flat maxwidth75 right" value=
"<?php echo(GETPOSTISSET("buying_price
") ? GETPOST("buying_price
", 'alpha', 2) : ''); ?>">
540 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>';
544 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>';
549 $coldisplay += $colspan;
551 <td
class=
"nobottom linecoledit center valignmiddle" colspan=
"<?php echo $colspan; ?>">
552 <input
type=
"submit" class=
"button reposition" value=
"<?php echo $langs->trans('Add'); ?>" name=
"addline" id=
"addline">
557if ((isModEnabled(
"service") || (
$object->element ==
'contrat')) && $dateSelector &&
GETPOST(
'type') !=
'0') {
558 print
'<tr id="trlinefordates" class="oddeven">'.
"\n";
562 print
'<td colspan="'.($coldisplay - (!
getDolGlobalString(
'MAIN_VIEW_LINE_NUMBER') ? 0 : 1)).
'">';
566 $prefillDates =
false;
569 for ($i = count(
$object->lines) - 1; $i >= 0; $i--) {
570 $lastline =
$object->lines[$i];
572 if ($lastline->product_type ==
Product::TYPE_SERVICE && (!empty($lastline->date_start) || !empty($lastline->date_end))) {
573 $date_start_prefill = $lastline->date_start;
574 $date_end_prefill = $lastline->date_end;
576 $prefillDates =
true;
583 print $langs->trans(
"DateStartPlanned").
' ';
584 print $form->selectDate($date_start,
"date_start", $usehm, $usehm, 1,
"addproduct");
585 print
' '.$langs->trans(
"DateEndPlanned").
' ';
586 print $form->selectDate($date_end,
"date_end", $usehm, $usehm, 1,
"addproduct");
588 print $langs->trans(
'ServiceLimitedDuration').
' '.$langs->trans(
'From').
' ';
589 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);
590 print
' '.$langs->trans(
'to').
' ';
591 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);
595 echo
' <span class="small"><a href="#" id="prefill_service_dates">'.$langs->trans(
'FillWithLastServiceDates').
'</a></span>';
602 function prefill_service_dates()
604 $(
'#date_start').val(
"<?php echo dol_escape_js(dol_print_date($date_start_prefill, 'day')); ?>").trigger(
'change');
605 $(
'#date_end').val(
"<?php echo dol_escape_js(dol_print_date($date_end_prefill, 'day')); ?>").trigger(
'change');
610 $(document).ready(
function()
612 $(
'#prefill_service_dates').click(prefill_service_dates);
619 if (isset(
$conf->global->MAIN_DEFAULT_DATE_START_HOUR)) {
620 print
'jQuery("#date_starthour").val("' .
getDolGlobalString(
'MAIN_DEFAULT_DATE_START_HOUR').
'");';
622 if (isset(
$conf->global->MAIN_DEFAULT_DATE_START_MIN)) {
623 print
'jQuery("#date_startmin").val("' .
getDolGlobalString(
'MAIN_DEFAULT_DATE_START_MIN').
'");';
627 if (isset(
$conf->global->MAIN_DEFAULT_DATE_END_HOUR)) {
628 print
'jQuery("#date_endhour").val("' .
getDolGlobalString(
'MAIN_DEFAULT_DATE_END_HOUR').
'");';
630 if (isset(
$conf->global->MAIN_DEFAULT_DATE_END_MIN)) {
631 print
'jQuery("#date_endmin").val("' .
getDolGlobalString(
'MAIN_DEFAULT_DATE_END_MIN').
'");';
641if (!empty($usemargins) && $user->hasRight(
'margins',
'creer')) {
644 jQuery(document).ready(
function() {
647 $(
"input[name='np_marginRate']:first").blur(
function(e) {
648 return checkFreeLine(e,
"np_marginRate");
653 $(
"input[name='np_markRate']:first").blur(
function(e) {
654 return checkFreeLine(e,
"np_markRate");
661 function checkFreeLine(e, npRate)
663 var buying_price = $(
"input[name='buying_price']:first");
664 var remise = $(
"input[name='remise_percent']:first");
666 var rate = $(
"input[name='"+npRate+
"']:first");
667 if (rate.val() ==
'')
670 if (! $.isNumeric(rate.val().replace(
',',
'.')))
672 alert(
'<?php echo dol_escape_js($langs->trans("rateMustBeNumeric")); ?>');
674 setTimeout(
function () { rate.focus() }, 50);
677 if (npRate ==
"np_markRate" && rate.val() >= 100)
679 alert(
'<?php echo dol_escape_js($langs->trans("markRateShouldBeLesserThan100")); ?>');
681 setTimeout(
function () { rate.focus() }, 50);
690 if (remisejs ==
'') remisejs=0;
695 if (npRate ==
"np_marginRate")
696 price = ((bpjs * (1 + ratejs / 100)) / (1 - remisejs / 100));
697 else if (npRate ==
"np_markRate")
698 price = ((bpjs / (1 - ratejs / 100)) / (1 - remisejs / 100));
701 $(
"input[name='price_ht']:first").val(
price);
711 jQuery(document).ready(
function() {
712 jQuery(
"#price_ht").keyup(
function(event) {
714 if (event.which != 9 && (event.which < 37 ||event.which > 40) && jQuery(
"#price_ht").val() !=
'') {
715 jQuery(
"#price_ttc").val(
'');
716 jQuery(
"#multicurrency_subprice").val(
'');
717 jQuery(
"#multicurrency_price_ht").val(
'');
720 jQuery(
"#price_ttc").keyup(
function(event) {
722 if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery(
"#price_ttc").val() !=
'') {
723 jQuery(
"#price_ht").val(
'');
724 jQuery(
"#multicurrency_subprice").val(
'');
725 jQuery(
"#multicurrency_price_ht").val(
'');
728 jQuery(
"#multicurrency_subprice").keyup(
function(event) {
730 if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery(
"#multicurrency_subprice").val() !=
'') {
731 jQuery(
"#price_ht").val(
'');
732 jQuery(
"#price_ttc").val(
'');
735 jQuery(
"#multicurrency_price_ht").keyup(
function(event) {
737 if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery(
"#multicurrency_price_ht").val() !=
'') {
738 jQuery(
"#price_ht").val(
'');
739 jQuery(
"#price_ttc").val(
'');
743 $(
"#prod_entry_mode_free").on(
"click",
function() {
746 $(
"#select_type").change(
function()
750 if (jQuery(
'#select_type').val() >= 0) {
751 console.log(
"Set focus on description field");
753 jQuery(
'#dp_desc').focus();
755 if (typeof CKEDITOR ==
"object" && typeof CKEDITOR.instances !=
"undefined") {
756 var editor = CKEDITOR.instances[
'dp_desc'];
763 console.log(
"Hide/show date according to product type");
764 if (jQuery(
'#select_type').val() ==
'0')
766 jQuery(
'#trlinefordates').hide();
767 jQuery(
'.divlinefordates').hide();
771 jQuery(
'#trlinefordates').show();
772 jQuery(
'.divlinefordates').show();
776 $(
"#prod_entry_mode_predef").on(
"click",
function() {
777 console.log(
"click prod_entry_mode_predef");
779 jQuery(
'#trlinefordates').show();
783 if (!$freelines) { ?>
784 $(
"#prod_entry_mode_predef").click();
788 if (in_array($this->table_element_line, array(
'propaldet',
'commandedet',
'facturedet'))) { ?>
789 $(
"#date_start, #date_end").focusout(
function() {
790 let
type = $(
this).attr(
'type');
791 let mandatoryP = $(
this).attr(
'mandatoryperiod');
792 if (
type == 1 && mandatoryP == 1) {
793 if ($(
this).val() ==
'' && !$(
this).hasClass(
'inputmandatory')) {
794 $(
this).addClass(
'inputmandatory');
796 $(
this).removeClass(
'inputmandatory');
803 $(
"#idprod, #idprodfournprice").change(
function()
805 console.log(
"objectline_create.tpl Call method change() after change on #idprod or #idprodfournprice (senderissupplier=<?php echo $senderissupplier; ?>). this.val = "+$(
this).val());
809 jQuery(
'#trlinefordates').show();
812 if (!
getDolGlobalString(
'MAIN_DISABLE_EDIT_PREDEF_PRICEHT') && empty($senderissupplier)) {
814 var pbq = parseInt($(
'option:selected',
this).attr(
'data-pbq'));
815 if (isNaN(pbq)) { pbq = jQuery(
'#idprod').attr(
'data-pbq'); }
817 if ((jQuery(
'#idprod').val() > 0 || jQuery(
'#idprodfournprice').val()) && ! isNaN(pbq) && pbq > 0)
819 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");
822 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 different prices"); }
825 console.log(
"Load unit price and set it into #price_ht or #price_ttc for product id="+$(
this).val()+
" socid=<?php print $object->socid; ?>");
826 $.post(
'<?php echo DOL_URL_ROOT; ?>/product/ajax/products.php?action=fetch',
827 {
'id': $(
this).val(),
'socid': <?php print
$object->socid; ?>,
'token':
'<?php print currentToken(); ?>',
'addalsovatforthirdpartyid': 1 },
829 console.log(
"objectline_create.tpl Load unit price ends, we got value ht="+data.price_ht+
" ttc="+data.price_ttc+
" pricebasetype="+data.pricebasetype);
831 $(
'#date_start').removeAttr(
'type');
832 $(
'#date_end').removeAttr(
'type');
833 $(
'#date_start').attr(
'type', data.type);
834 $(
'#date_end').attr(
'type', data.type);
836 $(
'#date_start').removeAttr(
'mandatoryperiod');
837 $(
'#date_end').removeAttr(
'mandatoryperiod');
838 $(
'#date_start').attr(
'mandatoryperiod', data.mandatory_period);
839 $(
'#date_end').attr(
'mandatoryperiod', data.mandatory_period);
842 if (data.mandatory_period == 1 && data.type == 1) {
843 jQuery(
'#date_start').addClass(
'inputmandatory');
844 jQuery(
'#date_end').addClass(
'inputmandatory');
846 jQuery(
'#date_start').removeClass(
'inputmandatory');
847 jQuery(
'#date_end').removeClass(
'inputmandatory');
850 if (<?php echo (
int) $inputalsopricewithtax; ?> == 1 && data.pricebasetype ==
'TTC' && <?php print
getDolGlobalInt(
'MAIN_NO_INPUT_PRICE_WITH_TAX') ?
'false' :
'true'; ?>) {
851 console.log(
"objectline_create.tpl set content of price_ttc");
852 jQuery(
"#price_ttc").val(data.price_ttc);
854 console.log(
"objectline_create.tpl set content of price_ht");
855 jQuery(
"#price_ht").val(data.price_ht);
859 for (var key in data.array_options) {
860 if (data.array_options.hasOwnProperty(key)) {
861 var field = jQuery(
"#" + key);
862 if(field.length > 0){
863 console.log(
"objectline_create.tpl set content of options_" + key);
864 field.val(data.array_options[key]);
869 var tva_tx = data.tva_tx;
870 var default_vat_code = data.default_vat_code;
873 var stringforvatrateselection = tva_tx;
874 if (typeof default_vat_code !=
'undefined' && default_vat_code !=
null && default_vat_code !=
'') {
875 stringforvatrateselection = stringforvatrateselection+
' ('+default_vat_code+
')';
880 console.log(
"MAIN_SALETAX_AUTOSWITCH_I_CS_FOR_INDIA is on so we check if we need to autoswith the vat code");
881 console.log(
"mysoc->country_code=<?php echo $mysoc->country_code; ?> thirdparty->country_code=<?php echo $object->thirdparty->country_code; ?>");
882 new_default_vat_code = default_vat_code;
884 if ($mysoc->country_code ==
'IN' && !empty(
$object->thirdparty) &&
$object->thirdparty->country_code ==
'IN' && $mysoc->state_code ==
$object->thirdparty->state_code) {
887 console.log(
"Countries are both IN and states are same, so we revert I into CS in default_vat_code="+default_vat_code);
888 new_default_vat_code = default_vat_code.replace(/^I\-/,
'C+S-');
890 } elseif ($mysoc->country_code ==
'IN' && !empty(
$object->thirdparty) &&
$object->thirdparty->country_code ==
'IN' && $mysoc->state_code !=
$object->thirdparty->state_code) {
893 console.log(
"Countries are both IN and states differs, so we revert CS into I in default_vat_code="+default_vat_code);
894 new_default_vat_code = default_vat_code.replace(/^C\+S\-/,
'I-');
897 if (new_default_vat_code != default_vat_code && jQuery(
'#tva_tx option:contains("'+new_default_vat_code+
'")').val()) {
898 console.log(
"We found en entry into VAT with new default_vat_code, we will use it");
899 stringforvatrateselection = jQuery(
'#tva_tx option:contains("'+new_default_vat_code+
'")').val();
905 $(
'#tva_tx').val(tva_tx);
908 $(
'#tva_tx option').removeAttr(
'selected');
909 console.log(
"stringforvatrateselection="+stringforvatrateselection+
" -> value of option label for this key="+$(
'#tva_tx option[value="'+stringforvatrateselection+
'"]').val());
910 $(
'#tva_tx option[value="'+stringforvatrateselection+
'"]').prop(
'selected',
true);
915 var proddesc = data.desc_trans;
918 var proddesc = data.desc;
921 console.log(
"objectline_create.tpl Load description into text area : "+proddesc);
924 if (typeof CKEDITOR ==
"object" && typeof CKEDITOR.instances !=
"undefined")
926 var editor = CKEDITOR.instances[
'dp_desc'];
928 editor.setData(proddesc);
933 jQuery(
'#dp_desc').text(proddesc);
940 jQuery.each(data.array_options,
function( key, value ) {
941 jQuery(
'div[class*="det'+key.replace(
'options_',
'_extras_')+
'"] > #'+key).val(value);
952 if (!empty($usemargins) && $user->hasRight(
'margins',
'creer')) {
953 $langs->load(
'stocks'); ?>
956 $(
"#fournprice_predef").find(
"option").remove();
957 $(
"#fournprice_predef").hide();
958 $(
"#buying_price").val(
"").show();
961 var token =
'<?php echo currentToken(); ?>';
962 $.post(
'<?php echo DOL_URL_ROOT; ?>/fourn/ajax/getSupplierPrices.php?bestpricefirst=1', {
'idprod': $(
this).val(),
'token': token },
function(data) {
963 if (data && data.length > 0)
965 var options =
''; var defaultkey =
''; var defaultprice =
''; var bestpricefound = 0;
967 var bestpriceid = 0; var bestpricevalue = 0;
968 var pmppriceid = 0; var pmppricevalue = 0;
969 var costpriceid = 0; var costpricevalue = 0;
972 var defaultbuyprice =
'<?php
973 if (isset($conf->global->MARGIN_TYPE)) {
974 if (getDolGlobalString('MARGIN_TYPE
') == '1
') {
975 print 'bestsupplierprice
';
977 if (getDolGlobalString('MARGIN_TYPE
') == 'pmp
') {
980 if (getDolGlobalString('MARGIN_TYPE
') == 'costprice
') {
984 console.log(
"objectline_create.tpl we will set the field for margin. defaultbuyprice="+defaultbuyprice);
987 $(data).each(
function() {
989 if (this.
id !=
'pmpprice' && this.
id !=
'costprice')
992 this.price = parseFloat(this.price);
995 if (bestpricefound == 0 && this.price > 0) { defaultkey = this.id; defaultprice = this.
price; bestpriceid = this.id; bestpricevalue = this.
price; bestpricefound=1; }
997 if (this.
id ==
'pmpprice')
1000 console.log(
"id="+this.
id+
"-price="+this.price);
1001 if (
'pmp' == defaultbuyprice ||
'costprice' == defaultbuyprice)
1003 if (this.price > 0) {
1004 defaultkey = this.id; defaultprice = this.
price; pmppriceid = this.id; pmppricevalue = this.
price;
1009 if (this.
id ==
'costprice')
1012 console.log(
"id="+this.
id+
"-price="+this.price+
"-pmppricevalue="+pmppricevalue);
1013 if (
'costprice' == defaultbuyprice)
1015 if (this.price > 0) { defaultkey = this.id; defaultprice = this.
price; costpriceid = this.id; costpricevalue = this.
price; }
1016 else if (pmppricevalue > 0) { defaultkey =
'pmpprice'; defaultprice = pmppricevalue; }
1019 options +=
'<option value="'+this.
id+
'" price="'+this.price+
'">'+this.label+
'</option>';
1021 options +=
'<option value="inputprice" price="'+defaultprice+
'"><?php echo dol_escape_js($langs->trans("InputPrice").'...
'); ?></option>';
1023 console.log(
"finally selected defaultkey="+defaultkey+
" defaultprice for buying price="+defaultprice);
1025 $(
"#fournprice_predef").html(options).show();
1026 if (defaultkey !=
'')
1028 $(
"#fournprice_predef").val(defaultkey);
1032 $(
"#buying_price").hide();
1035 var defaultprice = $(
"#fournprice_predef").find(
'option:selected').attr(
"price");
1036 $(
"#buying_price").val(defaultprice);
1038 $(
"#fournprice_predef").change(
function() {
1039 console.log(
"change on fournprice_predef");
1041 var linevalue=$(
this).find(
'option:selected').val();
1042 var pricevalue = $(
this).find(
'option:selected').attr(
"price");
1043 if (linevalue !=
'inputprice' && linevalue !=
'pmpprice') {
1044 $(
"#buying_price").val(pricevalue).hide();
1046 if (linevalue ==
'inputprice') {
1047 $(
'#buying_price').show();
1049 if (linevalue ==
'pmpprice') {
1050 $(
"#buying_price").val(pricevalue);
1051 $(
'#buying_price').hide();
1066 var pbq = parseInt($(
'option:selected',
this).attr(
'data-pbq'));
1067 if (isNaN(pbq)) { pbq = jQuery(
'#idprod').attr(
'data-pbq'); }
1068 var pbqup = parseFloat($(
'option:selected',
this).attr(
'data-pbqup'));
1069 if (isNaN(pbqup)) { pbqup = jQuery(
'#idprod').attr(
'data-pbqup'); }
1070 var pbqbase = $(
'option:selected',
this).attr(
'data-pbqbase');
1071 if (isNaN(pbqbase)) { pbqbase = jQuery(
'#idprod').attr(
'data-pbqbase'); }
1072 var pbqqty = parseFloat($(
'option:selected',
this).attr(
'data-pbqqty'));
1073 if (isNaN(pbqqty)) { pbqqty = jQuery(
'#idprod').attr(
'data-pbqqty'); }
1074 var pbqpercent = parseFloat($(
'option:selected',
this).attr(
'data-pbqpercent'));
1075 if (isNaN(pbqpercent)) { pbqpercent = jQuery(
'#idprod').attr(
'data-pbqpercent'); }
1077 if ((jQuery(
'#idprod').val() > 0) && ! isNaN(pbq) && pbq > 0)
1079 var pbqupht = pbqup;
1081 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);
1082 jQuery(
"#pbq").val(pbq);
1083 jQuery(
"#price_ht").val(pbqupht);
1084 if (jQuery(
"#qty").val() < pbqqty)
1086 jQuery(
"#qty").val(pbqqty);
1088 if (jQuery(
"#remise_percent").val() < pbqpercent)
1090 jQuery(
"#remise_percent").val(pbqpercent);
1092 }
else { jQuery(
"#pbq").val(
''); }
1099 if (jQuery(
'#idprodfournprice').val() > 0)
1101 console.log(
"objectline_create.tpl #idprodfournprice is an ID > 0, so we set some properties into page");
1103 var up = parseFloat($(
'option:selected',
this).attr(
'data-up'));
1104 if (isNaN(up)) { up = parseFloat(jQuery(
'#idprodfournprice').attr(
'data-up'));}
1106 var up_locale = $(
'option:selected',
this).attr(
'data-up-locale');
1107 if (typeof up_locale ===
'undefined') { up_locale = jQuery(
'#idprodfournprice').attr(
'data-up-locale');}
1109 var qty = parseFloat($(
'option:selected',
this).attr(
'data-qty'));
1110 if (isNaN(qty)) { qty = parseFloat(jQuery(
'#idprodfournprice').attr(
'data-qty'));}
1112 var discount = parseFloat($(
'option:selected',
this).attr(
'data-discount'));
1113 if (isNaN(discount)) { discount = parseFloat(jQuery(
'#idprodfournprice').attr(
'data-discount'));}
1115 var tva_tx = parseFloat($(
'option:selected',
this).attr(
'data-tvatx'));
1116 if (isNaN(tva_tx)) { tva_tx = parseFloat(jQuery(
'#idprodfournprice').attr(
'data-tvatx'));}
1118 var default_vat_code = $(
'option:selected',
this).attr(
'data-default-vat-code');
1119 if (typeof default_vat_code ===
'undefined') { default_vat_code = jQuery(
'#idprodfournprice').attr(
'data-default-vat-code');}
1121 var supplier_ref = $(
'option:selected',
this).attr(
'data-supplier-ref');
1122 if (typeof supplier_ref ===
'undefined') { supplier_ref = jQuery(
'#idprodfournprice').attr(
'data-supplier-ref'); }
1124 <?php
if ((
$object->element ==
'supplier_proposal' ||
$object->element ==
'order_supplier' ||
$object->element ==
'invoice_supplier' ||
$object->element ==
'invoice_supplier_rec') && !$seller->tva_assuj) { ?>
1127 default_vat_code =
null;
1131 var stringforvatrateselection = tva_tx;
1132 if (typeof default_vat_code !=
'undefined' && default_vat_code !=
null && default_vat_code !=
'') {
1133 stringforvatrateselection = stringforvatrateselection+
' ('+default_vat_code+
')';
1136 var has_multicurrency_up =
false;
1138 if (isModEnabled(
'multicurrency') &&
$object->multicurrency_code !=
$conf->currency) {
1140 var object_multicurrency_code =
'<?php print dol_escape_js($object->multicurrency_code); ?>';
1142 var multicurrency_code = $(
'option:selected',
this).attr(
'data-multicurrency-code');
1143 if (multicurrency_code == undefined) { multicurrency_code = jQuery(
'#idprodfournprice').attr(
'data-multicurrency-code'); }
1145 var multicurrency_up = parseFloat($(
'option:selected',
this).attr(
'data-multicurrency-unitprice'));
1146 if (isNaN(multicurrency_up)) { multicurrency_up = parseFloat(jQuery(
'#idprodfournprice').attr(
'data-multicurrency-unitprice')); }
1148 if (multicurrency_code == object_multicurrency_code) {
1149 has_multicurrency_up =
true;
1150 jQuery(
"#multicurrency_price_ht").val(multicurrency_up);
1153 console.log(
"objectline_create.tpl Multicurrency values : object_multicurrency_code = "+object_multicurrency_code+
", multicurrency_code = "+multicurrency_code+
", multicurrency_up = "+multicurrency_up);
1158 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());
1160 if (has_multicurrency_up ===
false) {
1161 if (typeof up_locale ===
'undefined') {
1162 jQuery(
"#price_ht").val(up);
1164 jQuery(
"#price_ht").val(up_locale);
1169 $(
'#fourn_ref').val(supplier_ref);
1171 $(
'#tva_tx').val(tva_tx);
1174 $(
'#tva_tx option').removeAttr(
'selected');
1175 console.log(
"stringforvatrateselection="+stringforvatrateselection+
" -> value of option label for this key="+$(
'#tva_tx option[value="'+stringforvatrateselection+
'"]').val());
1176 $(
'#tva_tx option[value="'+stringforvatrateselection+
'"]').prop(
'selected',
true);
1178 if (jQuery(
"#qty").val() < qty) {
1179 jQuery(
"#qty").val(qty);
1181 if (jQuery(
"#remise_percent").val() < discount) {
1182 jQuery(
"#remise_percent").val(discount);
1188 var
description = $(
'option:selected',
this).attr(
'data-description');
1189 if (typeof
description ==
'undefined') {
description = jQuery(
'#idprodfournprice').attr(
'data-description'); }
1191 console.log(
"Load description into text area : "+
description);
1195 if (typeof CKEDITOR ==
"object" && typeof CKEDITOR.instances !=
"undefined")
1197 var editor = CKEDITOR.instances[
'dp_desc'];
1210 }
else if (jQuery(
'#idprodfournprice').length > 0) {
1211 console.log(
"objectline_create.tpl #idprodfournprice is not an int but is a string so we set only few properties into page");
1213 var tva_tx = parseFloat($(
'option:selected',
this).attr(
'data-tvatx'));
1214 if (isNaN(tva_tx)) { tva_tx = parseFloat(jQuery(
'#idprodfournprice').attr(
'data-tvatx'));}
1216 var default_vat_code = $(
'option:selected',
this).attr(
'data-default-vat-code');
1217 if (typeof default_vat_code ===
'undefined') { default_vat_code = jQuery(
'#idprodfournprice').attr(
'data-default-vat-code');}
1219 var supplier_ref = $(
'option:selected',
this).attr(
'data-supplier-ref');
1220 if (typeof supplier_ref ===
'undefined') { supplier_ref = jQuery(
'#idprodfournprice').attr(
'data-supplier-ref'); }
1222 var stringforvatrateselection = tva_tx;
1223 if (typeof default_vat_code !=
'undefined' && default_vat_code !=
null && default_vat_code !=
'') {
1224 stringforvatrateselection = stringforvatrateselection+
' ('+default_vat_code+
')';
1228 console.log(
"objectline_create.tpl We find data for price : tva_tx = "+tva_tx+
", default_vat_code = "+default_vat_code+
", supplier_ref = "+supplier_ref+
", stringforvatrateselection="+stringforvatrateselection+
" for product id = "+jQuery(
'#idprodfournprice').val());
1231 $(
'#fourn_ref').val(supplier_ref);
1233 $(
'#tva_tx').val(tva_tx);
1236 $(
'#tva_tx option').removeAttr(
'selected');
1237 console.log(
"stringforvatrateselection="+stringforvatrateselection+
" -> value of option label for this key="+$(
'#tva_tx option[value="'+stringforvatrateselection+
'"]').val());
1238 $(
'#tva_tx option[value="'+stringforvatrateselection+
'"]').prop(
'selected',
true);
1243 if (typeof CKEDITOR ==
"object" && typeof CKEDITOR.instances !=
"undefined")
1245 var editor = CKEDITOR.instances[
'dp_desc'];
1253 jQuery(
'#dp_desc').text(
'');
1262 if (jQuery(
'#idprod').val() > 0 || jQuery(
'#idprodfournprice').val() > 0)
1265 jQuery(
'#dp_desc').focus();
1267 if (typeof CKEDITOR ==
"object" && typeof CKEDITOR.instances !=
"undefined")
1269 var editor = CKEDITOR.instances[
'dp_desc'];
1270 if (editor) { editor.focus(); }
1275 <?php
if (
GETPOST(
'prod_entry_mode') ==
'predef') {
1281 function setforfree() {
1282 console.log(
"objectline_create.tpl::setforfree. We show most fields");
1283 jQuery(
"#idprodfournprice").val(
'0');
1284 jQuery(
"#prod_entry_mode_free").prop(
'checked',
true).change();
1285 jQuery(
"#prod_entry_mode_predef").prop(
'checked',
false).change();
1286 jQuery(
"#search_idprod, #idprod, #search_idprodfournprice, #buying_price").val(
'');
1287 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();
1288 jQuery(
"#np_marginRate, #np_markRate, .np_marginRate, .np_markRate, #units, #title_units").show();
1289 jQuery(
"#fournprice_predef").hide();
1292 function setforpredef() {
1293 console.log(
"objectline_create.tpl::setforpredef We hide some fields, show dates");
1294 jQuery(
"#select_type").val(-1);
1295 jQuery(
"#prod_entry_mode_free").prop(
'checked',
false).change();
1296 jQuery(
"#prod_entry_mode_predef").prop(
'checked',
true).change();
1298 jQuery(
"#price_ht").val(
'').show();
1299 jQuery(
"#multicurrency_price_ht").val(
'').show();
1300 jQuery(
"#title_up_ht, #title_up_ht_currency").show();
1303 jQuery(
"#multicurrency_price_ht").val(
'').hide();
1304 jQuery(
"#title_up_ht, #title_up_ht_currency").hide();
1307 jQuery(
"#price_ttc").val(
'').show();
1308 jQuery(
"#multicurrency_price_ttc").val(
'').show();
1309 jQuery(
"#title_up_ttc, #title_up_ttc_currency").show();
1311 jQuery(
"#price_ttc").val(
'').hide();
1312 jQuery(
"#multicurrency_price_ttc").val(
'').hide();
1313 jQuery(
"#title_up_ttc, #title_up_ttc_currency").hide();
1318 jQuery(
"#np_marginRate, .np_marginRate").hide();
1321 jQuery(
"#np_markRate, .np_markRate").hide();
1323 jQuery(
"#units, #title_units").hide();
1324 jQuery(
"#buying_price").show();
1325 jQuery(
'#trlinefordates, .divlinefordates').show();
1332print
"<!-- END PHP TEMPLATE objectline_create.tpl.php -->\n";
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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 information (by default a local PHP server timestamp) Rep...
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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 a 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()
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.