41 print
"Error: this template page cannot be called directly as an URL";
45'@phan-var-force CommonObject $this
46 @phan-var-force CommonObject $object';
49if (isModEnabled(
'margin') && !empty(
$object->element) && in_array(
$object->element, array(
'facture',
'facturerec',
'propal',
'commande'))) {
52if (!isset($dateSelector)) {
55global $forceall, $forcetoshowtitlelines, $senderissupplier, $inputalsopricewithtax;
58if (!isset($dateSelector)) {
60} elseif (empty($dateSelector)) {
63if (empty($forceall)) {
66if (empty($senderissupplier)) {
67 $senderissupplier = 0;
69if (empty($inputalsopricewithtax)) {
70 $inputalsopricewithtax = 0;
74if (isModEnabled(
"multicurrency") && $this->multicurrency_code != $conf->currency) {
77if (in_array(
$object->element, array(
'propal',
'commande',
'order',
'facture',
'facturerec',
'invoice',
'supplier_proposal',
'order_supplier',
'invoice_supplier',
'invoice_supplier_rec'))) {
80if (isModEnabled(
'asset') &&
$object->element ==
'invoice_supplier') {
87if (!empty($extrafields)) {
88 if ($this->table_element_line ==
'commandedet') {
90 } elseif ($this->table_element_line ==
'propaldet') {
92 } elseif ($this->table_element_line ==
'supplier_proposaldet') {
94 } elseif ($this->table_element_line ==
'facturedet') {
96 } elseif ($this->table_element_line ==
'contratdet') {
98 } elseif ($this->table_element_line ==
'commande_fournisseurdet') {
100 } elseif ($this->table_element_line ==
'facture_fourn_det') {
102 } elseif ($this->table_element_line ==
'facturedet_rec') {
104 } elseif ($this->table_element_line ==
'facture_fourn_det_rec') {
108print
"<!-- BEGIN PHP TEMPLATE objectline_create.tpl.php -->\n";
109$nolinesbefore = (count($this->lines) == 0 || $forcetoshowtitlelines);
112 <tr
class=
"liste_titre<?php echo(($nolinesbefore || $object->element == 'contrat') ? '' : ' liste_titre_add_') ?> nodrag nodrop">
114 <td
class=
"linecolnum center"></td>
116 <td
class=
"linecoldescription minwidth400imp">
117 <div
id=
"add"></div><span
class=
"hideonsmartphone"><?php echo $langs->trans(
'AddNewLine'); ?></span>
120 if (
$object->element ==
'supplier_proposal' ||
$object->element ==
'order_supplier' ||
$object->element ==
'invoice_supplier' ||
$object->element ==
'invoice_supplier_rec') {
122 <td
class=
"linecolrefsupplier"><span
id=
"title_fourn_ref"><?php echo $langs->trans(
'SupplierRef'); ?></span></td>
125 <td
class=
"linecolvat right"><span
id=
"title_vat"><?php echo $langs->trans(
'VAT'); ?></span></td>
126 <td
class=
"linecoluht right"><span
id=
"title_up_ht"><?php echo $langs->trans(
'PriceUHT'); ?></span></td>
127 <?php
if (isModEnabled(
"multicurrency") && $this->multicurrency_code != $conf->currency) { ?>
128 <td
class=
"linecoluht_currency right"><span
id=
"title_up_ht_currency"><?php echo $langs->trans(
'PriceUHTCurrency'); ?></span></td>
130 <?php
if (!empty($inputalsopricewithtax) && !
getDolGlobalInt(
'MAIN_NO_INPUT_PRICE_WITH_TAX')) { ?>
131 <td
class=
"linecoluttc right"><span
id=
"title_up_ttc"><?php echo $langs->trans(
'PriceUTTC'); ?></span></td>
133 <td
class=
"linecolqty right"><?php echo $langs->trans(
'Qty'); ?></td>
136 print
'<td class="linecoluseunit left">';
137 print
'<span id="title_units">';
138 print $langs->trans(
'Unit');
139 print
'</span></td>';
141 <td
class=
"linecoldiscount right"><?php echo $langs->trans(
'ReductionShort'); ?></td>
144 if (isset($this->situation_cycle_ref) && $this->situation_cycle_ref) {
145 print
'<td class="linecolcycleref right">'.$langs->trans(
'Progress').
'</td>';
147 print
'<td class="nobottom nowrap right"></td>';
149 print
'<td class="linecolcycleref2 right"></td>';
151 if (!empty($usemargins)) {
152 if (!$user->hasRight(
'margins',
'creer')) {
155 print
'<td class="margininfos linecolmargin1 right">';
157 echo $langs->trans(
'BuyingPrice');
159 echo $langs->trans(
'CostPrice');
163 echo
'<td class="margininfos linecolmargin2 right"><span class="np_marginRate">'.$langs->trans(
'MarginRate').
'</span></td>';
166 echo
'<td class="margininfos linecolmargin2 right"><span class="np_markRate">'.$langs->trans(
'MarkRate').
'</span></td>';
170 <td
class=
"linecoledit" colspan=
"<?php echo $colspan; ?>"> </td>
175<tr
class=
"pair nodrag nodrop nohoverpair<?php echo ($nolinesbefore || $object->element == 'contrat') ? '' : ' liste_titre_create'; ?>">
181 echo
'<td class="nobottom linecolnum center"></td>';
185 <td
class=
"nobottom linecoldescription minwidth400imp">
191 if (
$object->element ==
'contrat') {
192 if (!isModEnabled(
'product') && !isModEnabled(
'service') && !
getDolGlobalString(
'CONTRACT_SUPPORT_PRODUCTS')) {
199 echo
'<span class="prod_entry_mode_free">';
201 if ($forceall >= 0 && (isModEnabled(
"product") || isModEnabled(
"service"))) {
202 echo
'<label for="prod_entry_mode_free">';
203 echo
'<input type="radio" class="prod_entry_mode_free" name="prod_entry_mode" id="prod_entry_mode_free" value="free"';
205 echo((
GETPOST(
'prod_entry_mode',
'alpha') ==
'free' ||
getDolGlobalString(
'MAIN_FREE_PRODUCT_CHECKED_BY_DEFAULT')) ?
' checked' :
'');
208 echo
'<span class="textradioforitem">'.$langs->trans(
"FreeLineOfType").
'</span>';
212 echo
'<input type="hidden" id="prod_entry_mode_free" name="prod_entry_mode" value="free">';
214 if ($forceall >= 0) {
215 if (!isModEnabled(
'product') || !isModEnabled(
'service')) {
216 echo $langs->trans(
"Type");
218 echo $langs->trans(
"FreeLineOfType");
223 $form->select_type_of_lines(GETPOSTISSET(
"type") ?
GETPOST(
"type",
'alpha', 2) : -1,
'type', 1, 1, $forceall,
'');
227 if (isModEnabled(
"product") || isModEnabled(
"service")) {
228 if ($forceall >= 0 && $freelines) {
229 echo
'<br><span class="prod_entry_mode_predef paddingtop">';
231 echo
'<span class="prod_entry_mode_predef">';
233 echo
'<label for="prod_entry_mode_predef">';
234 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' :
'').
'> ';
236 if (empty($conf->dol_optimize_smallscreen)) {
237 if (isModEnabled(
"product") && !isModEnabled(
'service')) {
238 $labelforradio = $langs->trans(
'PredefinedProducts');
239 } elseif ((!isModEnabled(
'product') && isModEnabled(
'service')) || (
$object->element ==
'contrat' && !
getDolGlobalString(
'CONTRACT_SUPPORT_PRODUCTS'))) {
240 $labelforradio = $langs->trans(
'PredefinedServices');
242 $labelforradio = $langs->trans(
'PredefinedProductsAndServices');
245 $labelforradio = $langs->trans(
'PredefinedItem');
247 print
'<span class="textradioforitem">'.$labelforradio.
'</span>';
254 if (empty($senderissupplier)) {
256 $statuswarehouse =
'warehouseopen,warehouseinternal';
258 $statuswarehouse =
'warehouseopen';
262 $form->select_produits(
GETPOST(
'idprod'),
'idprod', $filtertype,
getDolGlobalInt(
'PRODUIT_LIMIT_SIZE'), $buyer->price_level, $statustoshow, 2,
'', 1, array(), $buyer->id,
'1', 0,
'maxwidth500 widthcentpercentminusx', 0, $statuswarehouse,
GETPOST(
'combinations',
'array'));
264 $form->select_produits(
GETPOST(
'idprod'),
'idprod', $filtertype,
getDolGlobalInt(
'PRODUIT_LIMIT_SIZE'), $buyer->price_level, $statustoshow, 2,
'', 1, array(), $buyer->id,
'1', 0,
'maxwidth500 widthcentpercentminusx', 0,
'',
GETPOST(
'combinations',
'array'));
269 $(document).ready(
function(){
271 $(document).on(
'focus',
'.select2-selection.select2-selection--single',
function (e) {
272 console.log(
'focus on a select2');
273 if ($(
this).attr(
'aria-labelledby') ==
'select2-idprod-container')
275 console.log(
'open combo');
276 $(
'#idprod').select2(
'open');
285 if ($senderissupplier != 2) {
286 $ajaxoptions = array(
287 'update' => array(
'qty' =>
'qty',
'remise_percent' =>
'discount',
'idprod' =>
'idprod'),
288 'option_disabled' =>
'idthatdoesnotexists',
289 'warning' => $langs->trans(
"NoPriceDefinedForThisSupplier")
291 $alsoproductwithnosupplierprice = 0;
293 $ajaxoptions = array(
298 $alsoproductwithnosupplierprice = 1;
300 $form->select_produits_fournisseurs(
$object->socid,
GETPOST(
'idprodfournprice'),
'idprodfournprice',
'',
'', $ajaxoptions, 1, $alsoproductwithnosupplierprice,
'minwidth100 maxwidth500 widthcentpercentminusx');
304 $(document).ready(
function(){
306 $(document).on(
'focus',
'.select2-selection.select2-selection--single',
function (e) {
308 if ($(
this).attr(
'aria-labelledby') ==
'select2-idprodfournprice-container')
310 $(
'#idprodfournprice').select2(
'open');
321 $addproducton = (isModEnabled(
'product') && $user->hasRight(
'produit',
'creer'));
322 $addserviceon = (isModEnabled(
'service') && $user->hasRight(
'service',
'creer'));
323 if ($addproducton || $addserviceon) {
324 if ($addproducton && $addserviceon) {
325 echo
'<div id="dropdownAddProductAndService" class="dropdown inline-block">';
326 echo
'<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" id="dropdownAddProductAndServiceLink" aria-haspopup="true" aria-expanded="false">';
327 echo
'<span class="fa fa-plus-circle valignmiddle paddingleft"></span>';
329 echo
'<div class="dropdown-menu" aria-labelledby="dropdownAddProductAndServiceLink" style="top:auto; left:auto;">';
330 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>';
331 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>';
336 $url =
'/product/card.php?leftmenu=product&action=create&type=0&backtopage='.urlencode($_SERVER[
"PHP_SELF"]);
337 $newbutton =
'<span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans(
"NewProduct").
'"></span>';
340 $tmpbacktopagejsfields =
'addproduct:id,search_id';
344 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>';
348 $url =
'/product/card.php?leftmenu=product&action=create&type=1&backtopage='.urlencode($_SERVER[
"PHP_SELF"]);
349 $newbutton =
'<span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans(
"NewService").
'"></span>';
352 $tmpbacktopagejsfields =
'addproduct:id,search_id';
356 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>';
362 $(document).ready(
function(){
363 $(
"#dropdownAddProductAndService .dropdown-toggle").on(
"click",
function(event) {
364 console.log(
"toggle addproduct dropdown");
365 event.preventDefault();
366 $(
"#dropdownAddProductAndService").toggleClass(
"open");
372 echo
'<input type="hidden" name="pbq" id="pbq" value="">';
377 echo
'<br>'.$langs->trans(
'AddLineOnPosition').
' : <input type="number" name="rank" step="1" min="0" style="width: 5em;">';
380 if (is_object($hookmanager) && empty($senderissupplier)) {
381 $parameters = array(
'fk_parent_line' =>
GETPOSTINT(
'fk_parent_line'));
382 $reshook = $hookmanager->executeHooks(
'formCreateProductOptions', $parameters,
$object, $action);
383 if (!empty($hookmanager->resPrint)) {
384 print $hookmanager->resPrint;
387 if (is_object($hookmanager) && !empty($senderissupplier)) {
388 $parameters = array(
'htmlname' =>
'addproduct');
389 $reshook = $hookmanager->executeHooks(
'formCreateProductSupplierOptions', $parameters,
$object, $action);
390 if (!empty($hookmanager->resPrint)) {
391 print $hookmanager->resPrint;
394 if (isModEnabled(
"product") || isModEnabled(
"service")) {
396 if (isModEnabled(
'variants')) {
397 echo
'<div id="attributes_box"></div>';
401 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
407 $toolbarname =
'dolibarr_details';
409 $toolbarname =
'dolibarr_notes';
411 $doleditor =
new DolEditor(
'dp_desc',
GETPOST(
'dp_desc',
'restricthtml'),
'',
getDolGlobalInt(
'MAIN_DOLEDITOR_HEIGHT', 100), $toolbarname,
'',
false,
true, $enabled, $nbrows,
'98%');
412 $doleditor->Create();
414 if (isModEnabled(
"service") && (
$object->element ==
'facturerec' ||
$object->element ==
'invoice_supplier_rec')) {
415 echo
'<div class="divlinefordates"><br>';
416 echo $langs->trans(
'AutoFillDateFrom').
' ';
418 $line->date_start_fill = 1;
419 $line->date_end_fill = 1;
421 echo $form->selectyesno(
'date_start_fill', $line->date_start_fill, 1);
423 echo $langs->trans(
'AutoFillDateTo').
' ';
424 echo $form->selectyesno(
'date_end_fill', $line->date_end_fill, 1);
427 if (is_object($objectline)) {
428 $temps = $objectline->showOptionals($extrafields,
'create', array(),
'',
'', 1,
'line');
430 if (!empty($temps)) {
431 print
'<div style="padding-top: 10px" id="extrafield_lines_area_create" name="extrafield_lines_area_create">';
437 if (
$object->element ==
'supplier_proposal' ||
$object->element ==
'order_supplier' ||
$object->element ==
'invoice_supplier' ||
$object->element ==
'invoice_supplier_rec') {
439 <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>
442 print
'<td class="nobottom linecolvat right">';
444 if (
$object->element ==
'propal' ||
$object->element ==
'commande' ||
$object->element ==
'facture' ||
$object->element ==
'facturerec') {
446 } elseif (
$object->element ==
'supplier_proposal' ||
$object->element ==
'order_supplier' ||
$object->element ==
'invoice_supplier' ||
$object->element ==
'invoice_supplier_rec') {
449 if ($seller->tva_assuj ==
"0") {
450 echo
'<input type="hidden" name="tva_tx" id="tva_tx" value="0">'.vatrate(
'0',
true);
452 echo $form->load_tva(
'tva_tx', (GETPOSTISSET(
"tva_tx") ?
GETPOST(
"tva_tx",
'alpha', 2) : -1), $seller, $buyer, 0, 0,
'', false, 1, $type_tva);
457 <td
class=
"nobottom linecoluht right"><?php $coldisplay++; ?>
458 <input
type=
"text" name=
"price_ht" id=
"price_ht" class=
"flat right width50" value=
"<?php echo(GETPOSTISSET("price_ht
") ? GETPOST("price_ht
", 'alpha', 2) : ''); ?>">
462 if (isModEnabled(
"multicurrency") && $this->multicurrency_code != $conf->currency) {
464 <td
class=
"nobottom linecoluht_currency right">
465 <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) : ''); ?>">
469 if (!empty($inputalsopricewithtax) && !
getDolGlobalInt(
'MAIN_NO_INPUT_PRICE_WITH_TAX')) {
471 <td
class=
"nobottom linecoluttc right">
472 <input
type=
"text" name=
"price_ttc" id=
"price_ttc" class=
"flat right width50" value=
"<?php echo(GETPOSTISSET("price_ttc
") ? GETPOST("price_ttc
", 'alpha', 2) : ''); ?>">
478 <td
class=
"nobottom linecolqty right">
479 <?php $default_qty = (!
getDolGlobalString(
'MAIN_OBJECTLINE_CREATE_EMPTY_QTY_BY_DEFAULT') ? 1 :
''); ?>
480 <input
type=
"text" name=
"qty" id=
"qty" class=
"flat width40 right" value=
"<?php echo(GETPOSTISSET("qty
") ? GETPOST("qty
", 'alpha', 2) : $default_qty); ?>">
485 print
'<td class="nobottom linecoluseunit left">';
486 print $form->selectUnits(empty($line->fk_unit) ? $conf->global->PRODUCT_USE_UNITS : $line->fk_unit,
"units");
489 $remise_percent = $buyer->remise_percent;
490 if (
$object->element ==
'supplier_proposal' ||
$object->element ==
'order_supplier' ||
$object->element ==
'invoice_supplier') {
491 $remise_percent = $seller->remise_supplier_percent;
496 <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>
498 if (isset($this->situation_cycle_ref) && $this->situation_cycle_ref) {
500 print
'<td class="nobottom nowrap right"><input class="flat right" type="text" size="1" value="" name="progress"><span class="opacitymedium hideonsmartphone">%</span></td>';
503 print
'<td class="nobottom nowrap right"></td>';
508 if (!empty($usemargins)) {
509 if ($user->hasRight(
'margins',
'creer')) {
511 <td
class=
"nobottom margininfos linecolmargin right">
512 <!-- For predef product -->
513 <?php
if (isModEnabled(
"product") || isModEnabled(
"service")) { ?>
514 <select
id=
"fournprice_predef" name=
"fournprice_predef" class=
"flat minwidth75imp maxwidth150" style=
"display: none;"></select>
516 <!-- For free product -->
517 <input
type=
"text" id=
"buying_price" name=
"buying_price" class=
"flat maxwidth75 right" value=
"<?php echo(GETPOSTISSET("buying_price
") ? GETPOST("buying_price
", 'alpha', 2) : ''); ?>">
521 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>';
525 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>';
530 $coldisplay += $colspan;
532 <td
class=
"nobottom linecoledit center valignmiddle" colspan=
"<?php echo $colspan; ?>">
533 <input
type=
"submit" class=
"button reposition" value=
"<?php echo $langs->trans('Add'); ?>" name=
"addline" id=
"addline">
538if ((isModEnabled(
"service") || (
$object->element ==
'contrat')) && $dateSelector &&
GETPOST(
'type') !=
'0') {
539 print
'<tr id="trlinefordates" class="oddeven">'.
"\n";
543 print
'<td colspan="'.($coldisplay - (!
getDolGlobalString(
'MAIN_VIEW_LINE_NUMBER') ? 0 : 1)).
'">';
547 $prefillDates =
false;
550 for ($i = count(
$object->lines) - 1; $i >= 0; $i--) {
551 $lastline =
$object->lines[$i];
553 if ($lastline->product_type ==
Product::TYPE_SERVICE && (!empty($lastline->date_start) || !empty($lastline->date_end))) {
554 $date_start_prefill = $lastline->date_start;
555 $date_end_prefill = $lastline->date_end;
557 $prefillDates =
true;
564 print $langs->trans(
"DateStartPlanned").
' ';
565 print $form->selectDate($date_start,
"date_start", $usehm, $usehm, 1,
"addproduct");
566 print
' '.$langs->trans(
"DateEndPlanned").
' ';
567 print $form->selectDate($date_end,
"date_end", $usehm, $usehm, 1,
"addproduct");
569 print $langs->trans(
'ServiceLimitedDuration').
' '.$langs->trans(
'From').
' ';
570 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);
571 print
' '.$langs->trans(
'to').
' ';
572 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);
576 echo
' <span class="small"><a href="#" id="prefill_service_dates">'.$langs->trans(
'FillWithLastServiceDates').
'</a></span>';
583 function prefill_service_dates()
585 $(
'#date_start').val(
"<?php echo dol_escape_js(dol_print_date($date_start_prefill, 'day')); ?>").trigger(
'change');
586 $(
'#date_end').val(
"<?php echo dol_escape_js(dol_print_date($date_end_prefill, 'day')); ?>").trigger(
'change');
591 $(document).ready(
function()
593 $(
'#prefill_service_dates').click(prefill_service_dates);
600 if (isset($conf->global->MAIN_DEFAULT_DATE_START_HOUR)) {
601 print
'jQuery("#date_starthour").val("' .
getDolGlobalString(
'MAIN_DEFAULT_DATE_START_HOUR').
'");';
603 if (isset($conf->global->MAIN_DEFAULT_DATE_START_MIN)) {
604 print
'jQuery("#date_startmin").val("' .
getDolGlobalString(
'MAIN_DEFAULT_DATE_START_MIN').
'");';
608 if (isset($conf->global->MAIN_DEFAULT_DATE_END_HOUR)) {
609 print
'jQuery("#date_endhour").val("' .
getDolGlobalString(
'MAIN_DEFAULT_DATE_END_HOUR').
'");';
611 if (isset($conf->global->MAIN_DEFAULT_DATE_END_MIN)) {
612 print
'jQuery("#date_endmin").val("' .
getDolGlobalString(
'MAIN_DEFAULT_DATE_END_MIN').
'");';
622if (!empty($usemargins) && $user->hasRight(
'margins',
'creer')) {
625 jQuery(document).ready(
function() {
628 $(
"input[name='np_marginRate']:first").blur(
function(e) {
629 return checkFreeLine(e,
"np_marginRate");
634 $(
"input[name='np_markRate']:first").blur(
function(e) {
635 return checkFreeLine(e,
"np_markRate");
642 function checkFreeLine(e, npRate)
644 var buying_price = $(
"input[name='buying_price']:first");
645 var remise = $(
"input[name='remise_percent']:first");
647 var rate = $(
"input[name='"+npRate+
"']:first");
648 if (rate.val() ==
'')
651 if (! $.isNumeric(rate.val().replace(
',',
'.')))
653 alert(
'<?php echo dol_escape_js($langs->trans("rateMustBeNumeric")); ?>');
655 setTimeout(
function () { rate.focus() }, 50);
658 if (npRate ==
"np_markRate" && rate.val() >= 100)
660 alert(
'<?php echo dol_escape_js($langs->trans("markRateShouldBeLesserThan100")); ?>');
662 setTimeout(
function () { rate.focus() }, 50);
671 if (remisejs ==
'') remisejs=0;
676 if (npRate ==
"np_marginRate")
677 price = ((bpjs * (1 + ratejs / 100)) / (1 - remisejs / 100));
678 else if (npRate ==
"np_markRate")
679 price = ((bpjs / (1 - ratejs / 100)) / (1 - remisejs / 100));
682 $(
"input[name='price_ht']:first").val(
price);
692 jQuery(document).ready(
function() {
693 jQuery(
"#price_ht").keyup(
function(event) {
695 if (event.which != 9 && (event.which < 37 ||event.which > 40) && jQuery(
"#price_ht").val() !=
'') {
696 jQuery(
"#price_ttc").val(
'');
697 jQuery(
"#multicurrency_subprice").val(
'');
698 jQuery(
"#multicurrency_price_ht").val(
'');
701 jQuery(
"#price_ttc").keyup(
function(event) {
703 if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery(
"#price_ttc").val() !=
'') {
704 jQuery(
"#price_ht").val(
'');
705 jQuery(
"#multicurrency_subprice").val(
'');
706 jQuery(
"#multicurrency_price_ht").val(
'');
709 jQuery(
"#multicurrency_subprice").keyup(
function(event) {
711 if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery(
"#multicurrency_subprice").val() !=
'') {
712 jQuery(
"#price_ht").val(
'');
713 jQuery(
"#price_ttc").val(
'');
716 jQuery(
"#multicurrency_price_ht").keyup(
function(event) {
718 if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery(
"#multicurrency_price_ht").val() !=
'') {
719 jQuery(
"#price_ht").val(
'');
720 jQuery(
"#price_ttc").val(
'');
724 $(
"#prod_entry_mode_free").on(
"click",
function() {
727 $(
"#select_type").change(
function()
731 if (jQuery(
'#select_type').val() >= 0) {
732 console.log(
"Set focus on description field");
734 jQuery(
'#dp_desc').focus();
736 if (typeof CKEDITOR ==
"object" && typeof CKEDITOR.instances !=
"undefined") {
737 var editor = CKEDITOR.instances[
'dp_desc'];
744 console.log(
"Hide/show date according to product type");
745 if (jQuery(
'#select_type').val() ==
'0')
747 jQuery(
'#trlinefordates').hide();
748 jQuery(
'.divlinefordates').hide();
752 jQuery(
'#trlinefordates').show();
753 jQuery(
'.divlinefordates').show();
757 $(
"#prod_entry_mode_predef").on(
"click",
function() {
758 console.log(
"click prod_entry_mode_predef");
760 jQuery(
'#trlinefordates').show();
764 if (!$freelines) { ?>
765 $(
"#prod_entry_mode_predef").click();
769 if (in_array($this->table_element_line, array(
'propaldet',
'commandedet',
'facturedet'))) { ?>
770 $(
"#date_start, #date_end").focusout(
function() {
771 let
type = $(
this).attr(
'type');
772 let mandatoryP = $(
this).attr(
'mandatoryperiod');
773 if (
type == 1 && mandatoryP == 1) {
774 if ($(
this).val() ==
'' && !$(
this).hasClass(
'inputmandatory')) {
775 $(
this).addClass(
'inputmandatory');
777 $(
this).removeClass(
'inputmandatory');
784 $(
"#idprod, #idprodfournprice").change(
function()
786 console.log(
"objectline_create.tpl Call method change() after change on #idprod or #idprodfournprice (senderissupplier=<?php echo $senderissupplier; ?>). this.val = "+$(
this).val());
790 jQuery(
'#trlinefordates').show();
793 if (!
getDolGlobalString(
'MAIN_DISABLE_EDIT_PREDEF_PRICEHT') && empty($senderissupplier)) {
795 var pbq = parseInt($(
'option:selected',
this).attr(
'data-pbq'));
796 if (isNaN(pbq)) { pbq = jQuery(
'#idprod').attr(
'data-pbq'); }
798 if ((jQuery(
'#idprod').val() > 0 || jQuery(
'#idprodfournprice').val()) && ! isNaN(pbq) && pbq > 0)
800 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");
803 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"); }
806 console.log(
"Load unit price and set it into #price_ht or #price_ttc for product id="+$(
this).val()+
" socid=<?php print $object->socid; ?>");
807 $.post(
'<?php echo DOL_URL_ROOT; ?>/product/ajax/products.php?action=fetch',
808 {
'id': $(
this).val(),
'socid': <?php print
$object->socid; ?>,
'token':
'<?php print currentToken(); ?>',
'addalsovatforthirdpartyid': 1 },
810 console.log(
"objectline_create.tpl Load unit price ends, we got value ht="+data.price_ht+
" ttc="+data.price_ttc+
" pricebasetype="+data.pricebasetype);
812 $(
'#date_start').removeAttr(
'type');
813 $(
'#date_end').removeAttr(
'type');
814 $(
'#date_start').attr(
'type', data.type);
815 $(
'#date_end').attr(
'type', data.type);
817 $(
'#date_start').removeAttr(
'mandatoryperiod');
818 $(
'#date_end').removeAttr(
'mandatoryperiod');
819 $(
'#date_start').attr(
'mandatoryperiod', data.mandatory_period);
820 $(
'#date_end').attr(
'mandatoryperiod', data.mandatory_period);
823 if (data.mandatory_period == 1 && data.type == 1) {
824 jQuery(
'#date_start').addClass(
'inputmandatory');
825 jQuery(
'#date_end').addClass(
'inputmandatory');
827 jQuery(
'#date_start').removeClass(
'inputmandatory');
828 jQuery(
'#date_end').removeClass(
'inputmandatory');
831 if (<?php echo (
int) $inputalsopricewithtax; ?> == 1 && data.pricebasetype ==
'TTC' && <?php print
getDolGlobalInt(
'MAIN_NO_INPUT_PRICE_WITH_TAX') ?
'false' :
'true'; ?>) {
832 console.log(
"objectline_create.tpl set content of price_ttc");
833 jQuery(
"#price_ttc").val(data.price_ttc);
835 console.log(
"objectline_create.tpl set content of price_ht");
836 jQuery(
"#price_ht").val(data.price_ht);
840 for (var key in data.array_options) {
841 if (data.array_options.hasOwnProperty(key)) {
842 var field = jQuery(
"#" + key);
843 if(field.length > 0){
844 console.log(
"objectline_create.tpl set content of options_" + key);
845 field.val(data.array_options[key]);
850 var tva_tx = data.tva_tx;
851 var default_vat_code = data.default_vat_code;
854 var stringforvatrateselection = tva_tx;
855 if (typeof default_vat_code !=
'undefined' && default_vat_code !=
null && default_vat_code !=
'') {
856 stringforvatrateselection = stringforvatrateselection+
' ('+default_vat_code+
')';
861 console.log(
"MAIN_SALETAX_AUTOSWITCH_I_CS_FOR_INDIA is on so we check if we need to autoswith the vat code");
862 console.log(
"mysoc->country_code=<?php echo $mysoc->country_code; ?> thirdparty->country_code=<?php echo $object->thirdparty->country_code; ?>");
863 new_default_vat_code = default_vat_code;
865 if ($mysoc->country_code ==
'IN' && !empty(
$object->thirdparty) &&
$object->thirdparty->country_code ==
'IN' && $mysoc->state_code ==
$object->thirdparty->state_code) {
868 console.log(
"Countries are both IN and states are same, so we revert I into CS in default_vat_code="+default_vat_code);
869 new_default_vat_code = default_vat_code.replace(/^I\-/,
'C+S-');
871 } elseif ($mysoc->country_code ==
'IN' && !empty(
$object->thirdparty) &&
$object->thirdparty->country_code ==
'IN' && $mysoc->state_code !=
$object->thirdparty->state_code) {
874 console.log(
"Countries are both IN and states differs, so we revert CS into I in default_vat_code="+default_vat_code);
875 new_default_vat_code = default_vat_code.replace(/^C\+S\-/,
'I-');
878 if (new_default_vat_code != default_vat_code && jQuery(
'#tva_tx option:contains("'+new_default_vat_code+
'")').val()) {
879 console.log(
"We found en entry into VAT with new default_vat_code, we will use it");
880 stringforvatrateselection = jQuery(
'#tva_tx option:contains("'+new_default_vat_code+
'")').val();
886 $(
'#tva_tx').val(tva_tx);
889 $(
'#tva_tx option').removeAttr(
'selected');
890 console.log(
"stringforvatrateselection="+stringforvatrateselection+
" -> value of option label for this key="+$(
'#tva_tx option[value="'+stringforvatrateselection+
'"]').val());
891 $(
'#tva_tx option[value="'+stringforvatrateselection+
'"]').prop(
'selected',
true);
896 var proddesc = data.desc_trans;
899 var proddesc = data.desc;
902 console.log(
"objectline_create.tpl Load description into text area : "+proddesc);
905 if (typeof CKEDITOR ==
"object" && typeof CKEDITOR.instances !=
"undefined")
907 var editor = CKEDITOR.instances[
'dp_desc'];
909 editor.setData(proddesc);
914 jQuery(
'#dp_desc').text(proddesc);
921 jQuery.each(data.array_options,
function( key, value ) {
922 jQuery(
'div[class*="det'+key.replace(
'options_',
'_extras_')+
'"] > #'+key).val(value);
933 if (!empty($usemargins) && $user->hasRight(
'margins',
'creer')) {
934 $langs->load(
'stocks'); ?>
937 $(
"#fournprice_predef").find(
"option").remove();
938 $(
"#fournprice_predef").hide();
939 $(
"#buying_price").val(
"").show();
942 var token =
'<?php echo currentToken(); ?>';
943 $.post(
'<?php echo DOL_URL_ROOT; ?>/fourn/ajax/getSupplierPrices.php?bestpricefirst=1', {
'idprod': $(
this).val(),
'token': token },
function(data) {
944 if (data && data.length > 0)
946 var options =
''; var defaultkey =
''; var defaultprice =
''; var bestpricefound = 0;
948 var bestpriceid = 0; var bestpricevalue = 0;
949 var pmppriceid = 0; var pmppricevalue = 0;
950 var costpriceid = 0; var costpricevalue = 0;
953 var defaultbuyprice =
'<?php
954 if (isset($conf->global->MARGIN_TYPE)) {
955 if (getDolGlobalString('MARGIN_TYPE
') == '1
') {
956 print 'bestsupplierprice
';
958 if (getDolGlobalString('MARGIN_TYPE
') == 'pmp
') {
961 if (getDolGlobalString('MARGIN_TYPE
') == 'costprice
') {
965 console.log(
"objectline_create.tpl we will set the field for margin. defaultbuyprice="+defaultbuyprice);
968 $(data).each(
function() {
970 if (this.
id !=
'pmpprice' && this.
id !=
'costprice')
973 this.price = parseFloat(this.price);
976 if (bestpricefound == 0 && this.price > 0) { defaultkey = this.id; defaultprice = this.
price; bestpriceid = this.id; bestpricevalue = this.
price; bestpricefound=1; }
978 if (this.
id ==
'pmpprice')
981 console.log(
"id="+this.
id+
"-price="+this.price);
982 if (
'pmp' == defaultbuyprice ||
'costprice' == defaultbuyprice)
984 if (this.price > 0) {
985 defaultkey = this.id; defaultprice = this.
price; pmppriceid = this.id; pmppricevalue = this.
price;
990 if (this.
id ==
'costprice')
993 console.log(
"id="+this.
id+
"-price="+this.price+
"-pmppricevalue="+pmppricevalue);
994 if (
'costprice' == defaultbuyprice)
996 if (this.price > 0) { defaultkey = this.id; defaultprice = this.
price; costpriceid = this.id; costpricevalue = this.
price; }
997 else if (pmppricevalue > 0) { defaultkey =
'pmpprice'; defaultprice = pmppricevalue; }
1000 options +=
'<option value="'+this.
id+
'" price="'+this.price+
'">'+this.label+
'</option>';
1002 options +=
'<option value="inputprice" price="'+defaultprice+
'"><?php echo dol_escape_js($langs->trans("InputPrice").'...
'); ?></option>';
1004 console.log(
"finally selected defaultkey="+defaultkey+
" defaultprice for buying price="+defaultprice);
1006 $(
"#fournprice_predef").html(options).show();
1007 if (defaultkey !=
'')
1009 $(
"#fournprice_predef").val(defaultkey);
1013 $(
"#buying_price").hide();
1016 var defaultprice = $(
"#fournprice_predef").find(
'option:selected').attr(
"price");
1017 $(
"#buying_price").val(defaultprice);
1019 $(
"#fournprice_predef").change(
function() {
1020 console.log(
"change on fournprice_predef");
1022 var linevalue=$(
this).find(
'option:selected').val();
1023 var pricevalue = $(
this).find(
'option:selected').attr(
"price");
1024 if (linevalue !=
'inputprice' && linevalue !=
'pmpprice') {
1025 $(
"#buying_price").val(pricevalue).hide();
1027 if (linevalue ==
'inputprice') {
1028 $(
'#buying_price').show();
1030 if (linevalue ==
'pmpprice') {
1031 $(
"#buying_price").val(pricevalue);
1032 $(
'#buying_price').hide();
1047 var pbq = parseInt($(
'option:selected',
this).attr(
'data-pbq'));
1048 if (isNaN(pbq)) { pbq = jQuery(
'#idprod').attr(
'data-pbq'); }
1049 var pbqup = parseFloat($(
'option:selected',
this).attr(
'data-pbqup'));
1050 if (isNaN(pbqup)) { pbqup = jQuery(
'#idprod').attr(
'data-pbqup'); }
1051 var pbqbase = $(
'option:selected',
this).attr(
'data-pbqbase');
1052 if (isNaN(pbqbase)) { pbqbase = jQuery(
'#idprod').attr(
'data-pbqbase'); }
1053 var pbqqty = parseFloat($(
'option:selected',
this).attr(
'data-pbqqty'));
1054 if (isNaN(pbqqty)) { pbqqty = jQuery(
'#idprod').attr(
'data-pbqqty'); }
1055 var pbqpercent = parseFloat($(
'option:selected',
this).attr(
'data-pbqpercent'));
1056 if (isNaN(pbqpercent)) { pbqpercent = jQuery(
'#idprod').attr(
'data-pbqpercent'); }
1058 if ((jQuery(
'#idprod').val() > 0) && ! isNaN(pbq) && pbq > 0)
1060 var pbqupht = pbqup;
1062 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);
1063 jQuery(
"#pbq").val(pbq);
1064 jQuery(
"#price_ht").val(pbqupht);
1065 if (jQuery(
"#qty").val() < pbqqty)
1067 jQuery(
"#qty").val(pbqqty);
1069 if (jQuery(
"#remise_percent").val() < pbqpercent)
1071 jQuery(
"#remise_percent").val(pbqpercent);
1073 }
else { jQuery(
"#pbq").val(
''); }
1080 if (jQuery(
'#idprodfournprice').val() > 0)
1082 console.log(
"objectline_create.tpl #idprodfournprice is an ID > 0, so we set some properties into page");
1084 var up = parseFloat($(
'option:selected',
this).attr(
'data-up'));
1085 if (isNaN(up)) { up = parseFloat(jQuery(
'#idprodfournprice').attr(
'data-up'));}
1087 var up_locale = $(
'option:selected',
this).attr(
'data-up-locale');
1088 if (typeof up_locale ===
'undefined') { up_locale = jQuery(
'#idprodfournprice').attr(
'data-up-locale');}
1090 var qty = parseFloat($(
'option:selected',
this).attr(
'data-qty'));
1091 if (isNaN(qty)) { qty = parseFloat(jQuery(
'#idprodfournprice').attr(
'data-qty'));}
1093 var discount = parseFloat($(
'option:selected',
this).attr(
'data-discount'));
1094 if (isNaN(discount)) { discount = parseFloat(jQuery(
'#idprodfournprice').attr(
'data-discount'));}
1096 var tva_tx = parseFloat($(
'option:selected',
this).attr(
'data-tvatx'));
1097 if (isNaN(tva_tx)) { tva_tx = parseFloat(jQuery(
'#idprodfournprice').attr(
'data-tvatx'));}
1099 var default_vat_code = $(
'option:selected',
this).attr(
'data-default-vat-code');
1100 if (typeof default_vat_code ===
'undefined') { default_vat_code = jQuery(
'#idprodfournprice').attr(
'data-default-vat-code');}
1102 var supplier_ref = $(
'option:selected',
this).attr(
'data-supplier-ref');
1103 if (typeof supplier_ref ===
'undefined') { supplier_ref = jQuery(
'#idprodfournprice').attr(
'data-supplier-ref'); }
1105 <?php
if ((
$object->element ==
'supplier_proposal' ||
$object->element ==
'order_supplier' ||
$object->element ==
'invoice_supplier' ||
$object->element ==
'invoice_supplier_rec') && !$seller->tva_assuj) { ?>
1108 default_vat_code =
null;
1112 var stringforvatrateselection = tva_tx;
1113 if (typeof default_vat_code !=
'undefined' && default_vat_code !=
null && default_vat_code !=
'') {
1114 stringforvatrateselection = stringforvatrateselection+
' ('+default_vat_code+
')';
1117 var has_multicurrency_up =
false;
1119 if (isModEnabled(
'multicurrency') &&
$object->multicurrency_code != $conf->currency) {
1121 var object_multicurrency_code =
'<?php print dol_escape_js($object->multicurrency_code); ?>';
1123 var multicurrency_code = $(
'option:selected',
this).attr(
'data-multicurrency-code');
1124 if (multicurrency_code == undefined) { multicurrency_code = jQuery(
'#idprodfournprice').attr(
'data-multicurrency-code'); }
1126 var multicurrency_up = parseFloat($(
'option:selected',
this).attr(
'data-multicurrency-unitprice'));
1127 if (isNaN(multicurrency_up)) { multicurrency_up = parseFloat(jQuery(
'#idprodfournprice').attr(
'data-multicurrency-unitprice')); }
1129 if (multicurrency_code == object_multicurrency_code) {
1130 has_multicurrency_up =
true;
1131 jQuery(
"#multicurrency_price_ht").val(multicurrency_up);
1134 console.log(
"objectline_create.tpl Multicurrency values : object_multicurrency_code = "+object_multicurrency_code+
", multicurrency_code = "+multicurrency_code+
", multicurrency_up = "+multicurrency_up);
1139 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());
1141 if (has_multicurrency_up ===
false) {
1142 if (typeof up_locale ===
'undefined') {
1143 jQuery(
"#price_ht").val(up);
1145 jQuery(
"#price_ht").val(up_locale);
1150 $(
'#fourn_ref').val(supplier_ref);
1152 $(
'#tva_tx').val(tva_tx);
1155 $(
'#tva_tx option').removeAttr(
'selected');
1156 console.log(
"stringforvatrateselection="+stringforvatrateselection+
" -> value of option label for this key="+$(
'#tva_tx option[value="'+stringforvatrateselection+
'"]').val());
1157 $(
'#tva_tx option[value="'+stringforvatrateselection+
'"]').prop(
'selected',
true);
1159 if (jQuery(
"#qty").val() < qty) {
1160 jQuery(
"#qty").val(qty);
1162 if (jQuery(
"#remise_percent").val() < discount) {
1163 jQuery(
"#remise_percent").val(discount);
1169 var
description = $(
'option:selected',
this).attr(
'data-description');
1170 if (typeof
description ==
'undefined') {
description = jQuery(
'#idprodfournprice').attr(
'data-description'); }
1172 console.log(
"Load description into text area : "+
description);
1176 if (typeof CKEDITOR ==
"object" && typeof CKEDITOR.instances !=
"undefined")
1178 var editor = CKEDITOR.instances[
'dp_desc'];
1191 }
else if (jQuery(
'#idprodfournprice').length > 0) {
1192 console.log(
"objectline_create.tpl #idprodfournprice is not an int but is a string so we set only few properties into page");
1194 var tva_tx = parseFloat($(
'option:selected',
this).attr(
'data-tvatx'));
1195 if (isNaN(tva_tx)) { tva_tx = parseFloat(jQuery(
'#idprodfournprice').attr(
'data-tvatx'));}
1197 var default_vat_code = $(
'option:selected',
this).attr(
'data-default-vat-code');
1198 if (typeof default_vat_code ===
'undefined') { default_vat_code = jQuery(
'#idprodfournprice').attr(
'data-default-vat-code');}
1200 var supplier_ref = $(
'option:selected',
this).attr(
'data-supplier-ref');
1201 if (typeof supplier_ref ===
'undefined') { supplier_ref = jQuery(
'#idprodfournprice').attr(
'data-supplier-ref'); }
1203 var stringforvatrateselection = tva_tx;
1204 if (typeof default_vat_code !=
'undefined' && default_vat_code !=
null && default_vat_code !=
'') {
1205 stringforvatrateselection = stringforvatrateselection+
' ('+default_vat_code+
')';
1209 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());
1212 $(
'#fourn_ref').val(supplier_ref);
1214 $(
'#tva_tx').val(tva_tx);
1217 $(
'#tva_tx option').removeAttr(
'selected');
1218 console.log(
"stringforvatrateselection="+stringforvatrateselection+
" -> value of option label for this key="+$(
'#tva_tx option[value="'+stringforvatrateselection+
'"]').val());
1219 $(
'#tva_tx option[value="'+stringforvatrateselection+
'"]').prop(
'selected',
true);
1224 if (typeof CKEDITOR ==
"object" && typeof CKEDITOR.instances !=
"undefined")
1226 var editor = CKEDITOR.instances[
'dp_desc'];
1234 jQuery(
'#dp_desc').text(
'');
1243 if (jQuery(
'#idprod').val() > 0 || jQuery(
'#idprodfournprice').val() > 0)
1246 jQuery(
'#dp_desc').focus();
1248 if (typeof CKEDITOR ==
"object" && typeof CKEDITOR.instances !=
"undefined")
1250 var editor = CKEDITOR.instances[
'dp_desc'];
1251 if (editor) { editor.focus(); }
1256 <?php
if (
GETPOST(
'prod_entry_mode') ==
'predef') {
1262 function setforfree() {
1263 console.log(
"objectline_create.tpl::setforfree. We show most fields");
1264 jQuery(
"#idprodfournprice").val(
'0');
1265 jQuery(
"#prod_entry_mode_free").prop(
'checked',
true).change();
1266 jQuery(
"#prod_entry_mode_predef").prop(
'checked',
false).change();
1267 jQuery(
"#search_idprod, #idprod, #search_idprodfournprice, #buying_price").val(
'');
1268 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();
1269 jQuery(
"#np_marginRate, #np_markRate, .np_marginRate, .np_markRate, #units, #title_units").show();
1270 jQuery(
"#fournprice_predef").hide();
1273 function setforpredef() {
1274 console.log(
"objectline_create.tpl::setforpredef We hide some fields, show dates");
1275 jQuery(
"#select_type").val(-1);
1276 jQuery(
"#prod_entry_mode_free").prop(
'checked',
false).change();
1277 jQuery(
"#prod_entry_mode_predef").prop(
'checked',
true).change();
1279 jQuery(
"#price_ht").val(
'').show();
1280 jQuery(
"#multicurrency_price_ht").val(
'').show();
1281 jQuery(
"#title_up_ht, #title_up_ht_currency").show();
1284 jQuery(
"#multicurrency_price_ht").val(
'').hide();
1285 jQuery(
"#title_up_ht, #title_up_ht_currency").hide();
1288 jQuery(
"#price_ttc").val(
'').show();
1289 jQuery(
"#multicurrency_price_ttc").val(
'').show();
1290 jQuery(
"#title_up_ttc, #title_up_ttc_currency").show();
1292 jQuery(
"#price_ttc").val(
'').hide();
1293 jQuery(
"#multicurrency_price_ttc").val(
'').hide();
1294 jQuery(
"#title_up_ttc, #title_up_ttc_currency").hide();
1299 jQuery(
"#np_marginRate, .np_marginRate").hide();
1302 jQuery(
"#np_markRate, .np_markRate").hide();
1304 jQuery(
"#units, #title_units").hide();
1305 jQuery(
"#buying_price").show();
1306 jQuery(
'#trlinefordates, .divlinefordates').show();
1313print
"<!-- 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()
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.