Merge branch '3.9' of git@github.com:Dolibarr/dolibarr.git into 4.0

Conflicts:
	htdocs/compta/bank/categ.php
This commit is contained in:
Laurent Destailleur 2017-02-27 10:55:18 +01:00
commit cff284b2f3
2 changed files with 32 additions and 14 deletions

View File

@ -72,6 +72,7 @@ if ($categid) {
} }
} }
/* /*
* View * View
*/ */

View File

@ -197,18 +197,35 @@ class BankCateg // extends CommonObject
global $conf; global $conf;
$error = 0; $error = 0;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_categ";
$sql .= " WHERE rowid=".$this->id;
$sql .= " AND entity = ".$conf->entity;
$this->db->begin(); $this->db->begin();
dol_syslog(get_class($this)."::delete", LOG_DEBUG); // Delete bank class
if (! $error)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class";
$sql.= " WHERE fk_categ = ".$this->id;
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (!$resql) { if (!$resql)
{
$error++; $error++;
$this->errors[] = "Error ".$this->db->lasterror(); $this->errors[] = "Error ".$this->db->lasterror();
} }
}
// Delete bank categ
if (! $error)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_categ";
$sql .= " WHERE rowid=".$this->id;
$resql = $this->db->query($sql);
if (!$resql)
{
$error++;
$this->errors[] = "Error ".$this->db->lasterror();
}
}
// Commit or rollback // Commit or rollback
if ($error) { if ($error) {