mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-15 05:51:28 +01:00
Fix: more simple too
This commit is contained in:
@@ -647,20 +647,19 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
|
|||||||
// For backward compatibility
|
// 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
|
else if (date("m",$date) < $maskraz) { $yearoffset=-1; } // If current month lower that month of return to zero, year is previous year
|
||||||
|
|
||||||
if (dol_strlen($reg[$posy]) == 4) $yearcomp=sprintf("%04d",date("Y",$date)+$yearoffset);
|
$yearlen = dol_strlen($reg[$posy]);
|
||||||
if (dol_strlen($reg[$posy]) == 2) $yearcomp=sprintf("%02d",date("y",$date)+$yearoffset);
|
if ($yearlen == 4) $yearcomp=sprintf("%04d",date("Y",$date)+$yearoffset);
|
||||||
if (dol_strlen($reg[$posy]) == 1) $yearcomp=substr(date("y",$date),2,1)+$yearoffset;
|
elseif ($yearlen == 2) $yearcomp=sprintf("%02d",date("y",$date)+$yearoffset);
|
||||||
|
elseif ($yearlen == 1) $yearcomp=substr(date("y",$date),2,1)+$yearoffset;
|
||||||
if ($monthcomp > 1) // Test with month is useless if monthcomp = 0 or 1 (0 is same as 1) (regis: $monthcomp can't equal 0)
|
if ($monthcomp > 1) // Test with month is useless if monthcomp = 0 or 1 (0 is same as 1) (regis: $monthcomp can't equal 0)
|
||||||
{
|
{
|
||||||
if (dol_strlen($reg[$posy]) == 4) $yearcomp1=sprintf("%04d",date("Y",$date)+$yearoffset+1);
|
if ($yearlen == 4) $yearcomp1=sprintf("%04d",date("Y",$date)+$yearoffset+1);
|
||||||
if (dol_strlen($reg[$posy]) == 2) $yearcomp1=sprintf("%02d",date("y",$date)+$yearoffset+1);
|
elseif ($yearlen == 2) $yearcomp1=sprintf("%02d",date("y",$date)+$yearoffset+1);
|
||||||
|
|
||||||
$yearlen = dol_strlen($reg[$posy]);
|
|
||||||
$monthlen = dol_strlen($reg[$posm]);
|
$monthlen = dol_strlen($reg[$posm]);
|
||||||
if ($posy == 2) {
|
$yearpos = (dol_strlen($reg[1])+1);
|
||||||
$yearpos = (dol_strlen($reg[1])+1);
|
$monthpos = ($yearpos+$yearlen);
|
||||||
$monthpos = ($yearpos+$yearlen);
|
if ($posy == 3) {
|
||||||
} else {
|
|
||||||
$monthpos = (dol_strlen($reg[1])+1);
|
$monthpos = (dol_strlen($reg[1])+1);
|
||||||
$yearpos = ($monthpos+$monthlen);
|
$yearpos = ($monthpos+$monthlen);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user