From ab67c4bcb507fea38e4d00e76411d04346b3ee75 Mon Sep 17 00:00:00 2001 From: sparkyx Date: Sun, 1 Sep 2024 22:01:00 +0200 Subject: [PATCH] CFGMENU : bug cannot update menu --- include/class/menu_ref.class.php | 4 +++- include/menu.inc.php | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/class/menu_ref.class.php b/include/class/menu_ref.class.php index aab3b5f0c..f86c0c0a0 100644 --- a/include/class/menu_ref.class.php +++ b/include/class/menu_ref.class.php @@ -45,8 +45,10 @@ class Menu_Ref extends Menu_Ref_SQL { throw new Exception(_("le code ne peut être vide")); } + $this->format_code(); - if ( $this->cn->get_value("select count(*) from menu_ref where me_code=$1",array($this->me_code)) > 0) + if (isset ($_POST['create_menu']) + && $this->cn->get_value("select count(*) from menu_ref where me_code=$1",array($this->me_code)) > 0) throw new Exception ('Doublon'); if (trim($this->me_code)=='') throw new Exception ('Ce menu existe déjà'); diff --git a/include/menu.inc.php b/include/menu.inc.php index 47b626611..0dbdd3c06 100644 --- a/include/menu.inc.php +++ b/include/menu.inc.php @@ -86,6 +86,7 @@ if ( isset($_POST['create_menu'])|| isset($_POST['modify_menu'])) { if (isset($_POST['create_menu'])) { + if ($menu_ref->verify() == 0) $menu_ref->insert(); } elseif (isset($_POST['modify_menu']))