From 7ea53c1aa6d1b762e19e8d82a94ff99dbda1a9d1 Mon Sep 17 00:00:00 2001 From: Demian Katz Date: Wed, 22 Dec 2021 15:37:51 -0500 Subject: [PATCH] Fix notices in tag admin code. --- module/VuFind/src/VuFind/Controller/ConfirmController.php | 2 +- .../src/VuFindAdmin/Controller/TagsController.php | 6 +++--- themes/bootstrap3/templates/admin/tags/list.phtml | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/module/VuFind/src/VuFind/Controller/ConfirmController.php b/module/VuFind/src/VuFind/Controller/ConfirmController.php index 3bacfcea283..f7304581df8 100644 --- a/module/VuFind/src/VuFind/Controller/ConfirmController.php +++ b/module/VuFind/src/VuFind/Controller/ConfirmController.php @@ -57,7 +57,7 @@ public function confirmAction() $flash = (true === is_array($message)) ? [ 'msg' => $message['msg'], - 'tokens' => $message['tokens'] + 'tokens' => $message['tokens'] ?? [] ] : $message; $this->flashMessenger()->addMessage($flash, 'info'); diff --git a/module/VuFindAdmin/src/VuFindAdmin/Controller/TagsController.php b/module/VuFindAdmin/src/VuFindAdmin/Controller/TagsController.php index 8370c9e98f0..08e60e47a60 100644 --- a/module/VuFindAdmin/src/VuFindAdmin/Controller/TagsController.php +++ b/module/VuFindAdmin/src/VuFindAdmin/Controller/TagsController.php @@ -198,18 +198,18 @@ protected function getConfirmDeleteMessages($count) $user = $this->getTable('user') ->select(['id' => $this->getParam('user_id')]) ->current(); - $userMsg = (false !== $user) + $userMsg = is_object($user) ? $user->username . " (" . $user->id . ")" : "All"; $tag = $this->getTable('tags') ->select(['id' => $this->getParam('tag_id')]) ->current(); - $tagMsg = (false !== $tag) ? $tag->tag . " (" . $tag->id . ")" : " All"; + $tagMsg = is_object($tag) ? $tag->tag . " (" . $tag->id . ")" : " All"; $resource = $this->getTable('resource') ->select(['id' => $this->getParam('resource_id')]) ->current(); - $resourceMsg = (false !== $resource) + $resourceMsg = is_object($resource) ? $resource->title . " (" . $resource->id . ")" : " All"; $messages[] = [ diff --git a/themes/bootstrap3/templates/admin/tags/list.phtml b/themes/bootstrap3/templates/admin/tags/list.phtml index 6443758f4d1..6799a56acdf 100644 --- a/themes/bootstrap3/templates/admin/tags/list.phtml +++ b/themes/bootstrap3/templates/admin/tags/list.phtml @@ -19,7 +19,7 @@ uniqueTags as $tag):?> - @@ -41,7 +41,7 @@ - params['user_id'] ?? null) || (null !== $this->params['tag_id'] ?? null) || (null !== $this->params['resource_id'] ?? null)):?> + params['user_id'] ?? null)) || (null !== ($this->params['tag_id'] ?? null)) || (null !== ($this->params['resource_id'] ?? null))):?> translate('clear_tag_filter')?>