29 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
40 public $element =
'user_bank_account';
45 public $table_element =
'user_rib';
81 $this->error_number = 0;
92 public function create(
User $user =
null, $notrigger = 0)
96 $sql =
"INSERT INTO ".$this->db->prefix().
"user_rib (fk_user, datec)";
97 $sql .=
" VALUES (".$this->userid.
", '".$this->
db->idate($now).
"')";
100 if ($this->
db->affected_rows(
$resql)) {
101 $this->
id = $this->
db->last_insert_id($this->
db->prefix().
"user_rib");
103 return $this->
update($user);
106 print $this->
db->error();
126 $sql =
"UPDATE ".$this->db->prefix().
"user_rib SET";
127 $sql .=
" bank = '".$this->db->escape($this->bank).
"'";
128 $sql .=
",code_banque='".$this->db->escape($this->code_banque).
"'";
129 $sql .=
",code_guichet='".$this->db->escape($this->code_guichet).
"'";
130 $sql .=
",number='".$this->db->escape($this->number).
"'";
131 $sql .=
",cle_rib='".$this->db->escape($this->cle_rib).
"'";
132 $sql .=
",bic='".$this->db->escape($this->bic).
"'";
133 $sql .=
",iban_prefix = '".$this->db->escape($this->iban).
"'";
134 $sql .=
",domiciliation='".$this->db->escape($this->domiciliation).
"'";
135 $sql .=
",proprio = '".$this->db->escape($this->proprio).
"'";
136 $sql .=
",owner_address = '".$this->db->escape($this->owner_address).
"'";
137 $sql .=
",currency_code = '".$this->db->escape($this->currency_code).
"'";
138 $sql .=
",state_id = ".($this->state_id > 0 ? ((int) $this->state_id) :
"null");
139 $sql .=
",fk_country = ".($this->country_id > 0 ? ((int) $this->country_id) :
"null");
141 if (trim($this->label) !=
'') {
142 $sql .=
",label = '".$this->db->escape($this->label).
"'";
144 $sql .=
",label = NULL";
146 $sql .=
" WHERE rowid = ".((int) $this->
id);
148 $result = $this->
db->query($sql);
165 public function fetch($id, $ref =
'', $userid = 0)
167 if (empty($id) && empty($ref) && empty($userid)) {
171 $sql =
"SELECT ur.rowid, ur.fk_user, ur.entity, ur.bank, ur.number, ur.code_banque, ur.code_guichet, ur.cle_rib, ur.bic, ur.iban_prefix as iban, ur.domiciliation, ur.proprio";
172 $sql .=
", ur.owner_address, ur.label, ur.datec, ur.tms as datem";
173 $sql .=
', ur.currency_code, ur.state_id, ur.fk_country as country_id';
174 $sql .=
', c.code as country_code, c.label as country';
175 $sql .=
', d.code_departement as state_code, d.nom as state';
176 $sql .=
" FROM ".$this->db->prefix().
"user_rib as ur";
177 $sql .=
' LEFT JOIN '.$this->db->prefix().
'c_country as c ON ur.fk_country=c.rowid';
178 $sql .=
' LEFT JOIN '.$this->db->prefix().
'c_departements as d ON ur.state_id=d.rowid';
181 $sql .=
" WHERE ur.rowid = ".((int) $id);
184 $sql .=
" WHERE ur.label = '".$this->db->escape($ref).
"'";
187 $sql .=
" WHERE ur.fk_user = ".((int) $userid);
193 $obj = $this->
db->fetch_object(
$resql);
195 $this->
id = $obj->rowid;
196 $this->userid = $obj->fk_soc;
197 $this->bank = $obj->bank;
198 $this->code_banque = $obj->code_banque;
199 $this->code_guichet = $obj->code_guichet;
200 $this->number = $obj->number;
201 $this->cle_rib = $obj->cle_rib;
202 $this->bic = $obj->bic;
203 $this->iban = $obj->iban;
204 $this->domiciliation = $obj->domiciliation;
205 $this->proprio = $obj->proprio;
206 $this->owner_address = $obj->owner_address;
207 $this->label = $obj->label;
208 $this->datec = $this->
db->jdate($obj->datec);
209 $this->datem = $this->
db->jdate($obj->datem);
210 $this->currency_code = $obj->currency_code;
212 $this->state_id = $obj->state_id;
213 $this->state_code = $obj->state_code;
214 $this->state = $obj->state;
216 $this->country_id = $obj->country_id;
217 $this->country_code = $obj->country_code;
218 $this->country = $obj->country;
239 if ($this->code_banque || $this->code_guichet || $this->number || $this->cle_rib) {
240 if ($this->label && $displayriblabel) {
241 $rib = $this->label.
" : ";
Class to manage bank accounts.
solde($option=0, $date_end='', $field='dateo')
Return current sold.
Class to manage Dolibarr database access.
Class to manage bank accounts description of users.
update(User $user=null, $notrigger=0)
Update bank account.
create(User $user=null, $notrigger=0)
Create bank information record.
getRibLabel($displayriblabel=true)
Return RIB.
__construct(DoliDB $db)
Constructor.
fetch($id, $ref='', $userid=0)
Load record from database.
Class to manage Dolibarr users.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_now($mode='auto')
Return date for now.
$conf db
API class for accounts.