diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 29e983a1d2b..ee71032bfff 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -8,6 +8,7 @@ * Copyright (C) 2015-2016 Marcos García * Copyright (C) 2018 Frédéric France * Copyright (C) 2018 Ferran Marcet + * Copyright (C) 2019 Nicolas ZABOURI * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,35 +32,28 @@ * $senderissupplier (0 by default, 1 or 2 for supplier invoices/orders) * $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax) */ - // Protection to avoid direct call of template if (empty($object) || !is_object($object)) { - print "Error: this template page cannot be called directly as an URL"; - exit; + print "Error: this template page cannot be called directly as an URL"; + exit; } - $usemargins = 0; if (!empty($conf->margin->enabled) && !empty($object->element) && in_array($object->element, array('facture', 'facturerec', 'propal', 'commande'))) { - $usemargins = 1; + $usemargins = 1; } - if (!isset($dateSelector)) global $dateSelector; // Take global var only if not already defined into function calling (for example formAddObjectLine) global $forceall, $forcetoshowtitlelines, $senderissupplier, $inputalsopricewithtax; - if (!isset($dateSelector)) $dateSelector = 1; // For backward compatibility elseif (empty($dateSelector)) $dateSelector = 0; if (empty($forceall)) $forceall = 0; if (empty($senderissupplier)) $senderissupplier = 0; if (empty($inputalsopricewithtax)) $inputalsopricewithtax = 0; - - // Define colspan for the button 'Add' $colspan = 3; // Columns: total ht + col edit + col delete if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) $colspan++; //Add column for Total (currency) if required if (in_array($object->element, array('propal', 'commande', 'order', 'facture', 'facturerec', 'invoice', 'supplier_proposal', 'order_supplier', 'invoice_supplier'))) $colspan++; // With this, there is a column move button //print $object->element; - // Lines for extrafield $objectline = null; if (!empty($extrafields)) @@ -89,290 +83,268 @@ if (!empty($extrafields)) $objectline = new FactureLigneRec($this->db); } } - - print "\n"; $nolinesbefore=(count($this->lines) == 0 || $forcetoshowtitlelines); if ($nolinesbefore) { ?> - - global->MAIN_VIEW_LINE_NUMBER)) { ?> - - - -
trans('AddNewLine'); ?>trans("FreeZone"); ?> - - element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines - { - ?> - trans('SupplierRef'); ?> + + global->MAIN_VIEW_LINE_NUMBER)) { ?> + + + +
trans('AddNewLine'); ?>trans("FreeZone"); ?> + - trans('VAT'); ?> - trans('PriceUHT'); ?> - multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { ?> - trans('PriceUHTCurrency'); ?> - - - trans('PriceUTTC'); ?> - - trans('Qty'); ?> - global->PRODUCT_USE_UNITS) - { - print ''; - print ''; - print $langs->trans('Unit'); - print ''; - } - ?> - trans('ReductionShort'); ?> - situation_cycle_ref) { - print '' . $langs->trans('Progress') . ''; - print ''; - } - if (! empty($usemargins)) - { - if (empty($user->rights->margins->creer)) { - $colspan++; + if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines + { + ?> + trans('SupplierRef'); ?> + '; - if ($conf->global->MARGIN_TYPE == "1") - echo $langs->trans('BuyingPrice'); - else - echo $langs->trans('CostPrice'); - echo ''; - if (! empty($conf->global->DISPLAY_MARGIN_RATES)) echo ''.$langs->trans('MarginRate').''; - if (! empty($conf->global->DISPLAY_MARK_RATES)) echo ''.$langs->trans('MarkRate').''; + ?> + trans('VAT'); ?> + trans('PriceUHT'); ?> + multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { ?> + trans('PriceUHTCurrency'); ?> + + + trans('PriceUTTC'); ?> + + trans('Qty'); ?> + global->PRODUCT_USE_UNITS) + { + print ''; + print ''; + print $langs->trans('Unit'); + print ''; } - } - ?> -   - + ?> + trans('ReductionShort'); ?> + situation_cycle_ref) { + print '' . $langs->trans('Progress') . ''; + print ''; + } + if (! empty($usemargins)) + { + if (empty($user->rights->margins->creer)) { + $colspan++; + } + else { + print ''; + if ($conf->global->MARGIN_TYPE == "1") + echo $langs->trans('BuyingPrice'); + else + echo $langs->trans('CostPrice'); + echo ''; + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) echo ''.$langs->trans('MarginRate').''; + if (! empty($conf->global->DISPLAY_MARK_RATES)) echo ''.$langs->trans('MarkRate').''; + } + } + ?> +   + -global->MAIN_VIEW_LINE_NUMBER)) { - $coldisplay++; - echo ''; -} - -$coldisplay++; -?> + global->MAIN_VIEW_LINE_NUMBER)) { + $coldisplay++; + echo ''; + } + $coldisplay++; + ?> -global->MAIN_DISABLE_FREE_LINES)) -{ - $freelines = true; - $forceall=1; // We always force all type for free lines (module product or service means we use predefined product or service) - if ($object->element == 'contrat') - { - if (empty($conf->product->enabled) && empty($conf->service->enabled) && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $forceall=-1; // With contract, by default, no choice at all, except if CONTRACT_SUPPORT_PRODUCTS is set - elseif (empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $forceall=3; - } - - // Free line - echo ''; - // Show radio free line - if ($forceall >= 0 && (! empty($conf->product->enabled) || ! empty($conf->service->enabled))) - { - echo ''; - echo ' '; - } - else - { - echo ''; - // Show type selector - if ($forceall >= 0) + global->MAIN_DISABLE_FREE_LINES)) { - if (empty($conf->product->enabled) || empty($conf->service->enabled)) echo $langs->trans("Type"); - else echo $langs->trans("FreeLineOfType"); + $freelines = true; + $forceall=1; // We always force all type for free lines (module product or service means we use predefined product or service) + if ($object->element == 'contrat') + { + if (empty($conf->product->enabled) && empty($conf->service->enabled) && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $forceall=-1; // With contract, by default, no choice at all, except if CONTRACT_SUPPORT_PRODUCTS is set + elseif (empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $forceall=3; + } + // Free line + echo ''; + // Show radio free line + if ($forceall >= 0 && (! empty($conf->product->enabled) || ! empty($conf->service->enabled))) + { + echo ''; + echo ' '; + } + else + { + echo ''; + // Show type selector + if ($forceall >= 0) + { + if (empty($conf->product->enabled) || empty($conf->service->enabled)) echo $langs->trans("Type"); + else echo $langs->trans("FreeLineOfType"); + echo ' '; + } + } + echo $form->select_type_of_lines(isset($_POST["type"])?GETPOST("type", 'alpha', 2):-1, 'type', 1, 1, $forceall); + echo ''; + } + // Predefined product/service + if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) + { + if ($forceall >= 0 && $freelines) echo '
'; + echo ''; + echo ''; echo ' '; - } - } - - echo $form->select_type_of_lines(isset($_POST["type"])?GETPOST("type", 'alpha', 2):-1, 'type', 1, 1, $forceall); - - echo ''; -} - -// Predefined product/service -if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) -{ - if ($forceall >= 0 && $freelines) echo '
'; - echo ''; - echo ''; - echo ' '; - - $filtertype=''; - if (! empty($object->element) && $object->element == 'contrat' && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $filtertype='1'; - - if (empty($senderissupplier)) - { - $statustoshow = 1; - if (! empty($conf->global->ENTREPOT_EXTRA_STATUS)) - { - // hide products in closed warehouse, but show products for internal transfer - $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth300', 0, 'warehouseopen,warehouseinternal', GETPOST('combinations', 'array')); - } - else - { - $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth300', 0, '', GETPOST('combinations', 'array')); - } - - if (! empty($conf->global->MAIN_AUTO_OPEN_SELECT2_ON_FOCUS_FOR_CUSTOMER_PRODUCTS)) - { + $filtertype=''; + if (! empty($object->element) && $object->element == 'contrat' && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $filtertype='1'; + if (empty($senderissupplier)) + { + $statustoshow = 1; + if (! empty($conf->global->ENTREPOT_EXTRA_STATUS)) + { + // hide products in closed warehouse, but show products for internal transfer + $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, 'warehouseopen,warehouseinternal', GETPOST('combinations', 'array')); + } + else + { + $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')); + } + if (! empty($conf->global->MAIN_AUTO_OPEN_SELECT2_ON_FOCUS_FOR_CUSTOMER_PRODUCTS)) + { + ?> + + array('qty'=>'qty','remise_percent' => 'discount','idprod' => 'idprod'), // html id tags that will be edited with which ajax json response key + 'option_disabled' => 'idthatdoesnotexists', // html id to disable once select is done + 'warning' => $langs->trans("NoPriceDefinedForThisSupplier") // translation of an error saved into var 'warning' (for example shown we select a disabled option into combo) + ); + $alsoproductwithnosupplierprice=0; + } + else + { + $ajaxoptions = array( + 'update' => array('remise_percent' => 'discount') // html id tags that will be edited with each ajax json response key + ); + $alsoproductwithnosupplierprice=1; + } + $form->select_produits_fournisseurs($object->socid, GETPOST('idprodfournprice'), 'idprodfournprice', '', '', $ajaxoptions, 1, $alsoproductwithnosupplierprice, 'maxwidth500'); + if (! empty($conf->global->MAIN_AUTO_OPEN_SELECT2_ON_FOCUS_FOR_SUPPLIER_PRODUCTS)) + { ?> - - array('qty'=>'qty','remise_percent' => 'discount','idprod' => 'idprod'), // html id tags that will be edited with which ajax json response key - 'option_disabled' => 'idthatdoesnotexists', // html id to disable once select is done - 'warning' => $langs->trans("NoPriceDefinedForThisSupplier") // translation of an error saved into var 'warning' (for example shown we select a disabled option into combo) - ); - $alsoproductwithnosupplierprice=0; - } - else - { - $ajaxoptions = array( - 'update' => array('remise_percent' => 'discount') // html id tags that will be edited with each ajax json response key - ); - $alsoproductwithnosupplierprice=1; - } - - $form->select_produits_fournisseurs($object->socid, GETPOST('idprodfournprice'), 'idprodfournprice', '', '', $ajaxoptions, 1, $alsoproductwithnosupplierprice, 'maxwidth300'); - - if (! empty($conf->global->MAIN_AUTO_OPEN_SELECT2_ON_FOCUS_FOR_SUPPLIER_PRODUCTS)) - { - ?> - - '; - echo ''; -} - -if (is_object($hookmanager) && empty($senderissupplier)) -{ - $parameters=array('fk_parent_line'=>GETPOST('fk_parent_line', 'int')); - $reshook=$hookmanager->executeHooks('formCreateProductOptions', $parameters, $object, $action); - if (!empty($hookmanager->resPrint)) { - print $hookmanager->resPrint; - } -} -if (is_object($hookmanager) && ! empty($senderissupplier)) -{ - $parameters=array('htmlname'=>'addproduct'); - $reshook=$hookmanager->executeHooks('formCreateProductSupplierOptions', $parameters, $object, $action); - if (!empty($hookmanager->resPrint)) { - print $hookmanager->resPrint; - } -} - - -if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { - if (!empty($conf->variants->enabled)) { - echo '
'; - } - - echo '
'; -} - -// Editor wysiwyg -require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; -$nbrows=ROWS_2; -$enabled=(! empty($conf->global->FCKEDITOR_ENABLE_DETAILS)?$conf->global->FCKEDITOR_ENABLE_DETAILS:0); -if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; -$toolbarname='dolibarr_details'; -if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname='dolibarr_notes'; -$doleditor=new DolEditor('dp_desc', GETPOST('dp_desc', 'none'), '', (empty($conf->global->MAIN_DOLEDITOR_HEIGHT)?100:$conf->global->MAIN_DOLEDITOR_HEIGHT), $toolbarname, '', false, true, $enabled, $nbrows, '98%'); -$doleditor->Create(); - -// Show autofill date for recurring invoices -if (! empty($conf->service->enabled) && $object->element == 'facturerec') -{ - echo '

'; - echo $langs->trans('AutoFillDateFrom').' '; - echo $form->selectyesno('date_start_fill', $line->date_start_fill, 1); - echo ' - '; - echo $langs->trans('AutoFillDateTo').' '; - echo $form->selectyesno('date_end_fill', $line->date_end_fill, 1); - echo '
'; -} -echo ''; - -if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines -{ - $coldisplay++; - ?> + + '; + echo '
'; + } + if (is_object($hookmanager) && empty($senderissupplier)) + { + $parameters=array('fk_parent_line'=>GETPOST('fk_parent_line', 'int')); + $reshook=$hookmanager->executeHooks('formCreateProductOptions', $parameters, $object, $action); + if (!empty($hookmanager->resPrint)) { + print $hookmanager->resPrint; + } + } + if (is_object($hookmanager) && ! empty($senderissupplier)) + { + $parameters=array('htmlname'=>'addproduct'); + $reshook=$hookmanager->executeHooks('formCreateProductSupplierOptions', $parameters, $object, $action); + if (!empty($hookmanager->resPrint)) { + print $hookmanager->resPrint; + } + } + if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { + if (!empty($conf->variants->enabled)) { + echo '
'; + } + echo '
'; + } + // Editor wysiwyg + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $nbrows=ROWS_2; + $enabled=(! empty($conf->global->FCKEDITOR_ENABLE_DETAILS)?$conf->global->FCKEDITOR_ENABLE_DETAILS:0); + if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; + $toolbarname='dolibarr_details'; + if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname='dolibarr_notes'; + $doleditor=new DolEditor('dp_desc', GETPOST('dp_desc', 'none'), '', (empty($conf->global->MAIN_DOLEDITOR_HEIGHT)?100:$conf->global->MAIN_DOLEDITOR_HEIGHT), $toolbarname, '', false, true, $enabled, $nbrows, '98%'); + $doleditor->Create(); + // Show autofill date for recurring invoices + if (! empty($conf->service->enabled) && $object->element == 'facturerec') + { + echo '

'; + echo $langs->trans('AutoFillDateFrom').' '; + echo $form->selectyesno('date_start_fill', $line->date_start_fill, 1); + echo ' - '; + echo $langs->trans('AutoFillDateTo').' '; + echo $form->selectyesno('date_end_fill', $line->date_end_fill, 1); + echo '
'; + } + echo ''; + if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines + { + $coldisplay++; + ?> "> '; $coldisplay++; if ($seller->tva_assuj == "0") echo ''.vatrate(0, true); @@ -381,84 +353,78 @@ else echo $form->load_tva('tva_tx', (isset($_POST["tva_tx"])?GETPOST("tva_tx", ' - "> + "> -multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { - $coldisplay++; + multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { + $coldisplay++; + ?> + + "> + + + + "> + + - - "> - - - - "> - - "> -global->PRODUCT_USE_UNITS) -{ - $coldisplay++; - print ''; - print $form->selectUnits($line->fk_unit, "units"); - print ''; -} -$remise_percent = $buyer->remise_percent; -if($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') -{ - $remise_percent = $seller->remise_supplier_percent; -} - -$coldisplay++; -?> + global->PRODUCT_USE_UNITS) + { + $coldisplay++; + print ''; + print $form->selectUnits($line->fk_unit, "units"); + print ''; + } + $remise_percent = $buyer->remise_percent; + if($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') + { + $remise_percent = $seller->remise_supplier_percent; + } + $coldisplay++; + ?> ">% -situation_cycle_ref) { - $coldisplay++; - print '%'; - $coldisplay++; - print ''; -} - -if (! empty($usemargins)) -{ - if (!empty($user->rights->margins->creer)) { - $coldisplay++; - ?> + situation_cycle_ref) { + $coldisplay++; + print '%'; + $coldisplay++; + print ''; + } + if (! empty($usemargins)) + { + if (!empty($user->rights->margins->creer)) { + $coldisplay++; + ?> - product->enabled) || ! empty($conf->service->enabled)) { ?> - - + product->enabled) || ! empty($conf->service->enabled)) { ?> + + "> - global->DISPLAY_MARGIN_RATES)) - { - echo '%'; - $coldisplay++; - } - if (! empty($conf->global->DISPLAY_MARK_RATES)) - { - echo '%'; - $coldisplay++; + global->DISPLAY_MARGIN_RATES)) + { + echo '%'; + $coldisplay++; + } + if (! empty($conf->global->DISPLAY_MARK_RATES)) + { + echo '%'; + $coldisplay++; + } } } -} - -$coldisplay+=$colspan; -?> + $coldisplay+=$colspan; + ?> @@ -468,196 +434,193 @@ $coldisplay+=$colspan; if (is_object($objectline)) { print $objectline->showOptionals($extrafields, 'edit', array('colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD) ? 0 : 1); } - if ((!empty($conf->service->enabled) || ($object->element == 'contrat')) && $dateSelector && GETPOST('type') != '0') // We show date field if required { - ?> +?> - > +> global->MAIN_VIEW_LINE_NUMBER)) { print ''; } ?> - element) && $object->element == 'contrat') - { - print $langs->trans("DateStartPlanned").' '; - print $form->selectDate($date_start, "date_start", $usehm, $usehm, 1, "addproduct"); - print '   '.$langs->trans("DateEndPlanned").' '; - print $form->selectDate($date_end, "date_end", $usehm, $usehm, 1, "addproduct"); - } - else - { - echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' '; - print $form->selectDate($date_start, 'date_start', empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? 0 : 1, empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? 0 : 1, 1, "addproduct", 1, 0); - echo ' '.$langs->trans('to').' '; - print $form->selectDate($date_end, 'date_end', empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? 0 : 1, empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? 0 : 1, 1, "addproduct", 1, 0); - }; - print ''; + print ''; + print "\n"; } - } - print ''; - print ''; - print "\n"; -} + print " + /* At loading, no product are yet selected, so we hide field of buying_price */ + $("#buying_price").hide(); - + /* Define default price at loading */ + var defaultprice = $("#fournprice_predef").find('option:selected').attr("price"); + $("#buying_price").val(defaultprice); + + $("#fournprice_predef").change(function() { + console.log("change on fournprice_predef"); + /* Hide field buying_price according to choice into list (if 'inputprice' or not) */ + var linevalue=$(this).find('option:selected').val(); + var pricevalue = $(this).find('option:selected').attr("price"); + if (linevalue != 'inputprice' && linevalue != 'pmpprice') { + $("#buying_price").val(pricevalue).hide(); /* We set value then hide field */ + } + if (linevalue == 'inputprice') { + $('#buying_price').show(); + } + if (linevalue == 'pmpprice') { + $("#buying_price").val(pricevalue); + $('#buying_price').hide(); + } + }); + } + }, + 'json'); + + + + /* To process customer price per quantity */ + var pbq = parseInt($('option:selected', this).attr('data-pbq')); + var pbqqty = parseFloat($('option:selected', this).attr('data-pbqqty')); + var pbqpercent = parseFloat($('option:selected', this).attr('data-pbqpercent')); + + if ((jQuery('#idprod').val() > 0 || jQuery('#idprodfournprice').val()) && typeof pbq !== "undefined") + { + console.log("We choose a price by quanty price_by_qty id = "+pbq+" price_by_qty qty = "+pbqqty+" price_by_qty percent = "+pbqpercent); + jQuery("#pbq").val(pbq); + if (jQuery("#qty").val() < pbqqty) + { + jQuery("#qty").val(pbqqty); + } + if (jQuery("#remise_percent").val() < pbqpercent) + { + jQuery("#remise_percent").val(pbqpercent); + } + } + else + { + jQuery("#pbq").val(''); + } + + /* To set focus */ + if (jQuery('#idprod').val() > 0 || jQuery('#idprodfournprice').val() > 0) + { + /* focus work on a standard textarea but not if field was replaced with CKEDITOR */ + jQuery('#dp_desc').focus(); + /* focus if CKEDITOR */ + if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined") + { + var editor = CKEDITOR.instances['dp_desc']; + if (editor) { editor.focus(); } + } + } + }); + + + setforpredef(); + + }); + + /* Function to set fields from choice */ + function setforfree() { + console.log("Call setforfree. We show most fields"); + jQuery("#idprodfournprice").val('0'); // Set cursor on not selected product + jQuery("#prod_entry_mode_free").prop('checked',true).change(); + jQuery("#prod_entry_mode_predef").prop('checked',false).change(); + jQuery("#search_idprod, #idprod, #search_idprodfournprice, #buying_price").val(''); + jQuery("#price_ht, #multicurrency_price_ht, #price_ttc, #price_ttc, #fourn_ref, #tva_tx, #buying_price, #title_vat, #title_up_ht, #title_up_ht_currency, #title_up_ttc, #title_up_ttc_currency").show(); + jQuery("#np_marginRate, #np_markRate, .np_marginRate, .np_markRate, #units, #title_units").show(); + jQuery("#fournprice_predef").hide(); + } + function setforpredef() { + console.log("Call setforpredef. We hide some fields and show dates"); + jQuery("#select_type").val(-1); + jQuery("#prod_entry_mode_free").prop('checked',false).change(); + jQuery("#prod_entry_mode_predef").prop('checked',true).change(); + global->MAIN_DISABLE_EDIT_PREDEF_PRICEHT)) { ?> + jQuery("#price_ht").val('').show(); + jQuery("#multicurrency_price_ht").val('').show(); + + jQuery("#price_ht").val('').hide(); + jQuery("#multicurrency_price_ht").val('').hide(); + + jQuery("#price_ht").val(''); + jQuery("#price_ttc, #fourn_ref, #tva_tx, #title_vat, #title_up_ht_currency, #title_up_ttc, #title_up_ttc_currency").hide(); + jQuery("#np_marginRate, #np_markRate, .np_marginRate, .np_markRate, #units, #title_units").hide(); + jQuery("#buying_price").show(); + jQuery('#trlinefordates, .divlinefordates').show(); + } + + + +