can't remove actioncomm if there is a category
This commit is contained in:
parent
6eab2ec295
commit
88f18ec3ce
@ -5,7 +5,7 @@
|
|||||||
* Copyright (C) 2011-2017 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2011-2017 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -900,14 +900,27 @@ class ActionComm extends CommonObject
|
|||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm";
|
// remove categorie association
|
||||||
$sql .= " WHERE id=".$this->id;
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_actioncomm";
|
||||||
|
$sql .= " WHERE fk_actioncomm=".$this->id;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
dol_syslog(get_class($this)."::delete categorie", LOG_DEBUG);
|
||||||
$res = $this->db->query($sql);
|
$res = $this->db->query($sql);
|
||||||
if ($res < 0) {
|
if ($res < 0) {
|
||||||
$this->error = $this->db->lasterror();
|
$this->error = $this->db->lasterror();
|
||||||
$error++;
|
$error++;
|
||||||
|
}
|
||||||
|
// remove actioncomm
|
||||||
|
if (!$error) {
|
||||||
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm";
|
||||||
|
$sql .= " WHERE id=".$this->id;
|
||||||
|
|
||||||
|
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||||
|
$res = $this->db->query($sql);
|
||||||
|
if ($res < 0) {
|
||||||
|
$this->error = $this->db->lasterror();
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user