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);
190 $resql = $this->db->query($sql);
192 if ($this->db->num_rows($resql)) {
193 $obj = $this->db->fetch_object($resql);
195 $this->
id = $obj->rowid;
196 $this->userid = $obj->fk_user;
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;
220 $this->db->free($resql);