Fix: more simple
This commit is contained in:
parent
eee4434850
commit
6151bc3a42
@ -1203,32 +1203,32 @@ function delDocumentModel($name, $type)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the php_info into an array
|
||||
*
|
||||
* @return array Array with PHP infos
|
||||
*/
|
||||
function phpinfo_array()
|
||||
{
|
||||
ob_start();
|
||||
phpinfo();
|
||||
$info_arr = array();
|
||||
$info_lines = explode("\n", strip_tags(ob_get_clean(), "<tr><td><h2>")); // end of ob_start()
|
||||
$cat = "General";
|
||||
foreach($info_lines as $line)
|
||||
{
|
||||
// new cat?
|
||||
preg_match("~<h2>(.*)</h2>~", $line, $title) ? $cat = $title[1] : null;
|
||||
if(preg_match("~<tr><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td></tr>~", $line, $val))
|
||||
{
|
||||
$info_arr[trim($cat)][trim($val[1])] = $val[2];
|
||||
}
|
||||
elseif(preg_match("~<tr><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td></tr>~", $line, $val))
|
||||
{
|
||||
$info_arr[trim($cat)][trim($val[1])] = array("local" => $val[2], "master" => $val[3]);
|
||||
}
|
||||
/**
|
||||
* Return the php_info into an array
|
||||
*
|
||||
* @return array Array with PHP infos
|
||||
*/
|
||||
function phpinfo_array()
|
||||
{
|
||||
ob_start();
|
||||
phpinfo();
|
||||
$info_arr = array();
|
||||
$info_lines = explode("\n", strip_tags(ob_get_clean(), "<tr><td><h2>")); // end of ob_start()
|
||||
$cat = "General";
|
||||
foreach($info_lines as $line)
|
||||
{
|
||||
// new cat?
|
||||
preg_match("~<h2>(.*)</h2>~", $line, $title) ? $cat = $title[1] : null;
|
||||
if(preg_match("~<tr><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td></tr>~", $line, $val))
|
||||
{
|
||||
$info_arr[trim($cat)][trim($val[1])] = $val[2];
|
||||
}
|
||||
elseif(preg_match("~<tr><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td></tr>~", $line, $val))
|
||||
{
|
||||
$info_arr[trim($cat)][trim($val[1])] = array("local" => $val[2], "master" => $val[3]);
|
||||
}
|
||||
}
|
||||
return $info_arr;
|
||||
return $info_arr;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -589,7 +589,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
|
||||
|
||||
// Define $sqlwhere
|
||||
$sqlwhere='';
|
||||
$yearoffset=0; // Use year of current $date by default
|
||||
$yearoffset=0; // Use year of current $date by default
|
||||
$yearoffsettype=false;
|
||||
|
||||
// If a restore to zero after a month is asked we check if there is already a value for this year.
|
||||
@ -635,19 +635,14 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
|
||||
$nextnewyeardate=dol_mktime('0','0','0','1','1',$currentyear+1);
|
||||
//echo 'currentyear='.$currentyear.' date='.dol_print_date($date, 'day').' fiscaldate='.dol_print_date($fiscaldate, 'day').'<br>';
|
||||
|
||||
if ($date >= $fiscaldate) // If after or equal current fiscal date
|
||||
// If after or equal of current fiscal date
|
||||
if ($date >= $fiscaldate)
|
||||
{
|
||||
if ($date < $nextnewyeardate) // If before of next new year date
|
||||
{
|
||||
if ($yearoffsettype == '-') $yearoffset=0;
|
||||
else if ($yearoffsettype == '+') $yearoffset=1;
|
||||
}
|
||||
// If before of next new year date
|
||||
if ($date < $nextnewyeardate && $yearoffsettype == '+') $yearoffset=1;
|
||||
}
|
||||
else if ($date >= $newyeardate) // If after or equal of current new year date
|
||||
{
|
||||
if ($yearoffsettype == '-') $yearoffset=-1;
|
||||
else if ($yearoffsettype == '+') $yearoffset=0;
|
||||
}
|
||||
// If after or equal of current new year date
|
||||
else if ($date >= $newyeardate && $yearoffsettype == '-') $yearoffset=-1;
|
||||
}
|
||||
// For backward compatibility
|
||||
else if (date("m",$date) < $maskraz) { $yearoffset=-1; } // If current month lower that month of return to zero, year is previous year
|
||||
|
||||
Loading…
Reference in New Issue
Block a user