From 6b2b07fddffe185d28451deeb593a4b96f3ad9aa Mon Sep 17 00:00:00 2001 From: nuxsmin Date: Thu, 16 Feb 2017 00:21:19 +0100 Subject: [PATCH] * [FIX] Solves #435. Wrong returning code when updating a record and data is the same stored. Thanks to @wernerreuser for the feedback. --- inc/SP/Mgmt/Customers/Customer.class.php | 4 ---- inc/SP/Mgmt/Notices/Notice.class.php | 8 ++------ inc/SP/Mgmt/Plugins/Plugin.class.php | 4 ---- inc/SP/Mgmt/Profiles/Profile.class.php | 6 ++---- inc/SP/Mgmt/PublicLinks/PublicLink.class.php | 4 ---- inc/SP/Mgmt/Tags/Tag.class.php | 4 ---- inc/SP/Mgmt/Users/User.class.php | 6 ++---- 7 files changed, 6 insertions(+), 30 deletions(-) diff --git a/inc/SP/Mgmt/Customers/Customer.class.php b/inc/SP/Mgmt/Customers/Customer.class.php index 8f9fd2be..da45997d 100644 --- a/inc/SP/Mgmt/Customers/Customer.class.php +++ b/inc/SP/Mgmt/Customers/Customer.class.php @@ -199,10 +199,6 @@ class Customer extends CustomerBase implements ItemInterface, ItemSelectInterfac DB::getQuery($Data); - if ($Data->getQueryNumRows() === 0) { - throw new SPException(SPException::SP_INFO, __('Cliente no encontrado', false)); - } - return $this; } diff --git a/inc/SP/Mgmt/Notices/Notice.class.php b/inc/SP/Mgmt/Notices/Notice.class.php index 2710f0c4..07c16f4f 100644 --- a/inc/SP/Mgmt/Notices/Notice.class.php +++ b/inc/SP/Mgmt/Notices/Notice.class.php @@ -82,10 +82,10 @@ class Notice extends NoticeBase implements ItemInterface */ public function delete($id) { + $query = 'DELETE FROM notices WHERE notice_id = ? AND BIN(notice_sticky) = 0 LIMIT 1'; + if (Session::getUserData()->isUserIsAdminApp()) { $query = 'DELETE FROM notices WHERE notice_id = ? LIMIT 1'; - } else { - $query = 'DELETE FROM notices WHERE notice_id = ? AND BIN(notice_sticky) = 0 LIMIT 1'; } $Data = new QueryData(); @@ -133,10 +133,6 @@ class Notice extends NoticeBase implements ItemInterface DB::getQuery($Data); - if ($Data->getQueryNumRows() === 0) { - throw new SPException(SPException::SP_INFO, __('Notificación no encontrada', false)); - } - return $this; } diff --git a/inc/SP/Mgmt/Plugins/Plugin.class.php b/inc/SP/Mgmt/Plugins/Plugin.class.php index d579f87c..f46eaf35 100644 --- a/inc/SP/Mgmt/Plugins/Plugin.class.php +++ b/inc/SP/Mgmt/Plugins/Plugin.class.php @@ -116,10 +116,6 @@ class Plugin extends PluginBase implements ItemInterface DB::getQuery($Data); - if ($Data->getQueryNumRows() === 0) { - throw new SPException(SPException::SP_INFO, __('Plugin no encontrado', false)); - } - return $this; } diff --git a/inc/SP/Mgmt/Profiles/Profile.class.php b/inc/SP/Mgmt/Profiles/Profile.class.php index bfff2394..7d6338ff 100644 --- a/inc/SP/Mgmt/Profiles/Profile.class.php +++ b/inc/SP/Mgmt/Profiles/Profile.class.php @@ -197,12 +197,10 @@ class Profile extends ProfileBase implements ItemInterface, ItemSelectInterface DB::getQuery($Data); - if ($Data->getQueryNumRows() === 0) { - throw new SPException(SPException::SP_INFO, __('Perfil no encontrado', false)); + if ($Data->getQueryNumRows() > 0) { + $this->updateSessionProfile(); } - $this->updateSessionProfile(); - return $this; } diff --git a/inc/SP/Mgmt/PublicLinks/PublicLink.class.php b/inc/SP/Mgmt/PublicLinks/PublicLink.class.php index 4a511baa..0124581f 100644 --- a/inc/SP/Mgmt/PublicLinks/PublicLink.class.php +++ b/inc/SP/Mgmt/PublicLinks/PublicLink.class.php @@ -105,10 +105,6 @@ class PublicLink extends PublicLinkBase implements ItemInterface DB::getQuery($Data); - if ($Data->getQueryNumRows() === 0) { - throw new SPException(SPException::SP_INFO, __('Enlace no encontrado', false)); - } - return true; } diff --git a/inc/SP/Mgmt/Tags/Tag.class.php b/inc/SP/Mgmt/Tags/Tag.class.php index 82e21233..eaa97c6a 100644 --- a/inc/SP/Mgmt/Tags/Tag.class.php +++ b/inc/SP/Mgmt/Tags/Tag.class.php @@ -138,10 +138,6 @@ class Tag extends TagBase implements ItemInterface, ItemSelectInterface DB::getQuery($Data); - if ($Data->getQueryNumRows() === 0) { - throw new SPException(SPException::SP_INFO, __('Etiqueta no encontrada', false)); - } - return $this; } diff --git a/inc/SP/Mgmt/Users/User.class.php b/inc/SP/Mgmt/Users/User.class.php index 57e66e4a..d7eae092 100644 --- a/inc/SP/Mgmt/Users/User.class.php +++ b/inc/SP/Mgmt/Users/User.class.php @@ -184,12 +184,10 @@ class User extends UserBase implements ItemInterface, ItemSelectInterface DB::getQuery($Data); - if ($Data->getQueryNumRows() === 0) { - throw new SPException(SPException::SP_INFO, __('Usuario no encontrado', false)); + if ($Data->getQueryNumRows() > 0) { + $this->itemData->setUserId(DB::getLastId()); } - $this->itemData->setUserId(DB::getLastId()); - return $this; }