mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-05 17:18:13 +01:00
FIX #4182 SQL error when deleting an unexisting bank entry
This commit is contained in:
@@ -1277,12 +1277,12 @@ class AccountLine extends CommonObject
|
||||
$nbko++;
|
||||
}
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid=".$this->rowid;
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid=".(int) $this->rowid;
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if (! $result) $nbko++;
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank WHERE rowid=".$this->rowid;
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank WHERE rowid=".(int) $this->rowid;
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if (! $result) $nbko++;
|
||||
@@ -1319,7 +1319,7 @@ class AccountLine extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_url WHERE fk_bank=".$this->rowid;
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_url WHERE fk_bank=".(int) $this->rowid;
|
||||
dol_syslog(get_class($this)."::delete_urls", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if (! $result) $nbko++;
|
||||
|
||||
@@ -99,11 +99,14 @@ if ($action == 'rappro' && $user->rights->banque->consolidate)
|
||||
if ($action == 'del')
|
||||
{
|
||||
$bankline=new AccountLine($db);
|
||||
$bankline->fetch($_GET["rowid"]);
|
||||
$result=$bankline->delete($user);
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error($db,$bankline->error);
|
||||
|
||||
if ($bankline->fetch($_GET["rowid"]) > 1) {
|
||||
$result = $bankline->delete($user);
|
||||
if ($result < 0) {
|
||||
dol_print_error($db, $bankline->error);
|
||||
}
|
||||
} else {
|
||||
setEventMessage($langs->trans('ErrorRecordNotFound'), 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user