From 7bf031ce59c896e873500a793e9f30bb2042270b Mon Sep 17 00:00:00 2001
From: Laurent Laffont <llaffont@afi-sa.fr>
Date: Tue, 30 Oct 2018 10:38:16 +0100
Subject: [PATCH] dev #80976 fix RT

---
 VERSIONS_WIP/80976                                  |  2 +-
 .../modules/admin/controllers/RecordsController.php | 13 ++++++-------
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/VERSIONS_WIP/80976 b/VERSIONS_WIP/80976
index 68fa36c80c5..7e4f5109fd3 100644
--- a/VERSIONS_WIP/80976
+++ b/VERSIONS_WIP/80976
@@ -1 +1 @@
- - ticket #80976 : gestion des integrations hotline niveau 1
\ No newline at end of file
+ - ticket #80976 : page notice : lorque connecté en tant qu'administrateur, l'outil "Inspector Gadget" permet de supprimer un exemplaire
\ No newline at end of file
diff --git a/application/modules/admin/controllers/RecordsController.php b/application/modules/admin/controllers/RecordsController.php
index 7a9c35bb837..5d88e62b561 100644
--- a/application/modules/admin/controllers/RecordsController.php
+++ b/application/modules/admin/controllers/RecordsController.php
@@ -110,14 +110,13 @@ class Admin_RecordsController extends ZendAfi_Controller_Action {
 
 
   public function deleteItemAction() {
-    if (!$item = Class_Exemplaire::find($this->_getParam('id')))
-      $this->_helper->notify($this->_('Exemplaire non trouvé'));
-
-    if ($item) {
+    if ($item = Class_Exemplaire::find($this->_getParam('id')))
       $item->delete();
-      $this->_helper->notify($this->_('Exemplaire "%s" supprimé',
-                                      $item->getCodeBarres()));
-    }
+
+    $this->_helper->notify($item
+                           ? $this->_('Exemplaire "%s" supprimé',
+                                      $item->getCodeBarres())
+                           : $this->_('Exemplaire non trouvé'));
 
     $this->_redirectToReferer();
   }
-- 
GitLab