Normalize code
This commit is contained in:
parent
354e8156d4
commit
ad1ec032f3
@ -871,7 +871,7 @@ else
|
|||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("FiscalMonthStart").'</td><td>';
|
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("FiscalMonthStart").'</td><td>';
|
||||||
$monthstart=(! empty($conf->global->SOCIETE_FISCAL_MONTH_START)) ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1;
|
$monthstart=(! empty($conf->global->SOCIETE_FISCAL_MONTH_START)) ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1;
|
||||||
print monthArrayOrSelected($monthstart) . '</td></tr>';
|
print dol_print_date(dol_mktime(12,0,0,$monthstart,1,2000,1),'%B','gm') . '</td></tr>';
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
|
|||||||
@ -542,16 +542,18 @@ class FormOther
|
|||||||
*/
|
*/
|
||||||
function select_month($selected='',$htmlname='monthid',$useempty=0)
|
function select_month($selected='',$htmlname='monthid',$useempty=0)
|
||||||
{
|
{
|
||||||
|
global $langs;
|
||||||
|
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php");
|
||||||
|
|
||||||
$month = monthArrayOrSelected(-1); // Get array
|
$montharray = monthArray($langs); // Get array
|
||||||
|
|
||||||
$select_month = '<select class="flat" name="'.$htmlname.'">';
|
$select_month = '<select class="flat" name="'.$htmlname.'">';
|
||||||
if ($useempty)
|
if ($useempty)
|
||||||
{
|
{
|
||||||
$select_month .= '<option value="0"> </option>';
|
$select_month .= '<option value="0"> </option>';
|
||||||
}
|
}
|
||||||
foreach ($month as $key => $val)
|
foreach ($montharray as $key => $val)
|
||||||
{
|
{
|
||||||
if ($selected == $key)
|
if ($selected == $key)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -697,45 +697,27 @@ function num_open_day($timestampStart, $timestampEnd,$inhour=0,$lastday=0)
|
|||||||
/**
|
/**
|
||||||
* Return array of translated months or selected month
|
* Return array of translated months or selected month
|
||||||
*
|
*
|
||||||
* @param int $selected -1 to return array of all months or motnh to select
|
* @param Translate $outputlangs Object langs
|
||||||
* @return mixed Month string or array if selected < 0
|
* @return array Month string or array if selected < 0
|
||||||
*/
|
*/
|
||||||
function monthArrayOrSelected($selected=0)
|
function monthArray($outputlangs)
|
||||||
{
|
{
|
||||||
global $langs;
|
$montharray = array (
|
||||||
|
1 => $outputlangs->trans("January"),
|
||||||
$month = array (
|
2 => $outputlangs->trans("February"),
|
||||||
1 => $langs->trans("January"),
|
3 => $outputlangs->trans("March"),
|
||||||
2 => $langs->trans("February"),
|
4 => $outputlangs->trans("April"),
|
||||||
3 => $langs->trans("March"),
|
5 => $outputlangs->trans("May"),
|
||||||
4 => $langs->trans("April"),
|
6 => $outputlangs->trans("June"),
|
||||||
5 => $langs->trans("May"),
|
7 => $outputlangs->trans("July"),
|
||||||
6 => $langs->trans("June"),
|
8 => $outputlangs->trans("August"),
|
||||||
7 => $langs->trans("July"),
|
9 => $outputlangs->trans("September"),
|
||||||
8 => $langs->trans("August"),
|
10 => $outputlangs->trans("October"),
|
||||||
9 => $langs->trans("September"),
|
11 => $outputlangs->trans("November"),
|
||||||
10 => $langs->trans("October"),
|
12 => $outputlangs->trans("December")
|
||||||
11 => $langs->trans("November"),
|
|
||||||
12 => $langs->trans("December")
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($selected >=0)
|
return $montharray;
|
||||||
{
|
|
||||||
$return='';
|
|
||||||
foreach ($month as $key => $val)
|
|
||||||
{
|
|
||||||
if ($selected == $key)
|
|
||||||
{
|
|
||||||
$return = $val;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return $month;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
Loading…
Reference in New Issue
Block a user