dolibarr 19.0.4
companybankaccount.class.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2010-2023 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
5 * Copyright (C) 2013 Peter Fontaine <contact@peterfontaine.fr>
6 * Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
28require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
29
30
35{
39 public $element = 'societe_rib';
40
44 public $table_element = 'societe_rib';
45
85 // BEGIN MODULEBUILDER PROPERTIES
89 public $fields=array(
90 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>-1,),
91 'type' => array('type'=>'varchar(32)', 'label'=>'Type', 'enabled'=>'1', 'position'=>15, 'notnull'=>1, 'visible'=>-1,),
92 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'picto'=>'company', 'enabled'=>'1', 'position'=>20, 'notnull'=>1, 'visible'=>-1, 'css'=>'maxwidth500 widthcentpercentminusxx', 'csslist'=>'tdoverflowmax150',),
93 'datec' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>25, 'notnull'=>0, 'visible'=>-1,),
94 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>-1,),
95 'label' => array('type'=>'varchar(200)', 'label'=>'Label', 'enabled'=>'1', 'position'=>35, 'notnull'=>0, 'visible'=>-1, 'alwayseditable'=>'1', 'css'=>'minwidth300', 'cssview'=>'wordbreak', 'csslist'=>'tdoverflowmax150',),
96 'bank' => array('type'=>'varchar(255)', 'label'=>'Bank', 'enabled'=>'1', 'position'=>40, 'notnull'=>0, 'visible'=>-1, 'alwayseditable'=>'1',),
97 'code_banque' => array('type'=>'varchar(128)', 'label'=>'Codebanque', 'enabled'=>'1', 'position'=>45, 'notnull'=>0, 'visible'=>-1, 'alwayseditable'=>'1',),
98 'code_guichet' => array('type'=>'varchar(6)', 'label'=>'Codeguichet', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>-1, 'alwayseditable'=>'1',),
99 'number' => array('type'=>'varchar(255)', 'label'=>'Number', 'enabled'=>'1', 'position'=>55, 'notnull'=>0, 'visible'=>-1, 'alwayseditable'=>'1',),
100 'cle_rib' => array('type'=>'varchar(5)', 'label'=>'Clerib', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>-1, 'alwayseditable'=>'1',),
101 'bic' => array('type'=>'varchar(20)', 'label'=>'Bic', 'enabled'=>'1', 'position'=>65, 'notnull'=>0, 'visible'=>-1, 'alwayseditable'=>'1',),
102 'iban_prefix' => array('type'=>'varchar(34)', 'label'=>'Ibanprefix', 'enabled'=>'1', 'position'=>70, 'notnull'=>0, 'visible'=>-1, 'alwayseditable'=>'1',),
103 'domiciliation' => array('type'=>'varchar(255)', 'label'=>'Domiciliation', 'enabled'=>'1', 'position'=>75, 'notnull'=>0, 'visible'=>-1, 'alwayseditable'=>'1',),
104 'proprio' => array('type'=>'varchar(60)', 'label'=>'Proprio', 'enabled'=>'1', 'position'=>80, 'notnull'=>0, 'visible'=>-1, 'alwayseditable'=>'1',),
105 'owner_address' => array('type'=>'varchar(255)', 'label'=>'Owneraddress', 'enabled'=>'1', 'position'=>85, 'notnull'=>0, 'visible'=>-1, 'alwayseditable'=>'1',),
106 'default_rib' => array('type'=>'smallint(6)', 'label'=>'Defaultrib', 'enabled'=>'1', 'position'=>90, 'notnull'=>1, 'visible'=>-1, 'alwayseditable'=>'1',),
107 'state_id' => array('type'=>'integer', 'label'=>'Stateid', 'enabled'=>'1', 'position'=>95, 'notnull'=>0, 'visible'=>-1, 'alwayseditable'=>'1',),
108 'fk_country' => array('type'=>'integer', 'label'=>'Fkcountry', 'enabled'=>'1', 'position'=>100, 'notnull'=>0, 'visible'=>-1, 'alwayseditable'=>'1', 'css'=>'maxwidth500 widthcentpercentminusxx',),
109 'currency_code' => array('type'=>'varchar(3)', 'label'=>'Currencycode', 'enabled'=>'1', 'position'=>105, 'notnull'=>0, 'visible'=>-1, 'alwayseditable'=>'1',),
110 'rum' => array('type'=>'varchar(32)', 'label'=>'Rum', 'enabled'=>'1', 'position'=>110, 'notnull'=>0, 'visible'=>-1, 'alwayseditable'=>'1',),
111 'date_rum' => array('type'=>'date', 'label'=>'Daterum', 'enabled'=>'1', 'position'=>115, 'notnull'=>0, 'visible'=>-1, 'alwayseditable'=>'1',),
112 'frstrecur' => array('type'=>'varchar(16)', 'label'=>'Frstrecur', 'enabled'=>'1', 'position'=>120, 'notnull'=>0, 'visible'=>-1, 'alwayseditable'=>'1',),
113 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>'1', 'position'=>900, 'notnull'=>0, 'visible'=>-2, 'alwayseditable'=>'1',),
114 'last_four' => array('type'=>'varchar(4)', 'label'=>'Lastfour', 'enabled'=>'1', 'position'=>130, 'notnull'=>0, 'visible'=>-1, 'alwayseditable'=>'1',),
115 'card_type' => array('type'=>'varchar(255)', 'label'=>'Cardtype', 'enabled'=>'1', 'position'=>135, 'notnull'=>0, 'visible'=>-1, 'alwayseditable'=>'1',),
116 'cvn' => array('type'=>'varchar(255)', 'label'=>'Cvn', 'enabled'=>'1', 'position'=>140, 'notnull'=>0, 'visible'=>-1, 'alwayseditable'=>'1',),
117 'exp_date_month' => array('type'=>'integer', 'label'=>'Expdatemonth', 'enabled'=>'1', 'position'=>145, 'notnull'=>0, 'visible'=>-1, 'alwayseditable'=>'1',),
118 'exp_date_year' => array('type'=>'integer', 'label'=>'Expdateyear', 'enabled'=>'1', 'position'=>150, 'notnull'=>0, 'visible'=>-1, 'alwayseditable'=>'1',),
119 'country_code' => array('type'=>'varchar(10)', 'label'=>'Countrycode', 'enabled'=>'1', 'position'=>155, 'notnull'=>0, 'visible'=>-1, 'alwayseditable'=>'1',),
120 'approved' => array('type'=>'integer', 'label'=>'Approved', 'enabled'=>'1', 'position'=>160, 'notnull'=>0, 'visible'=>-1, 'alwayseditable'=>'1',),
121 'email' => array('type'=>'varchar(255)', 'label'=>'Email', 'enabled'=>'1', 'position'=>165, 'notnull'=>0, 'visible'=>-1, 'alwayseditable'=>'1',),
122 'ending_date' => array('type'=>'date', 'label'=>'Endingdate', 'enabled'=>'1', 'position'=>170, 'notnull'=>0, 'visible'=>-1, 'alwayseditable'=>'1',),
123 'max_total_amount_of_all_payments' => array('type'=>'double(24,8)', 'label'=>'Maxtotalamountofallpayments', 'enabled'=>'1', 'position'=>175, 'notnull'=>0, 'visible'=>-1, 'alwayseditable'=>'1',),
124 'preapproval_key' => array('type'=>'varchar(255)', 'label'=>'Preapprovalkey', 'enabled'=>'1', 'position'=>180, 'notnull'=>0, 'visible'=>-1, 'alwayseditable'=>'1',),
125 'starting_date' => array('type'=>'date', 'label'=>'Startingdate', 'enabled'=>'1', 'position'=>185, 'notnull'=>0, 'visible'=>-1, 'alwayseditable'=>'1',),
126 'total_amount_of_all_payments' => array('type'=>'double(24,8)', 'label'=>'Totalamountofallpayments', 'enabled'=>'1', 'position'=>190, 'notnull'=>0, 'visible'=>-1, 'alwayseditable'=>'1',),
127 'stripe_card_ref' => array('type'=>'varchar(128)', 'label'=>'Stripecardref', 'enabled'=>'1', 'position'=>195, 'notnull'=>0, 'visible'=>-1, 'alwayseditable'=>'1',),
128 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-1, 'alwayseditable'=>'1',),
129 'comment' => array('type'=>'varchar(255)', 'label'=>'Comment', 'enabled'=>'1', 'position'=>205, 'notnull'=>0, 'visible'=>-1, 'alwayseditable'=>'1',),
130 'ipaddress' => array('type'=>'varchar(68)', 'label'=>'Ipaddress', 'enabled'=>'1', 'position'=>210, 'notnull'=>0, 'visible'=>-1, 'alwayseditable'=>'1',),
131 'stripe_account' => array('type'=>'varchar(128)', 'label'=>'Stripeaccount', 'enabled'=>'1', 'position'=>215, 'notnull'=>0, 'visible'=>-1, 'alwayseditable'=>'1',),
132 'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>1, 'visible'=>0, 'position'=>230),
133 );
134 public $id;
135 public $type;
140 public $fk_soc;
144 public $socid;
145
151 public $datec;
152 public $label;
153 public $bank;
154 public $code_banque;
155 public $code_guichet;
156 public $number;
157 public $cle_rib;
158 public $bic;
159 public $iban_prefix;
160 public $domiciliation;
161 public $proprio;
162 public $owner_address;
163
167 public $default_rib;
168 public $state_id;
169 public $fk_country;
170 public $currency_code;
171 public $rum;
172 public $date_rum;
173
179 public $frstrecur;
180 public $import_key;
181 public $last_four;
182 public $card_type;
183 public $cvn;
184 public $exp_date_month;
185 public $exp_date_year;
186 public $country_code;
187 public $approved;
188 public $email;
189 public $ending_date;
190 public $max_total_amount_of_all_payments;
191 public $preapproval_key;
192 public $starting_date;
193 public $total_amount_of_all_payments;
194
195
196 public $ext_payment_site; // Name of the external payment system ('StripeLive', 'StripeTest', 'StancerLive', 'StancerTest', ...)
197 public $comment;
198 public $ipaddress;
199
200
206 public $stripe_account;
207
213 public $stripe_card_ref;
214
220 public $datem;
221
226 public $model_pdf;
227
233 const TRIGGER_PREFIX = 'COMPANY_RIB';
234
240 public function __construct(DoliDB $db)
241 {
242 $this->db = $db;
243
244 $this->socid = 0;
245 $this->solde = 0;
246 $this->balance = 0;
247 $this->default_rib = 0;
248 $this->type = "ban";
249 }
250
251
259 public function create(User $user = null, $notrigger = 0)
260 {
261 $now = dol_now();
262
263 $error = 0;
264
265 // Check paramaters
266 if (empty($this->socid)) {
267 $this->error = 'BadValueForParameter';
268 $this->errors[] = $this->error;
269 return -1;
270 }
271
272 if (empty($this->datec)) {
273 $this->datec=$now;
274 }
275
276 // Correct ->default_rib to not set the new account as default, if there is already 1. We want to be sure to have always 1 default for type = 'ban'.
277 // If we really want the new bank account to be the default, we must set it by calling setDefault() after creation.
278 $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe_rib where fk_soc = ".((int) $this->socid)." AND default_rib = 1 AND type = 'ban'";
279 $result = $this->db->query($sql);
280 if ($result) {
281 $numrows = $this->db->num_rows($result);
282 if ($this->default_rib && $numrows > 0) {
283 $this->default_rib = 0;
284 }
285 if (empty($this->default_rib) && $numrows == 0) {
286 $this->default_rib = 1;
287 }
288 }
289
290
291 $this->db->begin();
292
293 $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_rib (fk_soc, type, datec, model_pdf)";
294 $sql .= " VALUES (".((int) $this->socid).", '".$this->type."', '".$this->db->idate($this->datec)."',";
295 $sql .= " '".$this->db->escape(getDolGlobalString("BANKADDON_PDF"))."'";
296 $sql .= ")";
297 $resql = $this->db->query($sql);
298 if ($resql) {
299 if ($this->db->affected_rows($resql)) {
300 $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."societe_rib");
301
302 if (!$notrigger) {
303 // Call trigger
304 $result = $this->call_trigger('COMPANY_RIB_CREATE', $user);
305 if ($result < 0) {
306 $error++;
307 }
308 // End call triggers
309 }
310 }
311 } else {
312 $error++;
313 $this->error = $this->db->lasterror();
314 $this->errors[] = $this->error;
315 }
316
317 if (!$error) {
318 $this->db->commit();
319 return $this->id;
320 } else {
321 $this->db->rollback();
322 return -1;
323 }
324 }
325
333 public function update(User $user = null, $notrigger = 0)
334 {
335 global $langs;
336
337 $error = 0;
338
339 if (!$this->id) {
340 return -1;
341 }
342
343 if (dol_strlen($this->domiciliation) > 255) {
344 $this->domiciliation = dol_trunc($this->domiciliation, 254, 'right', 'UTF-8', 1);
345 }
346 if (dol_strlen($this->owner_address) > 255) {
347 $this->owner_address = dol_trunc($this->owner_address, 254, 'right', 'UTF-8', 1);
348 }
349
350 if (isset($this->model_pdf)) {
351 $this->model_pdf = trim($this->model_pdf);
352 }
353
354 $this->db->begin();
355
356 $sql = "UPDATE ".MAIN_DB_PREFIX."societe_rib SET";
357 $sql .= " bank = '".$this->db->escape($this->bank)."'";
358 $sql .= ",code_banque='".$this->db->escape($this->code_banque)."'";
359 $sql .= ",code_guichet='".$this->db->escape($this->code_guichet)."'";
360 $sql .= ",number='".$this->db->escape($this->number)."'";
361 $sql .= ",cle_rib='".$this->db->escape($this->cle_rib)."'";
362 $sql .= ",bic='".$this->db->escape($this->bic)."'";
363 $sql .= ",iban_prefix = '".$this->db->escape($this->iban)."'";
364 $sql .= ",domiciliation = '".$this->db->escape($this->domiciliation)."'";
365 $sql .= ",proprio = '".$this->db->escape($this->proprio)."'";
366 $sql .= ",owner_address = '".$this->db->escape($this->owner_address)."'";
367 $sql .= ",default_rib = ".((int) $this->default_rib);
368 if (isModEnabled('prelevement')) {
369 $sql .= ",frstrecur = '".$this->db->escape($this->frstrecur)."'";
370 $sql .= ",rum = '".$this->db->escape($this->rum)."'";
371 $sql .= ",date_rum = ".($this->date_rum ? "'".$this->db->idate($this->date_rum)."'" : "null");
372 }
373 if (trim($this->label) != '') {
374 $sql .= ",label = '".$this->db->escape($this->label)."'";
375 } else {
376 $sql .= ",label = NULL";
377 }
378 $sql .= ",stripe_card_ref = '".$this->db->escape($this->stripe_card_ref)."'";
379 $sql .= ",stripe_account = '".$this->db->escape($this->stripe_account)."'";
380 $sql .= ",model_pdf=".(isset($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : "null");
381 $sql .= " WHERE rowid = ".((int) $this->id);
382
383 $result = $this->db->query($sql);
384 if ($result) {
385 if (!$notrigger) {
386 // Call trigger
387 $result = $this->call_trigger('COMPANY_RIB_MODIFY', $user);
388 if ($result < 0) {
389 $error++;
390 }
391 // End call triggers
392 }
393 } else {
394 $error++;
395 if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
396 $this->error = $langs->trans('ErrorDuplicateField');
397 } else {
398 $this->error = $this->db->lasterror();
399 }
400 $this->errors[] = $this->error;
401 }
402
403 if (!$error) {
404 $this->db->commit();
405 return 1;
406 } else {
407 $this->db->rollback();
408 return -1;
409 }
410 }
411
421 public function fetch($id, $socid = 0, $default = 1, $type = 'ban')
422 {
423 if (empty($id) && empty($socid)) {
424 return -1;
425 }
426
427 $sql = "SELECT rowid, type, fk_soc as socid, bank, number, code_banque, code_guichet, cle_rib, bic, iban_prefix as iban, domiciliation, proprio,";
428 $sql .= " owner_address, default_rib, label, datec, tms as datem, rum, frstrecur, date_rum,";
429 $sql .= " stripe_card_ref, stripe_account, ext_payment_site";
430 $sql .= " ,last_main_doc";
431 $sql .= " ,model_pdf";
432
433 $sql .= " FROM ".MAIN_DB_PREFIX."societe_rib";
434 if ($id) {
435 $sql .= " WHERE rowid = ".((int) $id);
436 } elseif ($socid > 0) {
437 $sql .= " WHERE fk_soc = ".((int) $socid);
438 if ($default > -1) {
439 $sql .= " AND default_rib = ".((int) $default);
440 }
441 if ($type) {
442 $sql .= " AND type = '".$this->db->escape($type)."'";
443 }
444 }
445
446 $resql = $this->db->query($sql);
447 if ($resql) {
448 if ($this->db->num_rows($resql)) {
449 $obj = $this->db->fetch_object($resql);
450
451 $this->ref = $obj->socid.'-'.$obj->label; // Generate an artificial ref
452
453 $this->id = $obj->rowid;
454 $this->type = $obj->type;
455 $this->socid = $obj->socid;
456 $this->bank = $obj->bank;
457 $this->code_banque = $obj->code_banque;
458 $this->code_guichet = $obj->code_guichet;
459 $this->number = $obj->number;
460 $this->cle_rib = $obj->cle_rib;
461 $this->bic = $obj->bic;
462 $this->iban = $obj->iban;
463 $this->domiciliation = $obj->domiciliation;
464 $this->proprio = $obj->proprio;
465 $this->owner_address = $obj->owner_address;
466 $this->label = $obj->label;
467 $this->default_rib = $obj->default_rib;
468 $this->datec = $this->db->jdate($obj->datec);
469 $this->datem = $this->db->jdate($obj->datem);
470 $this->rum = $obj->rum;
471 $this->frstrecur = $obj->frstrecur;
472 $this->date_rum = $this->db->jdate($obj->date_rum);
473 $this->stripe_card_ref = $obj->stripe_card_ref; // External system payment mode ID
474 $this->stripe_account = $obj->stripe_account; // External system customer ID
475 $this->ext_payment_site= $obj->ext_payment_site; // External system name ('StripeLive', 'StripeTest', 'StancerLive', 'StancerTest', ...)
476 $this->last_main_doc = $obj->last_main_doc;
477 $this->model_pdf = $obj->model_pdf;
478 }
479 $this->db->free($resql);
480
481 return 1;
482 } else {
483 dol_print_error($this->db);
484 return -1;
485 }
486 }
487
495 public function delete(User $user = null, $notrigger = 0)
496 {
497 $error = 0;
498
499 dol_syslog(get_class($this)."::delete ".$this->id, LOG_DEBUG);
500
501 $this->db->begin();
502
503 if (!$error && !$notrigger) {
504 // Call trigger
505 $result = $this->call_trigger('COMPANY_RIB_DELETE', $user);
506 if ($result < 0) {
507 $error++;
508 }
509 // End call triggers
510 }
511
512 if (!$error) {
513 $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_rib";
514 $sql .= " WHERE rowid = ".((int) $this->id);
515
516 if (!$this->db->query($sql)) {
517 $error++;
518 $this->errors[] = $this->db->lasterror();
519 }
520 }
521
522 if (!$error) {
523 $this->db->commit();
524 return 1;
525 } else {
526 $this->db->rollback();
527 return -1 * $error;
528 }
529 }
530
537 public function getRibLabel($displayriblabel = true)
538 {
539 $rib = '';
540
541 if ($this->code_banque || $this->code_guichet || $this->number || $this->cle_rib || $this->iban || $this->bic) {
542 if ($this->label && $displayriblabel) {
543 $rib = $this->label." : ";
544 }
545
546 $rib .= $this->iban;
547 }
548
549 return $rib;
550 }
551
559 public function setAsDefault($rib = 0, $resetolddefaultfor = 'ban')
560 {
561 $sql1 = "SELECT rowid as id, fk_soc as socid FROM ".MAIN_DB_PREFIX."societe_rib";
562 $sql1 .= " WHERE rowid = ".($rib ? $rib : $this->id);
563
564 dol_syslog(get_class($this).'::setAsDefault', LOG_DEBUG);
565 $result1 = $this->db->query($sql1);
566 if ($result1) {
567 if ($this->db->num_rows($result1) == 0) {
568 return 0;
569 } else {
570 $obj = $this->db->fetch_object($result1);
571
572 $this->db->begin();
573
574 $sql2 = "UPDATE ".MAIN_DB_PREFIX."societe_rib SET default_rib = 0";
575 $sql2 .= " WHERE fk_soc = ".((int) $obj->socid);
576 if ($resetolddefaultfor) {
577 $sql2 .= " AND type = '".$this->db->escape($resetolddefaultfor)."'";
578 }
579 $result2 = $this->db->query($sql2);
580
581 $sql3 = "UPDATE ".MAIN_DB_PREFIX."societe_rib SET default_rib = 1";
582 $sql3 .= " WHERE rowid = ".((int) $obj->id);
583 $result3 = $this->db->query($sql3);
584
585 if (!$result2 || !$result3) {
586 dol_print_error($this->db);
587 $this->db->rollback();
588 return -1;
589 } else {
590 $this->db->commit();
591 return 1;
592 }
593 }
594 } else {
595 dol_print_error($this->db);
596 return -1;
597 }
598 }
599
607 public function initAsSpecimen()
608 {
609 $this->specimen = 1;
610 $this->ref = 'CBA';
611 $this->label = 'CustomerCorp Bank account';
612 $this->bank = 'CustomerCorp Bank';
613 $this->courant = Account::TYPE_CURRENT;
614 $this->clos = Account::STATUS_OPEN;
615 $this->code_banque = '123';
616 $this->code_guichet = '456';
617 $this->number = 'CUST12345';
618 $this->cle_rib = 50;
619 $this->bic = 'CC12';
620 $this->iban = 'FR999999999';
621 $this->domiciliation = 'Bank address of customer corp';
622 $this->proprio = 'Owner';
623 $this->owner_address = 'Owner address';
624 $this->country_id = 1;
625
626 $this->rum = 'UMR-CU1212-0007-5-1475405262';
627 $this->date_rum = dol_now() - 10000;
628 $this->frstrecur = 'FRST';
629
630 $this->socid = 1;
631 }
632}
$object ref
Definition info.php:79
Class to manage bank accounts.
solde($option=0, $date_end='', $field='dateo')
Return current sold.
error()
Return error.
const TYPE_CURRENT
Current account.
call_trigger($triggerName, $user)
Call trigger based on this instance.
Class to manage bank accounts description of third parties.
setAsDefault($rib=0, $resetolddefaultfor='ban')
Set a BAN as Default.
getRibLabel($displayriblabel=true)
Return RIB.
update(User $user=null, $notrigger=0)
Update bank account.
initAsSpecimen()
Initialise an instance with random values.
create(User $user=null, $notrigger=0)
Create bank information record.
__construct(DoliDB $db)
Constructor.
fetch($id, $socid=0, $default=1, $type='ban')
Load record from database.
Class to manage Dolibarr database access.
Class to manage Dolibarr users.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
dol_now($mode='auto')
Return date for now.
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
Definition repair.php:121