';
- print $obj->iban;
+ print dolDecrypt($obj->iban);
if ($obj->iban && $obj->bic) {
print " / ";
}
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index d27e941d1e6..218c5822d66 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -5263,14 +5263,15 @@ class Form
while ($i < $num) {
$obj = $this->db->fetch_object($result);
+ $iban = dolDecrypt($obj->iban_prefix);
if ($selected == $obj->rowid || ($useempty == 2 && $num == 1 && empty($selected))) {
- $out .= '';
$i++;
diff --git a/htdocs/install/mysql/migration/20.0.0-21.0.0.sql b/htdocs/install/mysql/migration/20.0.0-21.0.0.sql
index 0d2c24acd18..71037e6248e 100644
--- a/htdocs/install/mysql/migration/20.0.0-21.0.0.sql
+++ b/htdocs/install/mysql/migration/20.0.0-21.0.0.sql
@@ -82,6 +82,8 @@ ALTER TABLE llx_product DROP FOREIGN KEY fk_product_default_warehouse;
DROP TABLE llx_contratdet_log;
ALTER TABLE llx_societe_rib MODIFY COLUMN iban_prefix varchar(80);
+ALTER TABLE llx_bank_account MODIFY COLUMN iban_prefix varchar(80);
+ALTER TABLE llx_user_rib MODIFY COLUMN iban_prefix varchar(80);
ALTER TABLE llx_bom_bom ADD COLUMN last_main_doc varchar(255) AFTER model_pdf;
diff --git a/htdocs/install/mysql/tables/llx_bank_account.sql b/htdocs/install/mysql/tables/llx_bank_account.sql
index b5edc3a2793..059cad3118b 100644
--- a/htdocs/install/mysql/tables/llx_bank_account.sql
+++ b/htdocs/install/mysql/tables/llx_bank_account.sql
@@ -39,7 +39,7 @@ create table llx_bank_account
cle_rib varchar(5),
bic varchar(11), -- 11 according to ISO 9362
bic_intermediate varchar(11), -- 11 according to ISO 9362. Same as bic but for intermediate bank
- iban_prefix varchar(34), -- full iban. 34 according to ISO 13616
+ iban_prefix varchar(80), -- full iban. 34 according to ISO 13616 but we set 80 to allow to store it with encryption information
country_iban varchar(2), -- deprecated
cle_iban varchar(2),
domiciliation varchar(255),
diff --git a/htdocs/install/mysql/tables/llx_user_rib.sql b/htdocs/install/mysql/tables/llx_user_rib.sql
index a86fbb01f9e..50733bcbc75 100644
--- a/htdocs/install/mysql/tables/llx_user_rib.sql
+++ b/htdocs/install/mysql/tables/llx_user_rib.sql
@@ -31,7 +31,7 @@ create table llx_user_rib
cle_rib varchar(5), -- key of bank account
bic varchar(11), -- 11 according to ISO 9362
bic_intermediate varchar(11), -- 11 according to ISO 9362. Same as bic but for intermediate bank
- iban_prefix varchar(34), -- full iban. 34 according to ISO 13616
+ iban_prefix varchar(80), -- full iban. 34 according to ISO 13616 but we set 80 to allow to store it with encryption information
domiciliation varchar(255),
proprio varchar(60),
owner_address varchar(255),
diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php
index 3afe1807ccb..4461bb644e3 100644
--- a/htdocs/societe/class/api_thirdparties.class.php
+++ b/htdocs/societe/class/api_thirdparties.class.php
@@ -1410,6 +1410,7 @@ class Thirdparties extends DolibarrApi
$num = $this->db->num_rows($result);
while ($i < $num) {
$obj = $this->db->fetch_object($result);
+
$account = new CompanyBankAccount($this->db);
if ($account->fetch($obj->rowid)) {
$accounts[] = $account;
diff --git a/htdocs/user/class/userbankaccount.class.php b/htdocs/user/class/userbankaccount.class.php
index b97e8bb0c4c..c1ee44f6840 100644
--- a/htdocs/user/class/userbankaccount.class.php
+++ b/htdocs/user/class/userbankaccount.class.php
@@ -223,7 +223,7 @@ class UserBankAccount extends Account
$this->number = $obj->number;
$this->cle_rib = $obj->cle_rib;
$this->bic = $obj->bic;
- $this->iban = $obj->iban;
+ $this->iban = dolDecrypt($obj->iban);
$this->courant = self::TYPE_CURRENT;
$this->type = self::TYPE_CURRENT;