From ea259f0aa7c8cb1548019dbd8d5f0600c69a3f5b Mon Sep 17 00:00:00 2001 From: Jose Gonzalez <jose.gonzalez@artica.es> Date: Tue, 17 Nov 2020 16:36:30 +0100 Subject: [PATCH] Fixed issue --- .../include/class/ModuleTemplates.class.php | 40 ++++++++++++------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/pandora_console/include/class/ModuleTemplates.class.php b/pandora_console/include/class/ModuleTemplates.class.php index f9573b6c0e..adee4ec353 100644 --- a/pandora_console/include/class/ModuleTemplates.class.php +++ b/pandora_console/include/class/ModuleTemplates.class.php @@ -309,14 +309,19 @@ class ModuleTemplates extends HTML switch ($this->action) { case 'update': - $dbResult_tnp = db_process_sql_update( - 'tnetwork_profile', - [ - 'name' => $this->name, - 'description' => $this->description, - ], - ['id_np' => $this->id_np] - ); + if (empty($this->name)) { + $dbResult_tnp = false; + } else { + $dbResult_tnp = db_process_sql_update( + 'tnetwork_profile', + [ + 'name' => $this->name, + 'description' => $this->description, + ], + ['id_np' => $this->id_np] + ); + } + if ($dbResult_tnp === false) { $success = false; } else { @@ -352,13 +357,18 @@ class ModuleTemplates extends HTML break; case 'create': - $dbResult_tnp = db_process_sql_insert( - 'tnetwork_profile', - [ - 'name' => $this->name, - 'description' => $this->description, - ] - ); + if (empty($this->name)) { + $dbResult_tnp = false; + } else { + $dbResult_tnp = db_process_sql_insert( + 'tnetwork_profile', + [ + 'name' => $this->name, + 'description' => $this->description, + ] + ); + } + // The insert gone fine! if ($dbResult_tnp != false) { // Set the new id_np.