From d657f524916f6cf7aad3b1b089f68b21c4069223 Mon Sep 17 00:00:00 2001 From: Xenomporio <> Date: Wed, 22 Jun 2022 10:27:28 +0200 Subject: [PATCH] Bugfix double entry of module_action upon initialisation -> Insert / Update --- www/lib/class.erpapi.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/www/lib/class.erpapi.php b/www/lib/class.erpapi.php index 95cdbf7c..dfbba420 100644 --- a/www/lib/class.erpapi.php +++ b/www/lib/class.erpapi.php @@ -6379,11 +6379,16 @@ title: 'Abschicken', return; } foreach($actions as $action) { - $this->app->DB->Insert( + + $sql = sprintf( - "INSERT INTO `module_action` (`module`,`action`) VALUES ('%s','%s')", - $this->app->DB->real_escape_string($module), $this->app->DB->real_escape_string($action) - ) + "INSERT INTO `module_action` (`module`,`action`) VALUES ('%s','%s') ON DUPLICATE KEY UPDATE `module`='%s', `action`='%s'", + $this->app->DB->real_escape_string($module), $this->app->DB->real_escape_string($action), + $this->app->DB->real_escape_string($module), $this->app->DB->real_escape_string($action) + ); + + $this->app->DB->Insert( + $sql ); $this->moduleActions[$module][] = $action; }