Clean/Debug code for v15

This commit is contained in:
Laurent Destailleur 2021-12-17 17:40:30 +01:00
parent 654cd8bd1c
commit 7266c78162
5 changed files with 31 additions and 12 deletions

View File

@ -277,7 +277,9 @@ function checkIbanForAccount($account)
{
require_once DOL_DOCUMENT_ROOT.'/includes/php-iban/oophp-iban.php';
$iban = new IBAN($account->iban);
$ibantocheck = ($account->iban ? $account->iban : $account->iban_prefix); // iban or iban_prefix for backward compatibility
$iban = new IBAN($ibantocheck);
$check = $iban->Verify();
if ($check) {

View File

@ -32,7 +32,7 @@ RIB=Bank Account Number
IBAN=IBAN number
BIC=BIC/SWIFT code
SwiftValid=BIC/SWIFT valid
SwiftVNotalid=BIC/SWIFT not valid
SwiftNotValid=BIC/SWIFT not valid
IbanValid=BAN valid
IbanNotValid=BAN not valid
StandingOrders=Direct debit orders
@ -49,7 +49,6 @@ BankAccountDomiciliation=Bank address
BankAccountCountry=Account country
BankAccountOwner=Account owner name
BankAccountOwnerAddress=Account owner address
RIBControlError=Integrity check of values failed. This means the information for this account number is not complete or is incorrect (check country, numbers and IBAN).
CreateAccount=Create account
NewBankAccount=New account
NewFinancialAccount=New financial account

View File

@ -21,6 +21,7 @@
* \file htdocs/public/onlinesign/newonlinesign.php
* \ingroup core
* \brief File to offer a way to make an online signature for a particular Dolibarr entity
* Example of URL: https://localhost/public/onlinesign/newonlinesign.php?ref=PR...
*/
if (!defined('NOLOGIN')) {
@ -352,10 +353,12 @@ if ($action == "dosign" && empty($cancel)) {
print '</div>';
print '<input type="button" class="button" id="signpropal" value="'.$langs->trans("Sign").'">';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
// Add js code managed into the div #signature
print '<script language="JavaScript" type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jSignature/jSignature.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#signature").jSignature({color:"#000",lineWidth:4});
$("#signature").jSignature({ color:"#000", lineWidth:4, height: 180});
$("#signature").on("change",function(){
$("#clearsignature").css("display","");
@ -370,13 +373,13 @@ if ($action == "dosign" && empty($cancel)) {
data: {
"action" : "importSignature",
"signaturebase64" : signature,
"ref" : "'.$REF.'",
"ref" : "'.dol_escape_js($REF).'",
"mode" : "propale",
},
success: function(response) {
if(response == "success"){
console.log("Success on saving signature");
window.location.replace("'.$_SERVER["SELF"].'?ref='.$ref.'&message=signed");
window.location.replace("'.$_SERVER["SELF"].'?ref='.urlencode($ref).'&message=signed");
}else{
console.error(response);
}

View File

@ -36,7 +36,14 @@ class CompanyBankAccount extends Account
public $socid;
public $default_rib;
/**
* Value 'FRST' or 'RCUR' (For SEPA mandate)
*
* @var string
*/
public $frstrecur;
public $rum;
public $date_rum;
@ -72,7 +79,7 @@ class CompanyBankAccount extends Account
/**
* Create bank information record
* Create bank information record.
*
* @param User $user User
* @param int $notrigger 1=Disable triggers
@ -80,9 +87,18 @@ class CompanyBankAccount extends Account
*/
public function create(User $user = null, $notrigger = 0)
{
$now = dol_now();
$now = dol_now();
$error = 0;
// Correct default_rib to be sure to have always one default
// Check paramaters
if (empty($this->socid)) {
$this->error = 'BadValueForParameter';
return -1;
}
// 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'";
$result = $this->db->query($sql);
if ($result) {
@ -338,7 +354,7 @@ class CompanyBankAccount extends Account
*/
public function setAsDefault($rib = 0)
{
$sql1 = "SELECT rowid as id, fk_soc FROM ".MAIN_DB_PREFIX."societe_rib";
$sql1 = "SELECT rowid as id, fk_soc FROM ".MAIN_DB_PREFIX."societe_rib";
$sql1 .= " WHERE rowid = ".($rib ? $rib : $this->id);
dol_syslog(get_class($this).'::setAsDefault', LOG_DEBUG);
@ -353,12 +369,10 @@ class CompanyBankAccount extends Account
$sql2 = "UPDATE ".MAIN_DB_PREFIX."societe_rib SET default_rib = 0";
$sql2 .= " WHERE type = 'ban' AND fk_soc = ".((int) $obj->fk_soc);
dol_syslog(get_class($this).'::setAsDefault', LOG_DEBUG);
$result2 = $this->db->query($sql2);
$sql3 = "UPDATE ".MAIN_DB_PREFIX."societe_rib SET default_rib = 1";
$sql3 .= " WHERE rowid = ".((int) $obj->id);
dol_syslog(get_class($this).'::setAsDefault', LOG_DEBUG);
$result3 = $this->db->query($sql3);
if (!$result2 || !$result3) {

View File

@ -7006,6 +7006,7 @@ div.clipboardCPValue.hidewithsize {
}
/* ============================================================================== */
/* CSS style used for small screen */
/* ============================================================================== */