Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix: pgsql

  • Loading branch information...
commit 83b4b151e4aa61eb1e05432a19ee173653c184ac 1 parent 9df0538
Laurent Destailleur eldy authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 htdocs/core/lib/functions2.lib.php
6 htdocs/core/lib/functions2.lib.php
View
@@ -476,14 +476,14 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
if (dol_strlen($reg[$posy]) == 2) $yearcomp=sprintf("%02d",date("y",$date)+$yearoffset);
if (dol_strlen($reg[$posy]) == 1) $yearcomp=substr(date("y",$date),2,1)+$yearoffset;
$sqlwhere='';
- $sqlwhere.='( (SUBSTRING('.$field.', '.(dol_strlen($reg[1])+1).', '.dol_strlen($reg[2]).') >= '.$yearcomp;
+ $sqlwhere.='( (SUBSTRING('.$field.', '.(dol_strlen($reg[1])+1).', '.dol_strlen($reg[2]).") >= '".$yearcomp."'";
if ($monthcomp > 1) // Test useless if monthcomp = 1 (or 0 is same as 1)
{
if (dol_strlen($reg[$posy]) == 4) $yearcomp1=sprintf("%04d",date("Y",$date)+$yearoffset+1);
if (dol_strlen($reg[$posy]) == 2) $yearcomp1=sprintf("%02d",date("y",$date)+$yearoffset+1);
// FIXME If mask is {mm}{yy}, sqlwhere is wrong here
- $sqlwhere.=' AND SUBSTRING('.$field.', '.(dol_strlen($reg[1])+dol_strlen($reg[2])+1).', '.dol_strlen($reg[3]).') >= '.$monthcomp.')';
- $sqlwhere.=' OR SUBSTRING('.$field.', '.(dol_strlen($reg[1])+1).', '.dol_strlen($reg[2]).') >= '.$yearcomp1.' )';
+ $sqlwhere.=' AND SUBSTRING('.$field.', '.(dol_strlen($reg[1])+dol_strlen($reg[2])+1).', '.dol_strlen($reg[3]).") >= '".$monthcomp."')";
+ $sqlwhere.=' OR SUBSTRING('.$field.', '.(dol_strlen($reg[1])+1).', '.dol_strlen($reg[2]).") >= '".$yearcomp1."' )";
}
else
{
Please sign in to comment.
Something went wrong with that request. Please try again.