This commit is contained in:
Rodolphe Quiedeville 2007-01-04 09:13:05 +00:00
parent 8b395505c5
commit 90f1736215

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org> * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr> * Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
@ -23,70 +23,73 @@
*/ */
/** /**
\file htdocs/compta/bank/account.class.php \file htdocs/compta/bank/account.class.php
\ingroup banque \ingroup banque
\brief Fichier de la classe des comptes bancaires \brief Fichier de la classe des comptes bancaires
\version $Revision$ \version $Revision$
*/ */
/** /**
\class Account \class Account
\brief Classe permettant la gestion des comptes bancaires \brief Classe permettant la gestion des comptes bancaires
*/ */
class Account class Account
{ {
var $rowid; var $rowid;
var $ref;
var $ref; var $label;
var $label; var $type;
var $type; var $bank;
var $bank; var $clos;
var $clos; var $rappro;
var $rappro; var $url;
var $url; //! Code banque dans le RIB
var $code_banque;
//! Code guichet dans le RIB
var $code_guichet;
//! Numero du compte dans le RIB
var $number;
//! Cle de controle du RIB
var $cle_rib;
//! Numero BIC du compte
var $bic;
//! Prefix IBAN a utiliser pour creer la cle IBAN International Bank Account Number
var $iban_prefix;
var $proprio;
var $adresse_proprio;
var $type_lib=array();
var $account_number;
var $currency_code;
var $min_allowed;
var $min_desired;
var $comment;
/**
* Constructeur
*/
function Account($DB, $rowid=0)
{
global $langs;
var $code_banque; $this->db = $DB;
var $code_guichet; $this->rowid = $rowid;
var $number;
var $cle_rib; $this->clos = 0;
var $bic; $this->solde = 0;
var $iban_prefix;
var $proprio; $this->type_lib[0]=$langs->trans("BankType0");
var $adresse_proprio; $this->type_lib[1]=$langs->trans("BankType1");
var $type_lib=array(); $this->type_lib[2]=$langs->trans("BankType2");
var $account_number; $this->status[0]=$langs->trans("StatusAccountOpened");
$this->status[1]=$langs->trans("StatusAccountClosed");
var $currency_code;
var $min_allowed; return 1;
var $min_desired; }
var $comment;
/**
* Constructeur
*/
function Account($DB, $rowid=0)
{
global $langs;
$this->db = $DB;
$this->rowid = $rowid;
$this->clos = 0;
$this->solde = 0;
$this->type_lib[0]=$langs->trans("BankType0");
$this->type_lib[1]=$langs->trans("BankType1");
$this->type_lib[2]=$langs->trans("BankType2");
$this->status[0]=$langs->trans("StatusAccountOpened");
$this->status[1]=$langs->trans("StatusAccountClosed");
return 1;
}
/** /**
* \brief Efface une entree dans la table ".MAIN_DB_PREFIX."bank * \brief Efface une entree dans la table ".MAIN_DB_PREFIX."bank
@ -186,34 +189,34 @@ class Account
} }
} }
/** /**
* \brief Ajoute une entree dans la table ".MAIN_DB_PREFIX."bank \brief Ajoute une entree dans la table ".MAIN_DB_PREFIX."bank
* \return int rowid de l'entrée ajoutée, <0 si erreur \return int rowid de l'entrée ajoutée, <0 si erreur
*/ */
function addline($date, $oper, $label, $amount, $num_chq='', $categorie='', $user='',$emetteur='',$banque='') function addline($date, $oper, $label, $amount, $num_chq='', $categorie='', $user='',$emetteur='',$banque='')
{ {
dolibarr_syslog("Account::addline: date=$date, oper=$oper, label=$label, amount=$amount, num_chq=$num_chq, categorie=$categorie, user=$user"); dolibarr_syslog("Account::Addline: date=".$date.", oper=".$oper.", label=".$label.", amount=".$amount.", num_chq=".$num_chq.", categorie=".$categorie.", user=".$user);
if ($this->rowid) if ($this->rowid)
{ {
$this->db->begin(); $this->db->begin();
switch ($oper) switch ($oper)
{ {
case 1: case 1:
$oper = 'TIP'; $oper = 'TIP';
break; break;
case 2: case 2:
$oper = 'VIR'; $oper = 'VIR';
break; break;
case 3: case 3:
$oper = 'PRE'; $oper = 'PRE';
break; break;
case 4: case 4:
$oper = 'LIQ'; $oper = 'LIQ';
break; break;
case 5: case 5:
$oper = 'VAD'; $oper = 'VAD';
break; break;
case 6: case 6:
$oper = 'CB'; $oper = 'CB';
break; break;