mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
NEW Iban is saved encrypted
This commit is contained in:
parent
3bc1d35236
commit
830029dd05
|
|
@ -110,7 +110,7 @@ function dolGetRandomBytes($length)
|
|||
/**
|
||||
* Encode a string with a symmetric encryption. Used to encrypt sensitive data into database.
|
||||
* Note: If a backup is restored onto another instance with a different $conf->file->instance_unique_id, then decoded value will differ.
|
||||
* This function is called for example by dol_set_const() when saving a sensible data into database configuration table llx_const.
|
||||
* This function is called for example by dol_set_const() when saving a sensible data into database, like into configuration table llx_const, or societe_rib, ...
|
||||
*
|
||||
* @param string $chain String to encode
|
||||
* @param string $key If '', we use $conf->file->instance_unique_id (so $dolibarr_main_instance_unique_id in conf.php)
|
||||
|
|
|
|||
|
|
@ -800,7 +800,7 @@ class pdf_standard_supplierpayment extends ModelePDFSuppliersPayments
|
|||
if ($resql) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($obj) {
|
||||
$iban = $obj->iban;
|
||||
$iban = dolDecrypt($obj->iban);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,6 +53,8 @@ ALTER TABLE llx_hrm_evaluation MODIFY COLUMN modelpdf varchar(255) DEFAULT NULL;
|
|||
|
||||
DROP TABLE llx_contratdet_log;
|
||||
|
||||
ALTER TABLE llx_societe_rib MODIFY COLUMN iban_prefix varchar(60);
|
||||
|
||||
|
||||
-- add billable attribute to project task
|
||||
ALTER TABLE llx_projet_task ADD COLUMN billable smallint DEFAULT 1;
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ create table llx_societe_rib
|
|||
|
||||
bic varchar(20), -- 11 according to ISO 9362 (we keep 20 for backward compatibility)
|
||||
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(60), -- full iban. 34 according to ISO 13616 ut we set 60 to allow to store it with encryption information
|
||||
|
||||
domiciliation varchar(255),
|
||||
proprio varchar(60),
|
||||
|
|
|
|||
|
|
@ -1429,7 +1429,11 @@ class Thirdparties extends DolibarrApi
|
|||
$object = array();
|
||||
foreach ($account as $key => $value) {
|
||||
if (in_array($key, $fields)) {
|
||||
$object[$key] = $value;
|
||||
if ($key == 'iban') {
|
||||
$object[$key] = dolDecrypt($value);
|
||||
} else {
|
||||
$object[$key] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
$returnAccounts[] = $object;
|
||||
|
|
|
|||
|
|
@ -302,7 +302,7 @@ class CompanyBankAccount extends Account
|
|||
/**
|
||||
* Create bank information record.
|
||||
*
|
||||
* @param $user User
|
||||
* @param ?User $user User
|
||||
* @param int<0,1> $notrigger 1=Disable triggers
|
||||
* @return int Return integer <0 if KO, > 0 if OK (ID of newly created company bank account information)
|
||||
*/
|
||||
|
|
@ -325,7 +325,8 @@ class CompanyBankAccount extends Account
|
|||
|
||||
// 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'.
|
||||
// If we really want the new bank account to be the default, we must set it by calling setDefault() after creation.
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe_rib where fk_soc = ".((int) $this->socid)." AND default_rib = 1 AND type = 'ban'";
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe_rib";
|
||||
$sql .= " WHERE fk_soc = ".((int) $this->socid)." AND default_rib = 1 AND type = 'ban'";
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$numrows = $this->db->num_rows($result);
|
||||
|
|
@ -512,7 +513,7 @@ class CompanyBankAccount 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->address = $obj->address;
|
||||
|
||||
|
|
@ -615,7 +616,7 @@ class CompanyBankAccount extends Account
|
|||
public function setAsDefault($rib = 0, $resetolddefaultfor = 'ban')
|
||||
{
|
||||
$sql1 = "SELECT rowid as id, fk_soc as socid FROM ".MAIN_DB_PREFIX."societe_rib";
|
||||
$sql1 .= " WHERE rowid = ".($rib ? $rib : $this->id);
|
||||
$sql1 .= " WHERE rowid = ".((int) ($rib ? $rib : $this->id));
|
||||
|
||||
dol_syslog(get_class($this).'::setAsDefault', LOG_DEBUG);
|
||||
$result1 = $this->db->query($sql1);
|
||||
|
|
@ -679,8 +680,7 @@ class CompanyBankAccount extends Account
|
|||
$this->address = 'Rue de Paris';
|
||||
$this->country_id = 1;
|
||||
|
||||
$this->proprio = 'Owner';
|
||||
$this->owner_name = 'Owner';
|
||||
$this->owner_name = 'Owner';
|
||||
$this->owner_address = 'Owner address';
|
||||
$this->owner_country_id = 1;
|
||||
|
||||
|
|
|
|||
|
|
@ -431,7 +431,7 @@ class CompanyPaymentMode extends CommonObject
|
|||
public function setAsDefault($id = 0, $alltypes = 0)
|
||||
{
|
||||
$sql1 = "SELECT rowid as id, fk_soc, type FROM ".MAIN_DB_PREFIX."societe_rib";
|
||||
$sql1 .= " WHERE rowid = ".($id ? $id : $this->id);
|
||||
$sql1 .= " WHERE rowid = ".((int) ($id ? $id : $this->id));
|
||||
|
||||
dol_syslog(get_class($this).'::setAsDefault', LOG_DEBUG);
|
||||
$result1 = $this->db->query($sql1);
|
||||
|
|
|
|||
|
|
@ -3498,7 +3498,7 @@ class Societe extends CommonObject
|
|||
{
|
||||
// phpcs:enable
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe_rib WHERE type='ban' AND fk_soc = ".((int) $this->id);
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe_rib WHERE type = 'ban' AND fk_soc = ".((int) $this->id);
|
||||
$result = $this->db->query($sql);
|
||||
if (!$result) {
|
||||
$this->error = $this->db->lasterror();
|
||||
|
|
|
|||
|
|
@ -816,6 +816,7 @@ if (empty($reshook)) {
|
|||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe_rib as sr ";
|
||||
$sql .= " SET stripe_card_ref = null";
|
||||
$sql .= " WHERE sr.stripe_card_ref = '".$db->escape($source)."'";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
} else {
|
||||
$card->delete($user);
|
||||
|
|
@ -2157,10 +2158,10 @@ if ($socid && $action == 'create' && $permissiontoaddupdatepaymentinformation) {
|
|||
print '<table class="border centpercent">';
|
||||
|
||||
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Label").'</td>';
|
||||
print '<td><input class="minwidth200" type="text" id="label" name="label" value="'.(GETPOSTISSET('label') ? GETPOST('label') : $object->name).'"></td></tr>';
|
||||
print '<td><input class="minwidth250" type="text" id="label" name="label" value="'.(GETPOSTISSET('label') ? GETPOST('label') : $langs->trans("Bank").' '.$object->name).'"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Bank").'</td>';
|
||||
print '<td><input class="minwidth200" type="text" id="bank" name="bank" value="'.GETPOST('bank').'"></td></tr>';
|
||||
print '<td><input class="minwidth250" type="text" id="bank" name="bank" value="'.GETPOST('bank').'"></td></tr>';
|
||||
|
||||
// Show fields of bank account
|
||||
foreach ($companybankaccount->getFieldsToShow(1) as $val) {
|
||||
|
|
|
|||
|
|
@ -1034,7 +1034,7 @@ class Stripe extends CommonObject
|
|||
dol_syslog($this->error, LOG_WARNING);
|
||||
}
|
||||
} elseif ($createifnotlinkedtostripe) {
|
||||
$iban = $obj->iban;
|
||||
$iban = dolDecrypt($obj->iban);
|
||||
$ipaddress = getUserRemoteIP();
|
||||
$metadata = array('dol_version' => DOL_VERSION, 'dol_entity' => $conf->entity, 'ipaddress' => $ipaddress);
|
||||
if (is_object($object)) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user