Fix: pgql compatibility
This commit is contained in:
parent
54effb5b27
commit
1872f6b12d
@ -24,7 +24,7 @@
|
|||||||
* \file htdocs/compta/bank/class/account.class.php
|
* \file htdocs/compta/bank/class/account.class.php
|
||||||
* \ingroup banque
|
* \ingroup banque
|
||||||
* \brief File of class to manage bank accounts
|
* \brief File of class to manage bank accounts
|
||||||
* \version $Id: account.class.php,v 1.31 2011/07/04 09:01:38 eldy Exp $
|
* \version $Id: account.class.php,v 1.32 2011/07/04 10:44:36 eldy Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php");
|
require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php");
|
||||||
@ -769,51 +769,54 @@ class Account extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @param rowid
|
||||||
|
* @param sign 1 or -1
|
||||||
*/
|
*/
|
||||||
function datev_next($rowid)
|
function datev_change($rowid,$sign=1)
|
||||||
{
|
{
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bank SET ";
|
$sql = "SELECT datev FROM ".MAIN_DB_PREFIX."bank WHERE rowid = ".$rowid;
|
||||||
$sql.= " datev = adddate(datev, interval 1 day)";
|
$resql = $this->db->query($sql);
|
||||||
$sql.= " WHERE rowid = ".$rowid;
|
if ($resql)
|
||||||
|
{
|
||||||
|
$obj=$this->db->fetch_object($resql);
|
||||||
|
$newdate=$this->db->jdate($obj->datev)+(3600*24*$sign);
|
||||||
|
|
||||||
$result = $this->db->query($sql);
|
$sql = "UPDATE ".MAIN_DB_PREFIX."bank SET ";
|
||||||
if ($result)
|
$sql.= " datev = '".$this->db->idate($newdate)."'";
|
||||||
{
|
$sql.= " WHERE rowid = ".$rowid;
|
||||||
if ($this->db->affected_rows($result))
|
|
||||||
{
|
$result = $this->db->query($sql);
|
||||||
return 1;
|
if ($result)
|
||||||
}
|
{
|
||||||
}
|
if ($this->db->affected_rows($result))
|
||||||
else
|
{
|
||||||
{
|
return 1;
|
||||||
dol_print_error($this->db);
|
}
|
||||||
return 0;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($this->db);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else dol_print_error($this->db);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @param rowid
|
||||||
|
*/
|
||||||
|
function datev_next($rowid)
|
||||||
|
{
|
||||||
|
return $this->datev_change($rowid,1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param rowid
|
||||||
*/
|
*/
|
||||||
function datev_previous($rowid)
|
function datev_previous($rowid)
|
||||||
{
|
{
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bank SET ";
|
return $this->datev_change($rowid,-1);
|
||||||
$sql.= " datev = adddate(datev, interval -1 day)";
|
|
||||||
$sql.= " WHERE rowid = ".$rowid;
|
|
||||||
|
|
||||||
$result = $this->db->query($sql);
|
|
||||||
if ($result)
|
|
||||||
{
|
|
||||||
if ($this->db->affected_rows($result))
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dol_print_error($this->db);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user