diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 3e447de7ea6..4398be3467e 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -141,8 +141,10 @@ if (empty($reshook)) { $object->iban = trim(GETPOST("iban")); $object->pti_in_ctti = empty(GETPOST("pti_in_ctti")) ? 0 : 1; + $object->domiciliation = trim(GETPOST("account_address", "alphanohtml")); // deprecated + $object->address = trim(GETPOST("account_address", "alphanohtml")); + $object->proprio = trim(GETPOST("proprio", 'alphanohtml')); - $object->domiciliation = trim(GETPOST("domiciliation", "alphanohtml")); $object->owner_address = trim(GETPOST("owner_address", 'alphanohtml')); $object->owner_zip = trim(GETPOST("owner_zip", 'alphanohtml')); $object->owner_town = trim(GETPOST("owner_town", 'alphanohtml')); diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 21f943c9c88..b141de263f1 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -1859,7 +1859,6 @@ class Account extends CommonObject $this->specimen = 1; $this->ref = 'MBA'; $this->label = 'My Big Company Bank account'; - $this->bank = 'MyBank'; $this->courant = Account::TYPE_CURRENT; $this->clos = Account::STATUS_OPEN; $this->code_banque = '30001'; @@ -1868,7 +1867,9 @@ class Account extends CommonObject $this->cle_rib = '85'; $this->bic = 'AA12'; $this->iban = 'FR7630001007941234567890185'; - $this->domiciliation = 'Banque de France'; + + $this->bank = 'MyBank'; + $this->address = 'Rue de Paris'; $this->proprio = 'Owner'; $this->owner_address = 'Owner address'; $this->owner_zip = 'Owner zip'; diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 10b7335522f..2cddd94f5c8 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -2057,7 +2057,7 @@ class BonPrelevement extends CommonObject * @param float $amount amount * @param string $ref ref of invoice * @param int $facid id of invoice - * @param string $rib_dom rib domiciliation + * @param string $rib_dom bank address * @param string $type 'direct-debit' or 'bank-transfer' * @return void * @see EnregDestinataireSEPA() @@ -2082,9 +2082,9 @@ class BonPrelevement extends CommonObject fwrite($this->file, substr(strtoupper($client_nom)." ", 0, 24)); - // Domiciliation facultative D1 - $domiciliation = strtr($rib_dom, array(" " => "-", chr(13) => " ", chr(10) => "")); - fwrite($this->file, substr($domiciliation." ", 0, 24)); + // Address optional D1 + $address = strtr($rib_dom, array(" " => "-", chr(13) => " ", chr(10) => "")); + fwrite($this->file, substr($address." ", 0, 24)); // Zone Reservee D2 diff --git a/htdocs/core/boxes/box_comptes.php b/htdocs/core/boxes/box_comptes.php index 045ffec244b..046ce9034b0 100644 --- a/htdocs/core/boxes/box_comptes.php +++ b/htdocs/core/boxes/box_comptes.php @@ -76,22 +76,23 @@ class box_comptes extends ModeleBoxes $this->info_box_head = array('text' => $langs->trans("BoxTitleCurrentAccounts")); if ($user->hasRight('banque', 'lire')) { - $sql = "SELECT b.rowid, b.ref, b.label, b.bank,b.number, b.courant, b.clos, b.rappro, b.url"; + $sql = "SELECT b.rowid, b.ref, b.label, b.bank, b.number, b.courant, b.clos, b.rappro, b.url"; $sql .= ", b.code_banque, b.code_guichet, b.cle_rib, b.bic, b.iban_prefix as iban"; - $sql .= ", b.domiciliation, b.proprio, b.owner_address"; + $sql .= ", b.domiciliation as address, b.proprio, b.owner_address"; $sql .= ", b.account_number, b.currency_code"; $sql .= ", b.min_allowed, b.min_desired, comment"; $sql .= ', b.fk_accountancy_journal'; $sql .= ', aj.code as accountancy_journal'; $sql .= " FROM ".MAIN_DB_PREFIX."bank_account as b"; - $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'accounting_journal as aj ON aj.rowid=b.fk_accountancy_journal'; + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'accounting_journal as aj ON aj.rowid = b.fk_accountancy_journal'; $sql .= " WHERE b.entity = ".$conf->entity; $sql .= " AND clos = 0"; - //$sql.= " AND courant = 1"; $sql .= " ORDER BY label"; + $sql .= $this->db->plimit($max, 0); dol_syslog(get_class($this)."::loadBox", LOG_DEBUG); + $result = $this->db->query($sql); if ($result) { $num = $this->db->num_rows($result); diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 44f2d7e02eb..cf170a77c75 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -829,7 +829,7 @@ function pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text) * @param int $curx X * @param int $cury Y * @param Account $account Bank account object - * @param int $onlynumber Output only number (bank+desk+key+number according to country, but without name of bank and domiciliation) + * @param int $onlynumber Output only number (bank+desk+key+number according to country, but without name of bank and address) * @param int $default_font_size Default font size * @return float The Y PDF position */ @@ -942,9 +942,9 @@ function pdf_bank(&$pdf, $outputlangs, $curx, $cury, $account, $onlynumber = 0, $pdf->SetFont('', '', $default_font_size - $diffsizecontent); - if (empty($onlynumber) && !empty($account->domiciliation)) { + if (empty($onlynumber) && (!empty($account->domiciliation) || !empty($account->address))) { $pdf->SetXY($curx, $cury); - $val = $outputlangs->transnoentities("Residence").': '.$outputlangs->convToOutputCharset($account->domiciliation); + $val = $outputlangs->transnoentities("Residence").': '.$outputlangs->convToOutputCharset(empty($account->address) ? $account->domiciliation : $account->address); $pdf->MultiCell(100, 3, $val, 0, 'L', 0); //$nboflines=dol_nboflines_bis($val,120); //$cury+=($nboflines*3)+2; diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index b0c101796f0..b7273e7fe6b 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -1095,7 +1095,7 @@ class Thirdparties extends DolibarrApi * We select all the records that match the socid */ - $sql = "SELECT rowid, fk_soc, bank, number, code_banque, code_guichet, cle_rib, bic, iban_prefix as iban, domiciliation, proprio,"; + $sql = "SELECT rowid, fk_soc, bank, number, code_banque, code_guichet, cle_rib, bic, iban_prefix as iban, domiciliation as address, proprio,"; $sql .= " owner_address, default_rib, label, datec, tms as datem, rum, frstrecur"; $sql .= " FROM ".MAIN_DB_PREFIX."societe_rib"; if ($id) { diff --git a/htdocs/societe/class/companybankaccount.class.php b/htdocs/societe/class/companybankaccount.class.php index 29ca86b3f2c..e67452d4347 100644 --- a/htdocs/societe/class/companybankaccount.class.php +++ b/htdocs/societe/class/companybankaccount.class.php @@ -164,14 +164,33 @@ class CompanyBankAccount extends Account * @var string label */ public $label; - public $bank; public $code_banque; public $code_guichet; public $number; public $cle_rib; public $bic; public $iban_prefix; + + public $bank; + /** + * @var string Bank address + * @deprecated Replaced with address + */ public $domiciliation; + public $address; + + /** + * @var int state id + */ + public $state_id; + + /** + * @var int country id + */ + public $fk_country; + + public $country_code; + /** * @var string owner @@ -188,16 +207,6 @@ class CompanyBankAccount extends Account */ public $default_rib; - /** - * @var int state id - */ - public $state_id; - - /** - * @var id country id - */ - public $fk_country; - /** * @var string currency code */ @@ -225,7 +234,6 @@ class CompanyBankAccount extends Account public $cvn; public $exp_date_month; public $exp_date_year; - public $country_code; public $approved; /** @@ -397,9 +405,12 @@ class CompanyBankAccount extends Account return -1; } - if (dol_strlen($this->domiciliation) > 255) { + if (!empty($this->domiciliation) && dol_strlen($this->domiciliation) > 255) { $this->domiciliation = dol_trunc($this->domiciliation, 254, 'right', 'UTF-8', 1); } + if (!empty($this->address) && dol_strlen($this->address) > 255) { + $this->address = dol_trunc($this->address, 254, 'right', 'UTF-8', 1); + } if (dol_strlen($this->owner_address) > 255) { $this->owner_address = dol_trunc($this->owner_address, 254, 'right', 'UTF-8', 1); } @@ -418,7 +429,7 @@ class CompanyBankAccount extends Account $sql .= ",cle_rib='".$this->db->escape($this->cle_rib)."'"; $sql .= ",bic='".$this->db->escape($this->bic)."'"; $sql .= ",iban_prefix = '".$this->db->escape($this->iban)."'"; - $sql .= ",domiciliation = '".$this->db->escape($this->domiciliation)."'"; + $sql .= ",domiciliation = '".$this->db->escape($this->address ? $this->address : $this->domiciliation)."'"; $sql .= ",proprio = '".$this->db->escape($this->proprio)."'"; $sql .= ",owner_address = '".$this->db->escape($this->owner_address)."'"; $sql .= ",default_rib = ".((int) $this->default_rib); @@ -481,13 +492,13 @@ class CompanyBankAccount extends Account return -1; } - $sql = "SELECT rowid, type, fk_soc as socid, bank, number, code_banque, code_guichet, cle_rib, bic, iban_prefix as iban, domiciliation, proprio,"; - $sql .= " owner_address, default_rib, label, datec, tms as datem, rum, frstrecur, date_rum,"; - $sql .= " stripe_card_ref, stripe_account, ext_payment_site"; - $sql .= " ,last_main_doc"; - $sql .= " ,model_pdf"; - + $sql = "SELECT rowid, label, type, fk_soc as socid, bank, number, code_banque, code_guichet, cle_rib, bic, iban_prefix as iban,"; + $sql .= " domiciliation as address,"; + $sql .= " proprio, owner_address, default_rib, datec, tms as datem, rum, frstrecur, date_rum,"; + $sql .= " stripe_card_ref, stripe_account, ext_payment_site,"; + $sql .= " last_main_doc, model_pdf"; $sql .= " FROM ".MAIN_DB_PREFIX."societe_rib"; + if ($id) { $sql .= " WHERE rowid = ".((int) $id); } elseif ($socid > 0) { @@ -517,7 +528,10 @@ class CompanyBankAccount extends Account $this->cle_rib = $obj->cle_rib; $this->bic = $obj->bic; $this->iban = $obj->iban; - $this->domiciliation = $obj->domiciliation; + + $this->domiciliation = $obj->address; + $this->address = $obj->address; + $this->proprio = $obj->proprio; $this->owner_address = $obj->owner_address; $this->label = $obj->label; @@ -675,10 +689,13 @@ class CompanyBankAccount extends Account $this->cle_rib = '50'; $this->bic = 'CC12'; $this->iban = 'FR999999999'; - $this->domiciliation = 'Bank address of customer corp'; + + $this->address = 'Rue de Paris'; + $this->country_id = 1; + $this->proprio = 'Owner'; $this->owner_address = 'Owner address'; - $this->country_id = 1; + $this->owner_country_id = 1; $this->rum = 'UMR-CU1212-0007-5-1475405262'; $this->date_rum = dol_now() - 10000; diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 5f15d0e031d..e77854e1fcf 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -175,7 +175,10 @@ if (empty($reshook)) { $companybankaccount->cle_rib = GETPOST('cle_rib', 'alpha'); $companybankaccount->bic = GETPOST('bic', 'alpha'); $companybankaccount->iban = GETPOST('iban', 'alpha'); - $companybankaccount->domiciliation = GETPOST('domiciliation', 'alpha'); + + $companybankaccount->domiciliation = GETPOST('address', 'alpha'); + $companybankaccount->address = GETPOST('address', 'alpha'); + $companybankaccount->proprio = GETPOST('proprio', 'alpha'); $companybankaccount->owner_address = GETPOST('owner_address', 'alpha'); $companybankaccount->frstrecur = GETPOST('frstrecur', 'alpha'); @@ -305,7 +308,10 @@ if (empty($reshook)) { $companybankaccount->cle_rib = GETPOST('cle_rib', 'alpha'); $companybankaccount->bic = GETPOST('bic', 'alpha'); $companybankaccount->iban = GETPOST('iban', 'alpha'); - $companybankaccount->domiciliation = GETPOST('domiciliation', 'alpha'); + + $companybankaccount->domiciliation = GETPOST('address', 'alpha'); + $companybankaccount->address = GETPOST('address', 'alpha'); + $companybankaccount->proprio = GETPOST('proprio', 'alpha'); $companybankaccount->owner_address = GETPOST('owner_address', 'alpha'); $companybankaccount->frstrecur = GETPOST('frstrecur', 'alpha'); @@ -2010,8 +2016,8 @@ if ($socid && $action == 'edit' && $permissiontoaddupdatepaymentinformation) { } print ''.$langs->trans("BankAccountDomiciliation").''; - print '"; print ''.$langs->trans("BankAccountOwner").''; @@ -2181,8 +2187,8 @@ if ($socid && $action == 'create' && $permissiontoaddupdatepaymentinformation) { } print ''.$langs->trans("BankAccountDomiciliation").''; - print '"; print ''.$langs->trans("BankAccountOwner").''; diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index ca663c38448..f56186d6d99 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -125,7 +125,8 @@ if ($action == 'add' && !$cancel && $permissiontoaddbankaccount) { $account->cle_rib = GETPOST('cle_rib', 'alpha'); $account->bic = GETPOST('bic', 'alpha'); $account->iban = GETPOST('iban', 'alpha'); - $account->domiciliation = GETPOST('domiciliation', 'alpha'); + $account->domiciliation = GETPOST('address', 'alpha'); + $account->address = GETPOST('address', 'alpha'); $account->proprio = GETPOST('proprio', 'alpha'); $account->owner_address = GETPOST('owner_address', 'alpha'); @@ -156,7 +157,8 @@ if ($action == 'update' && !$cancel && $permissiontoaddbankaccount) { $account->cle_rib = GETPOST('cle_rib', 'alpha'); $account->bic = GETPOST('bic', 'alpha'); $account->iban = GETPOST('iban', 'alpha'); - $account->domiciliation = GETPOST('domiciliation', 'alpha'); + $account->domiciliation = GETPOST('address', 'alpha'); + $account->address = GETPOST('address', 'alpha'); $account->proprio = GETPOST('proprio', 'alpha'); $account->owner_address = GETPOST('owner_address', 'alpha'); @@ -1004,8 +1006,8 @@ if ($id && ($action == 'edit' || $action == 'create') && $user->hasRight('user', } print ''.$langs->trans("BankAccountDomiciliation").''; - print '"; print ''.$langs->trans("BankAccountOwner").''; diff --git a/htdocs/user/class/userbankaccount.class.php b/htdocs/user/class/userbankaccount.class.php index 0602ab390bf..156f204249d 100644 --- a/htdocs/user/class/userbankaccount.class.php +++ b/htdocs/user/class/userbankaccount.class.php @@ -135,7 +135,7 @@ class UserBankAccount extends Account $sql .= ",cle_rib='".$this->db->escape($this->cle_rib)."'"; $sql .= ",bic='".$this->db->escape($this->bic)."'"; $sql .= ",iban_prefix = '".$this->db->escape($this->iban)."'"; - $sql .= ",domiciliation='".$this->db->escape($this->domiciliation)."'"; + $sql .= ",domiciliation='".$this->db->escape($this->address ? $this->address :$this->domiciliation)."'"; $sql .= ",proprio = '".$this->db->escape($this->proprio)."'"; $sql .= ",owner_address = '".$this->db->escape($this->owner_address)."'"; $sql .= ",currency_code = '".$this->db->escape($this->currency_code)."'"; @@ -189,8 +189,8 @@ class UserBankAccount extends Account return -1; } - $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"; - $sql .= ", ur.owner_address, ur.label, ur.datec, ur.tms as datem"; + $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 as address"; + $sql .= ", ur.proprio, ur.owner_address, ur.label, ur.datec, ur.tms as datem"; $sql .= ', ur.currency_code, ur.state_id, ur.fk_country as country_id'; $sql .= ', c.code as country_code, c.label as country'; $sql .= ', d.code_departement as state_code, d.nom as state'; @@ -222,7 +222,10 @@ class UserBankAccount extends Account $this->cle_rib = $obj->cle_rib; $this->bic = $obj->bic; $this->iban = $obj->iban; - $this->domiciliation = $obj->domiciliation; + + $this->domiciliation = $obj->address; + $this->address = $obj->address; + $this->proprio = $obj->proprio; $this->owner_address = $obj->owner_address; $this->label = $obj->label;