From b90dbb585a4f438c9d2f7859f3437949f27becf1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Jan 2020 22:45:47 +0100 Subject: [PATCH] Fix ident --- htdocs/core/tpl/objectline_create.tpl.php | 711 +++++++++++----------- 1 file changed, 355 insertions(+), 356 deletions(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 3e42e18e3f3..78364aa706a 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -434,389 +434,388 @@ if ($nolinesbefore) { 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"); + print ''."\n"; + if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { print ''; } + print ''; + $date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), 0, GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear')); + $date_end = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), 0, GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear')); + if (!empty($object->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 + { + print $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); + print ' '.$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 ''; - ?> - - -global->MAIN_DEFAULT_DATE_END_MIN)) { + print 'jQuery("#date_endmin").val("'.$conf->global->MAIN_DEFAULT_DATE_END_MIN.'");'; + } + } + print ''; + print ''; + print ''."\n"; } - print " + /* 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(); + } + '; + print "\n";