mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Fix option WITHDRAWAL_WITHOUT_BIC
This commit is contained in:
parent
67c7e2fdce
commit
50190db5c7
|
|
@ -1627,7 +1627,9 @@ class Account extends CommonObject
|
|||
$error++;
|
||||
$this->error = 'IBANNotValid';
|
||||
}
|
||||
if (!checkSwiftForAccount($this) or !(empty($this->bic) && getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC'))) {
|
||||
// Call function to check Swift/BIC.
|
||||
// A non valid BIC/Swift is a problem if: it is not empty or always a problem if WITHDRAWAL_WITHOUT_BIC is not set).
|
||||
if (!checkSwiftForAccount($this) && (!empty($this->bic) || !getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC'))) {
|
||||
$error++;
|
||||
$this->error = 'SwiftNotValid';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -142,6 +142,39 @@ class BankAccountTest extends CommonClassTest
|
|||
print __METHOD__." checkIbanForAccount(".$localobject2->iban.") = ".$result."\n";
|
||||
$this->assertTrue($result);
|
||||
|
||||
return $localobject;
|
||||
}
|
||||
|
||||
/**
|
||||
* testCheckSwiftForAccount
|
||||
*
|
||||
* @param Account $localobject Account
|
||||
* @return int
|
||||
*
|
||||
* @depends testBankAccountOther
|
||||
* The depends says test is run only if previous is ok
|
||||
*/
|
||||
public function testCheckSwiftForAccount($localobject)
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf = $this->savconf;
|
||||
$user = $this->savuser;
|
||||
$langs = $this->savlangs;
|
||||
$db = $this->savdb;
|
||||
|
||||
$localobject->bic = 'PSSTFRPPMARBIDON';
|
||||
|
||||
$result = checkSwiftForAccount($localobject);
|
||||
print __METHOD__." checkSwiftForAccount ".$localobject->bic." = ".$result."\n";
|
||||
$this->assertFalse($result);
|
||||
|
||||
|
||||
$localobject->bic = 'PSSTFRPPMAR';
|
||||
|
||||
$result = checkSwiftForAccount($localobject);
|
||||
print __METHOD__." checkSwiftForAccount ".$localobject->bic." = ".$result."\n";
|
||||
$this->assertTrue($result);
|
||||
|
||||
return $localobject->id;
|
||||
}
|
||||
|
||||
|
|
@ -151,7 +184,7 @@ class BankAccountTest extends CommonClassTest
|
|||
* @param int $id Id of contract
|
||||
* @return int
|
||||
*
|
||||
* @depends testBankAccountOther
|
||||
* @depends testCheckSwiftForAccount
|
||||
* The depends says test is run only if previous is ok
|
||||
*/
|
||||
public function testBankAccountDelete($id)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user