From 36bc266d6725b957a47b8f96dab0672bfb4aab9d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 6 Jun 2020 17:33:26 +0200 Subject: [PATCH 1/3] css --- htdocs/theme/eldy/main_menu_fa_icons.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/theme/eldy/main_menu_fa_icons.inc.php b/htdocs/theme/eldy/main_menu_fa_icons.inc.php index c344838458d..b77dc86765c 100644 --- a/htdocs/theme/eldy/main_menu_fa_icons.inc.php +++ b/htdocs/theme/eldy/main_menu_fa_icons.inc.php @@ -146,11 +146,11 @@ div.mainmenu.generic4::before { /* Define color of some picto */ .fa-phone, .fa-mobile-alt, .fa-fax { - opacity: 0.5; + opacity: 0.7; color: #440; } .fa-at, .fa-external-link-alt { - opacity: 0.5; + opacity: 0.7; color: #304; } .fa-trash { From e31e889595ae6c7d2bc6e6c8ecf51ecae5c3af0d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 6 Jun 2020 18:30:04 +0200 Subject: [PATCH 2/3] Add url in error message --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index dd107308fed..4105682a06a 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3959,7 +3959,7 @@ function dol_print_error($db = '', $error = '', $errors = null) $out .= $langs->trans("InformationToHelpDiagnose").":
\n"; $out .= "".$langs->trans("Date").": ".dol_print_date(time(), 'dayhourlog')."
\n"; - $out .= "".$langs->trans("Dolibarr").": ".DOL_VERSION."
\n"; + $out .= "".$langs->trans("Dolibarr").": ".DOL_VERSION." - https://www.dolibarr.org
\n"; if (isset($conf->global->MAIN_FEATURES_LEVEL)) $out .= "".$langs->trans("LevelOfFeature").": ".$conf->global->MAIN_FEATURES_LEVEL."
\n"; if (function_exists("phpversion")) { From 7061e9b4cbf198505488fb6205da55b5bb906068 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 6 Jun 2020 18:57:24 +0200 Subject: [PATCH 3/3] Fix deletion of website page --- .../template/class/myobject.class.php | 6 +- htdocs/website/class/websitepage.class.php | 58 ++++++++++++++++++- 2 files changed, 59 insertions(+), 5 deletions(-) diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 057a2aab615..03fffaaba5d 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -181,7 +181,7 @@ class MyObject extends CommonObject //public $table_element_line = 'mymodule_myobjectline'; /** - * @var int Field with ID of parent key if this field has a parent + * @var int Field with ID of parent key if this object has a parent */ //public $fk_element = 'fk_myobject'; @@ -193,12 +193,12 @@ class MyObject extends CommonObject /** * @var array List of child tables. To test if we can delete object. */ - //protected $childtables=array(); + //protected $childtables = array(); /** * @var array List of child tables. To know object to delete on cascade. */ - //protected $childtablesoncascade=array('mymodule_myobjectdet'); + //protected $childtablesoncascade = array('mymodule_myobjectdet'); /** * @var MyObjectLine[] Array of subtable lines diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index 2a72a222265..61ec8376414 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -49,6 +49,7 @@ class WebsitePage extends CommonObject */ public $picto = 'file-code'; + /** * @var int ID */ @@ -164,6 +165,35 @@ class WebsitePage extends CommonObject // END MODULEBUILDER PROPERTIES + // If this object has a subtable with lines + + /** + * @var int Name of subtable line + */ + //public $table_element_line = 'mymodule_myobjectline'; + + /** + * @var int Field with ID of parent key if this object has a parent + */ + public $fk_element = 'fk_website'; + + /** + * @var int Name of subtable class that manage subtable lines + */ + //public $class_element_line = 'MyObjectline'; + + /** + * @var array List of child tables. To test if we can delete object. + */ + //protected $childtables=array(); + + /** + * @var array List of child tables. To know object to delete on cascade. + */ + protected $childtablesoncascade = array('categorie_website_page'); + + + /** * Constructor * @@ -523,9 +553,33 @@ class WebsitePage extends CommonObject */ public function delete(User $user, $notrigger = false) { - $result = $this->deleteCommon($user, $trigger); + $error = 0; - if ($result > 0) + // Delete all child tables + if (!$error) { + foreach ($this->childtablesoncascade as $table) + { + $sql = "DELETE FROM ".MAIN_DB_PREFIX.$table; + $sql .= " WHERE fk_website_page = ".(int) $this->id; + + $result = $this->db->query($sql); + if (!$result) { + $error++; + $this->errors[] = $this->db->lasterror(); + break; + } + } + } + + if (!$error) { + $result = $this->deleteCommon($user, $trigger); + if ($result > 0) + { + $error++; + } + } + + if (!$error) { $websiteobj = new Website($this->db); $result = $websiteobj->fetch($this->fk_website);