diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index cda39e3ca9d..b39208b9237 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4727,6 +4727,7 @@ class Form $smin = !isset($conf->global->MAIN_DEFAULT_DATE_MIN) ? '' : $conf->global->MAIN_DEFAULT_DATE_MIN; } + // You can set MAIN_POPUP_CALENDAR to 'eldy' or 'jquery' $usecalendar='combo'; if (! empty($conf->use_javascript_ajax) && (empty($conf->global->MAIN_POPUP_CALENDAR) || $conf->global->MAIN_POPUP_CALENDAR != "none")) $usecalendar=empty($conf->global->MAIN_POPUP_CALENDAR)?'eldy':$conf->global->MAIN_POPUP_CALENDAR; if ($conf->browser->phone) $usecalendar='combo'; @@ -4758,7 +4759,8 @@ class Form { $retstring.=''; + $retstring.=' onClick="showDP(\''.$base.'\',\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\',\''.$langs->defaultlang.'\');"'; + $retstring.='>'.img_object($langs->trans("SelectDate"),'calendarday','class="datecallink"').''; } else $retstring.=''; @@ -4766,6 +4768,37 @@ class Form $retstring.=''."\n"; $retstring.=''."\n"; } + elseif ($usecalendar == 'jquery') + { + if (! $disabled) + { + print ""; + } + + // Zone de saisie manuelle de la date + $retstring.='trans("FormatDateShortJavaInput").'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript + $retstring.='>'; + + // Icone calendrier + if (! $disabled) + { + //$retstring.=''; + } + else $retstring.=''; + + $retstring.=''."\n"; + $retstring.=''."\n"; + $retstring.=''."\n"; + } else { print "Bad value of MAIN_POPUP_CALENDAR"; @@ -6325,40 +6358,40 @@ class Form } return $out; } - + /** * Return HTML to show the select categories of expense category - * + * * @param string $selected preselected category * @param string $htmlname name of HTML select list * @param integer $useempty 1=Add empty line * @param array $excludeid id to exclude * @param string $target htmlname of target select to bind event * @param int $default_selected default category to select if fk_c_type_fees change = EX_KME - * @param array $params param to give + * @param array $params param to give * @return string */ function selectExpenseCategories($selected='', $htmlname='fk_c_exp_tax_cat', $useempty=0, $excludeid=array(), $target='', $default_selected=0, $params=array()) { global $db,$conf,$langs; - + $sql = 'SELECT rowid, label FROM '.MAIN_DB_PREFIX.'c_exp_tax_cat WHERE active = 1'; $sql.= ' AND entity IN (0,'.getEntity('').')'; if (!empty($excludeid)) $sql.= ' AND rowid NOT IN ('.implode(',', $excludeid).')'; $sql.= ' ORDER BY label'; - + $resql = $db->query($sql); if ($resql) { $out = ''; - + if (!empty($target)) { $sql = "SELECT c.id FROM ".MAIN_DB_PREFIX."c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1"; @@ -6374,19 +6407,19 @@ class Form var current_val = $(this).val(); if (current_val == '.$obj->id.') {'; if (!empty($default_selected) || !empty($selected)) $out.= '$("select[name='.$htmlname.']").val("'.($default_selected > 0 ? $default_selected : $selected).'");'; - + $out.= ' $("select[name='.$htmlname.']").change(); } }); $("select[name='.$htmlname.']").change(function() { - + if ($("select[name='.$target.']").val() == '.$obj->id.') { // get price of kilometer to fill the unit price var data = '.json_encode($params).'; data.fk_c_exp_tax_cat = $(this).val(); - + $.ajax({ method: "POST", dataType: "json", @@ -6407,20 +6440,20 @@ class Form }); '; } - } + } } } else { dol_print_error($db); } - + return $out; } - + /** * Return HTML to show the select ranges of expense range - * + * * @param string $selected preselected category * @param string $htmlname name of HTML select list * @param integer $useempty 1=Add empty line @@ -6429,16 +6462,16 @@ class Form function selectExpenseRanges($selected='', $htmlname='fk_range', $useempty=0) { global $db,$conf,$langs; - + $sql = 'SELECT rowid, range_ik FROM '.MAIN_DB_PREFIX.'c_exp_tax_range'; $sql.= ' WHERE entity = '.$conf->entity.' AND active = 1'; - + $resql = $db->query($sql); if ($resql) { $out = ''; if ($useempty) $out.= ''; if ($allchoice) $out.= ''; - + $field = 'code'; if ($useid) $field = 'id'; - + while ($obj = $db->fetch_object($resql)) { $key = $langs->trans($obj->code); @@ -6491,9 +6524,9 @@ class Form { dol_print_error($db); } - + return $out; } - + }