dolibarr  21.0.0-alpha
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  * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
8  * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <https://www.gnu.org/licenses/>.
22  */
23 
30 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
31 
32 
37 {
41  public $element = 'societe_rib';
42 
46  public $table_element = 'societe_rib';
47 
87  // BEGIN MODULEBUILDER PROPERTIES
91  public $fields = array(
92  'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 10, 'notnull' => 1, 'visible' => -1,),
93  'type' => array('type' => 'varchar(32)', 'label' => 'Type', 'enabled' => 1, 'position' => 15, 'notnull' => 1, 'visible' => -1,),
94  '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',),
95  'datec' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'position' => 25, 'notnull' => 0, 'visible' => -1,),
96  'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'position' => 30, 'notnull' => 1, 'visible' => -1,),
97  'label' => array('type' => 'varchar(200)', 'label' => 'Label', 'enabled' => 1, 'position' => 35, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1, 'css' => 'minwidth300', 'cssview' => 'wordbreak', 'csslist' => 'tdoverflowmax150',),
98  'bank' => array('type' => 'varchar(255)', 'label' => 'Bank', 'enabled' => 1, 'position' => 40, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,),
99  'code_banque' => array('type' => 'varchar(128)', 'label' => 'Codebanque', 'enabled' => 1, 'position' => 45, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,),
100  'code_guichet' => array('type' => 'varchar(6)', 'label' => 'Codeguichet', 'enabled' => 1, 'position' => 50, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,),
101  'number' => array('type' => 'varchar(255)', 'label' => 'Number', 'enabled' => 1, 'position' => 55, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,),
102  'cle_rib' => array('type' => 'varchar(5)', 'label' => 'Clerib', 'enabled' => 1, 'position' => 60, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,),
103  'bic' => array('type' => 'varchar(20)', 'label' => 'Bic', 'enabled' => 1, 'position' => 65, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,),
104  'iban_prefix' => array('type' => 'varchar(34)', 'label' => 'Ibanprefix', 'enabled' => 1, 'position' => 70, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,),
105  'domiciliation' => array('type' => 'varchar(255)', 'label' => 'Domiciliation', 'enabled' => 1, 'position' => 75, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,),
106  'proprio' => array('type' => 'varchar(60)', 'label' => 'Proprio', 'enabled' => 1, 'position' => 80, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,),
107  'owner_address' => array('type' => 'varchar(255)', 'label' => 'Owneraddress', 'enabled' => 1, 'position' => 85, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,),
108  'default_rib' => array('type' => 'smallint(6)', 'label' => 'Defaultrib', 'enabled' => 1, 'position' => 90, 'notnull' => 1, 'visible' => -1, 'alwayseditable' => 1,),
109  'state_id' => array('type' => 'integer', 'label' => 'Stateid', 'enabled' => 1, 'position' => 95, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,),
110  'fk_country' => array('type' => 'integer', 'label' => 'Fkcountry', 'enabled' => 1, 'position' => 100, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1, 'css' => 'maxwidth500 widthcentpercentminusxx',),
111  'currency_code' => array('type' => 'varchar(3)', 'label' => 'Currencycode', 'enabled' => 1, 'position' => 105, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,),
112  'rum' => array('type' => 'varchar(32)', 'label' => 'Rum', 'enabled' => 1, 'position' => 110, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,),
113  'date_rum' => array('type' => 'date', 'label' => 'Daterum', 'enabled' => 1, 'position' => 115, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,),
114  'frstrecur' => array('type' => 'varchar(16)', 'label' => 'Frstrecur', 'enabled' => 1, 'position' => 120, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,),
115  'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'position' => 900, 'notnull' => 0, 'visible' => -2, 'alwayseditable' => 1,),
116  'last_four' => array('type' => 'varchar(4)', 'label' => 'Lastfour', 'enabled' => 1, 'position' => 130, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,),
117  'card_type' => array('type' => 'varchar(255)', 'label' => 'Cardtype', 'enabled' => 1, 'position' => 135, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,),
118  'cvn' => array('type' => 'varchar(255)', 'label' => 'Cvn', 'enabled' => 1, 'position' => 140, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,),
119  'exp_date_month' => array('type' => 'integer', 'label' => 'Expdatemonth', 'enabled' => 1, 'position' => 145, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,),
120  'exp_date_year' => array('type' => 'integer', 'label' => 'Expdateyear', 'enabled' => 1, 'position' => 150, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,),
121  'country_code' => array('type' => 'varchar(10)', 'label' => 'Countrycode', 'enabled' => 1, 'position' => 155, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,),
122  'approved' => array('type' => 'integer', 'label' => 'Approved', 'enabled' => 1, 'position' => 160, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,),
123  'email' => array('type' => 'varchar(255)', 'label' => 'Email', 'enabled' => 1, 'position' => 165, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,),
124  'ending_date' => array('type' => 'date', 'label' => 'Endingdate', 'enabled' => 1, 'position' => 170, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,),
125  'max_total_amount_of_all_payments' => array('type' => 'double(24,8)', 'label' => 'Maxtotalamountofallpayments', 'enabled' => 1, 'position' => 175, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,),
126  'preapproval_key' => array('type' => 'varchar(255)', 'label' => 'Preapprovalkey', 'enabled' => 1, 'position' => 180, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,),
127  'starting_date' => array('type' => 'date', 'label' => 'Startingdate', 'enabled' => 1, 'position' => 185, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,),
128  'total_amount_of_all_payments' => array('type' => 'double(24,8)', 'label' => 'Totalamountofallpayments', 'enabled' => 1, 'position' => 190, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,),
129  'stripe_card_ref' => array('type' => 'varchar(128)', 'label' => 'Stripecardref', 'enabled' => 1, 'position' => 195, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,),
130  'status' => array('type' => 'integer', 'label' => 'Status', 'enabled' => 1, 'position' => 500, 'notnull' => 1, 'visible' => -1, 'alwayseditable' => 1,),
131  'comment' => array('type' => 'varchar(255)', 'label' => 'Comment', 'enabled' => 1, 'position' => 205, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,),
132  'ipaddress' => array('type' => 'varchar(68)', 'label' => 'Ipaddress', 'enabled' => 1, 'position' => 210, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,),
133  'stripe_account' => array('type' => 'varchar(128)', 'label' => 'Stripeaccount', 'enabled' => 1, 'position' => 215, 'notnull' => 0, 'visible' => -1, 'alwayseditable' => 1,),
134  'last_main_doc' => array('type' => 'varchar(255)', 'label' => 'LastMainDoc', 'enabled' => 1, 'visible' => 0, 'position' => 230),
135  );
136 
140  public $id;
141 
145  public $type;
146 
151  public $fk_soc;
152 
156  public $socid;
157 
163  public $datec;
164 
168  public $label;
169  public $code_banque;
170  public $code_guichet;
171  public $number;
172  public $cle_rib;
173  public $bic;
174  public $iban_prefix;
175 
176  public $bank;
177 
181  public $state_id;
182 
186  public $fk_country;
187 
188  public $country_code;
189 
193  public $default_rib;
194 
198  public $currency_code;
199 
203  public $rum;
204 
208  public $date_rum;
209 
215  public $frstrecur;
216  public $import_key;
217  public $last_four;
218  public $card_type;
219  public $cvn;
220  public $exp_date_month;
221  public $exp_date_year;
222  public $approved;
223 
227  public $email;
228  public $ending_date;
229  public $max_total_amount_of_all_payments;
230  public $preapproval_key;
231  public $starting_date;
232  public $total_amount_of_all_payments;
233 
234 
238  public $ext_payment_site; // Name of the external payment system ('StripeLive', 'StripeTest', 'StancerLive', 'StancerTest', ...)
239 
243  public $comment;
244 
248  public $ipaddress;
249 
250 
256  public $stripe_account;
257 
263  public $stripe_card_ref;
264 
270  public $datem;
271 
276  public $model_pdf;
277 
283  const TRIGGER_PREFIX = 'COMPANY_RIB';
284 
290  public function __construct(DoliDB $db)
291  {
292  $this->db = $db;
293 
294  $this->socid = 0;
295  $this->solde = 0;
296  $this->balance = 0;
297  $this->default_rib = 0;
298  $this->type = "ban";
299  }
300 
301 
309  public function create(User $user = null, $notrigger = 0)
310  {
311  $now = dol_now();
312 
313  $error = 0;
314 
315  // Check parameters
316  if (empty($this->socid)) {
317  $this->error = 'BadValueForParameter';
318  $this->errors[] = $this->error;
319  return -1;
320  }
321 
322  if (empty($this->datec)) {
323  $this->datec = $now;
324  }
325 
326  // 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'.
327  // If we really want the new bank account to be the default, we must set it by calling setDefault() after creation.
328  $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe_rib where fk_soc = ".((int) $this->socid)." AND default_rib = 1 AND type = 'ban'";
329  $result = $this->db->query($sql);
330  if ($result) {
331  $numrows = $this->db->num_rows($result);
332  if ($this->default_rib && $numrows > 0) {
333  $this->default_rib = 0;
334  }
335  if (empty($this->default_rib) && $numrows == 0) {
336  $this->default_rib = 1;
337  }
338  }
339 
340 
341  $this->db->begin();
342 
343  $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_rib (fk_soc, type, datec, model_pdf)";
344  $sql .= " VALUES (".((int) $this->socid).", '".$this->type."', '".$this->db->idate($this->datec)."',";
345  $sql .= " '".$this->db->escape(getDolGlobalString("BANKADDON_PDF"))."'";
346  $sql .= ")";
347  $resql = $this->db->query($sql);
348  if ($resql) {
349  if ($this->db->affected_rows($resql)) {
350  $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."societe_rib");
351 
352  if (!$notrigger) {
353  // Call trigger
354  $result = $this->call_trigger('COMPANY_RIB_CREATE', $user);
355  if ($result < 0) {
356  $error++;
357  }
358  // End call triggers
359  }
360  }
361  } else {
362  $error++;
363  $this->error = $this->db->lasterror();
364  $this->errors[] = $this->error;
365  }
366 
367  if (!$error) {
368  $this->db->commit();
369  return $this->id;
370  } else {
371  $this->db->rollback();
372  return -1;
373  }
374  }
375 
383  public function update(User $user = null, $notrigger = 0)
384  {
385  global $langs;
386 
387  $error = 0;
388 
389  if (!$this->id) {
390  return -1;
391  }
392 
393  if (!empty($this->domiciliation) && dol_strlen($this->domiciliation) > 255) {
394  $this->domiciliation = dol_trunc($this->domiciliation, 254, 'right', 'UTF-8', 1);
395  }
396  if (!empty($this->address) && dol_strlen($this->address) > 255) {
397  $this->address = dol_trunc($this->address, 254, 'right', 'UTF-8', 1);
398  }
399  if (dol_strlen($this->owner_address) > 255) {
400  $this->owner_address = dol_trunc($this->owner_address, 254, 'right', 'UTF-8', 1);
401  }
402 
403  if (isset($this->model_pdf)) {
404  $this->model_pdf = trim($this->model_pdf);
405  }
406 
407  $this->db->begin();
408 
409  $sql = "UPDATE ".MAIN_DB_PREFIX."societe_rib SET";
410  $sql .= " bank = '".$this->db->escape($this->bank)."'";
411  $sql .= ",code_banque='".$this->db->escape($this->code_banque)."'";
412  $sql .= ",code_guichet='".$this->db->escape($this->code_guichet)."'";
413  $sql .= ",number='".$this->db->escape($this->number)."'";
414  $sql .= ",cle_rib='".$this->db->escape($this->cle_rib)."'";
415  $sql .= ",bic='".$this->db->escape($this->bic)."'";
416  $sql .= ",iban_prefix = '".$this->db->escape($this->iban)."'";
417  $sql .= ",domiciliation = '".$this->db->escape($this->address ? $this->address : $this->domiciliation)."'";
418  $sql .= ",proprio = '".$this->db->escape($this->proprio)."'";
419  $sql .= ",owner_address = '".$this->db->escape($this->owner_address)."'";
420  $sql .= ",default_rib = ".((int) $this->default_rib);
421  if (isModEnabled('prelevement')) {
422  $sql .= ",frstrecur = '".$this->db->escape($this->frstrecur)."'";
423  $sql .= ",rum = '".$this->db->escape($this->rum)."'";
424  $sql .= ",date_rum = ".($this->date_rum ? "'".$this->db->idate($this->date_rum)."'" : "null");
425  }
426  if (trim($this->label) != '') {
427  $sql .= ",label = '".$this->db->escape($this->label)."'";
428  } else {
429  $sql .= ",label = NULL";
430  }
431  $sql .= ",stripe_card_ref = '".$this->db->escape($this->stripe_card_ref)."'";
432  $sql .= ",stripe_account = '".$this->db->escape($this->stripe_account)."'";
433  $sql .= ",model_pdf=".(isset($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : "null");
434  $sql .= " WHERE rowid = ".((int) $this->id);
435 
436  $result = $this->db->query($sql);
437  if ($result) {
438  if (!$notrigger) {
439  // Call trigger
440  $result = $this->call_trigger('COMPANY_RIB_MODIFY', $user);
441  if ($result < 0) {
442  $error++;
443  }
444  // End call triggers
445  }
446  } else {
447  $error++;
448  if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
449  $this->error = $langs->trans('ErrorDuplicateField');
450  } else {
451  $this->error = $this->db->lasterror();
452  }
453  $this->errors[] = $this->error;
454  }
455 
456  if (!$error) {
457  $this->db->commit();
458  return 1;
459  } else {
460  $this->db->rollback();
461  return -1;
462  }
463  }
464 
475  public function fetch($id, $ref = '', $socid = 0, $default = 1, $type = 'ban')
476  {
477  if (empty($id) && empty($ref) && empty($socid)) {
478  return -1;
479  }
480 
481  $sql = "SELECT rowid, label, type, fk_soc as socid, bank, number, code_banque, code_guichet, cle_rib, bic, iban_prefix as iban,";
482  $sql .= " domiciliation as address,";
483  $sql .= " proprio as owner_name, owner_address, default_rib, datec, tms as datem, rum, frstrecur, date_rum,";
484  $sql .= " stripe_card_ref, stripe_account, ext_payment_site,";
485  $sql .= " last_main_doc, model_pdf";
486  $sql .= " FROM ".MAIN_DB_PREFIX."societe_rib";
487 
488  if ($id) {
489  $sql .= " WHERE rowid = ".((int) $id);
490  } elseif ($ref) {
491  $sql .= " WHERE rowid = ".((int) $ref);
492  } elseif ($socid > 0) {
493  $sql .= " WHERE fk_soc = ".((int) $socid);
494  if ($default > -1) {
495  $sql .= " AND default_rib = ".((int) $default);
496  }
497  if ($type) {
498  $sql .= " AND type = '".$this->db->escape($type)."'";
499  }
500  }
501 
502  $resql = $this->db->query($sql);
503  if ($resql) {
504  if ($this->db->num_rows($resql)) {
505  $obj = $this->db->fetch_object($resql);
506 
507  $this->ref = $obj->socid.'-'.$obj->label; // Generate an artificial ref
508 
509  $this->id = $obj->rowid;
510  $this->type = $obj->type;
511  $this->socid = $obj->socid;
512  $this->bank = $obj->bank;
513  $this->code_banque = $obj->code_banque;
514  $this->code_guichet = $obj->code_guichet;
515  $this->number = $obj->number;
516  $this->cle_rib = $obj->cle_rib;
517  $this->bic = $obj->bic;
518  $this->iban = $obj->iban;
519 
520  $this->domiciliation = $obj->address;
521  $this->address = $obj->address;
522 
523  $this->proprio = $obj->owner_name;
524  $this->owner_name = $obj->owner_name;
525  $this->owner_address = $obj->owner_address;
526  $this->label = $obj->label;
527  $this->default_rib = $obj->default_rib;
528  $this->datec = $this->db->jdate($obj->datec);
529  $this->datem = $this->db->jdate($obj->datem);
530  $this->rum = $obj->rum;
531  $this->frstrecur = $obj->frstrecur;
532  $this->date_rum = $this->db->jdate($obj->date_rum);
533  $this->stripe_card_ref = $obj->stripe_card_ref; // External system payment mode ID
534  $this->stripe_account = $obj->stripe_account; // External system customer ID
535  $this->ext_payment_site = $obj->ext_payment_site; // External system name ('StripeLive', 'StripeTest', 'StancerLive', 'StancerTest', ...)
536  $this->last_main_doc = $obj->last_main_doc;
537  $this->model_pdf = $obj->model_pdf;
538  }
539  $this->db->free($resql);
540 
541  return 1;
542  } else {
543  dol_print_error($this->db);
544  return -1;
545  }
546  }
547 
555  public function delete(User $user = null, $notrigger = 0)
556  {
557  $error = 0;
558 
559  dol_syslog(get_class($this)."::delete ".$this->id, LOG_DEBUG);
560 
561  $this->db->begin();
562 
563  if (!$error && !$notrigger) {
564  // Call trigger
565  $result = $this->call_trigger('COMPANY_RIB_DELETE', $user);
566  if ($result < 0) {
567  $error++;
568  }
569  // End call triggers
570  }
571 
572  if (!$error) {
573  $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_rib";
574  $sql .= " WHERE rowid = ".((int) $this->id);
575 
576  if (!$this->db->query($sql)) {
577  $error++;
578  $this->errors[] = $this->db->lasterror();
579  }
580  }
581 
582  if (!$error) {
583  $this->db->commit();
584  return 1;
585  } else {
586  $this->db->rollback();
587  return -1 * $error;
588  }
589  }
590 
597  public function getRibLabel($displayriblabel = true)
598  {
599  $rib = '';
600 
601  if ($this->code_banque || $this->code_guichet || $this->number || $this->cle_rib || $this->iban || $this->bic) {
602  if ($this->label && $displayriblabel) {
603  $rib = $this->label." : ";
604  }
605 
606  $rib .= $this->iban;
607  }
608 
609  return $rib;
610  }
611 
619  public function setAsDefault($rib = 0, $resetolddefaultfor = 'ban')
620  {
621  $sql1 = "SELECT rowid as id, fk_soc as socid FROM ".MAIN_DB_PREFIX."societe_rib";
622  $sql1 .= " WHERE rowid = ".($rib ? $rib : $this->id);
623 
624  dol_syslog(get_class($this).'::setAsDefault', LOG_DEBUG);
625  $result1 = $this->db->query($sql1);
626  if ($result1) {
627  if ($this->db->num_rows($result1) == 0) {
628  return 0;
629  } else {
630  $obj = $this->db->fetch_object($result1);
631 
632  $this->db->begin();
633 
634  $sql2 = "UPDATE ".MAIN_DB_PREFIX."societe_rib SET default_rib = 0";
635  $sql2 .= " WHERE fk_soc = ".((int) $obj->socid);
636  if ($resetolddefaultfor) {
637  $sql2 .= " AND type = '".$this->db->escape($resetolddefaultfor)."'";
638  }
639  $result2 = $this->db->query($sql2);
640 
641  $sql3 = "UPDATE ".MAIN_DB_PREFIX."societe_rib SET default_rib = 1";
642  $sql3 .= " WHERE rowid = ".((int) $obj->id);
643  $result3 = $this->db->query($sql3);
644 
645  if (!$result2 || !$result3) {
646  $this->errors[] = $this->db->lasterror();
647  $this->db->rollback();
648  return -1;
649  } else {
650  $this->db->commit();
651  return 1;
652  }
653  }
654  } else {
655  $this->errors[] = $this->db->lasterror();
656  return -1;
657  }
658  }
659 
667  public function initAsSpecimen()
668  {
669  $this->id = 0;
670  $this->specimen = 1;
671  $this->ref = 'CBA';
672  $this->label = 'CustomerCorp Bank account';
673  $this->bank = 'CustomerCorp Bank';
674  $this->type = 'ban';
675  $this->status = Account::STATUS_OPEN;
676  $this->code_banque = '123';
677  $this->code_guichet = '456';
678  $this->number = 'CUST12345';
679  $this->cle_rib = '50';
680  $this->bic = 'CC12';
681  $this->iban = 'FR999999999';
682 
683  $this->address = 'Rue de Paris';
684  $this->country_id = 1;
685 
686  $this->proprio = 'Owner';
687  $this->owner_name = 'Owner';
688  $this->owner_address = 'Owner address';
689  $this->owner_country_id = 1;
690 
691  $this->rum = 'UMR-CU1212-0007-5-1475405262';
692  $this->date_rum = dol_now() - 10000;
693  $this->frstrecur = 'FRST';
694 
695  $this->socid = 1;
696 
697  return 1;
698  }
699 }
print $langs trans("AuditedSecurityEvents").'</strong >< span class="opacitymedium"></span >< br > status
Or an array listing all the potential status of the object: array: int of the status => translated la...
Definition: security.php:624
$object ref
Definition: info.php:79
Class to manage bank accounts.
solde($option=0, $date_end='', $field='dateo')
Return current balance.
error()
Return error.
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.
fetch($id, $ref='', $socid=0, $default=1, $type='ban')
Load record from database.
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.
Class to manage Dolibarr database access.
Class to manage Dolibarr users.
Definition: user.class.php:50
if(isModEnabled('invoice') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&!getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') && $user->hasRight('tax', 'charges', 'lire')) if(isModEnabled('invoice') &&isModEnabled('order') && $user->hasRight("commande", "lire") &&!getDolGlobalString('WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER')) $sql
Social contributions to pay.
Definition: index.php:751
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
dol_now($mode='auto')
Return date for now.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.
isModEnabled($module)
Is Dolibarr module enabled.
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:139