Fix: Postgresql compatibility

This commit is contained in:
eldy 2011-09-20 23:44:40 +02:00
parent 991f80a00d
commit 7cdfc2618a

View File

@ -16,11 +16,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/* /**
* \files htdocs/societe/class/companybankaccount.class.php * \file htdocs/societe/class/companybankaccount.class.php
* \ingroup societe * \ingroup societe
* \brief File of class to manage bank accounts description of third parties * \brief File of class to manage bank accounts description of third parties
* \version $Id: companybankaccount.class.php,v 1.11 2011/07/31 23:22:58 eldy Exp $
*/ */
require_once(DOL_DOCUMENT_ROOT ."/compta/bank/class/account.class.php"); require_once(DOL_DOCUMENT_ROOT ."/compta/bank/class/account.class.php");
@ -49,6 +48,8 @@ class CompanyBankAccount extends Account
/** /**
* Constructor * Constructor
*
* @param DoliDB $DB Database handler
*/ */
function CompanyBankAccount($DB) function CompanyBankAccount($DB)
{ {
@ -65,10 +66,13 @@ class CompanyBankAccount extends Account
/** /**
* Create bank information record * Create bank information record
* *
* @return int <0 if KO, >= 0 if OK
*/ */
function create() function create()
{ {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_rib (fk_soc, datec) values ($this->socid, ".$this->db->idate(mktime()).")"; $now=dol_now();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_rib (fk_soc, datec) values ($this->socid, '".$this->db->idate($now)."')";
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
@ -85,12 +89,13 @@ class CompanyBankAccount extends Account
} }
/** /**
* Update bank account
* *
* * @param User $user Object user
* @return int <=0 if KO, >0 if OK
*/ */
function update($user='') function update($user='')
{ {
$sql = "SELECT fk_soc FROM ".MAIN_DB_PREFIX."societe_rib"; $sql = "SELECT fk_soc FROM ".MAIN_DB_PREFIX."societe_rib";
$sql .= " WHERE fk_soc = ".$this->socid; $sql .= " WHERE fk_soc = ".$this->socid;
@ -135,8 +140,10 @@ class CompanyBankAccount extends Account
/** /**
* Load record from database * Load record from database
* @param id Id of record *
* @param socid Id of company * @param int $id Id of record
* @param int $socid Id of company
* @return int <0 if KO, >0 if OK
*/ */
function fetch($id,$socid=0) function fetch($id,$socid=0)
{ {