Fix: Check receipts are stored in banque directory

This commit is contained in:
Laurent Destailleur 2009-06-29 18:12:47 +00:00
parent ff8ea099e0
commit c274fbb9f9

View File

@ -66,7 +66,7 @@ class RemiseCheque extends CommonObject
function Fetch($id,$ref='') function Fetch($id,$ref='')
{ {
global $conf; global $conf;
$sql = "SELECT bc.rowid, bc.datec, bc.fk_user_author, bc.fk_bank_account, bc.amount, bc.number, bc.statut, bc.nbcheque"; $sql = "SELECT bc.rowid, bc.datec, bc.fk_user_author, bc.fk_bank_account, bc.amount, bc.number, bc.statut, bc.nbcheque";
$sql.= ", ".$this->db->pdate("bc.date_bordereau"). " as date_bordereau"; $sql.= ", ".$this->db->pdate("bc.date_bordereau"). " as date_bordereau";
$sql.= ", ba.label as account_label"; $sql.= ", ba.label as account_label";
@ -121,7 +121,7 @@ class RemiseCheque extends CommonObject
function Create($user, $account_id) function Create($user, $account_id)
{ {
global $conf; global $conf;
$this->errno = 0; $this->errno = 0;
$this->id = 0; $this->id = 0;
@ -258,7 +258,7 @@ class RemiseCheque extends CommonObject
function Delete($user='') function Delete($user='')
{ {
global $conf; global $conf;
$this->errno = 0; $this->errno = 0;
$this->db->begin(); $this->db->begin();
@ -282,7 +282,7 @@ class RemiseCheque extends CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX."bank"; $sql = "UPDATE ".MAIN_DB_PREFIX."bank";
$sql.= " SET fk_bordereau = 0"; $sql.= " SET fk_bordereau = 0";
$sql.= " WHERE fk_bordereau = '".$this->id."'"; $sql.= " WHERE fk_bordereau = '".$this->id."'";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (!$resql) if (!$resql)
{ {
@ -374,7 +374,7 @@ class RemiseCheque extends CommonObject
function getNextNumber() function getNextNumber()
{ {
global $conf; global $conf;
$num=0; $num=0;
// We use +0 to convert varchar to number // We use +0 to convert varchar to number
@ -415,7 +415,7 @@ class RemiseCheque extends CommonObject
$now=gmmktime(); $now=gmmktime();
$this->nbtodo=$this->nbtodolate=0; $this->nbtodo=$this->nbtodolate=0;
$sql = "SELECT b.rowid, b.datev as datefin"; $sql = "SELECT b.rowid, b.datev as datefin";
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b"; $sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql.= ", ".MAIN_DB_PREFIX."bank_account as ba"; $sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
@ -506,7 +506,7 @@ class RemiseCheque extends CommonObject
// We save charset_output to restore it because write_file can change it if needed for // We save charset_output to restore it because write_file can change it if needed for
// output format that does not support UTF8. // output format that does not support UTF8.
$sav_charset_output=$outputlangs->charset_output; $sav_charset_output=$outputlangs->charset_output;
$result=$pdf->write_file($conf->comptabilite->dir_output.'/bordereau', $this->number, $outputlangs); $result=$pdf->write_file($conf->banque->dir_output.'/bordereau', $this->number, $outputlangs);
if ($result > 0) if ($result > 0)
{ {
$outputlangs->charset_output=$sav_charset_output; $outputlangs->charset_output=$sav_charset_output;
@ -534,7 +534,7 @@ class RemiseCheque extends CommonObject
function UpdateAmount() function UpdateAmount()
{ {
global $conf; global $conf;
$this->errno = 0; $this->errno = 0;
$this->db->begin(); $this->db->begin();
$total = 0; $total = 0;
@ -559,7 +559,7 @@ class RemiseCheque extends CommonObject
$sql.= ", nbcheque = ".$nb; $sql.= ", nbcheque = ".$nb;
$sql.= " WHERE rowid = ".$this->id; $sql.= " WHERE rowid = ".$this->id;
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (!$resql) if (!$resql)
{ {
@ -601,7 +601,7 @@ class RemiseCheque extends CommonObject
$sql.= " SET fk_bordereau = 0"; $sql.= " SET fk_bordereau = 0";
$sql.= " WHERE rowid = '".$account_id."'"; $sql.= " WHERE rowid = '".$account_id."'";
$sql.= " AND fk_bordereau = ".$this->id; $sql.= " AND fk_bordereau = ".$this->id;
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
@ -622,7 +622,7 @@ class RemiseCheque extends CommonObject
function load_previous_next_id() function load_previous_next_id()
{ {
global $conf; global $conf;
$this->errno = 0; $this->errno = 0;
$sql = "SELECT MAX(rowid)"; $sql = "SELECT MAX(rowid)";
@ -642,7 +642,7 @@ class RemiseCheque extends CommonObject
$sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque"; $sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque";
$sql.= " WHERE rowid > ".$this->id; $sql.= " WHERE rowid > ".$this->id;
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$result = $this->db->query($sql) ; $result = $this->db->query($sql) ;
if (! $result) if (! $result)
{ {