From 25cc23a6b69129a580a7a5c9ceaf7d18e692dda8 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Wed, 14 Dec 2022 09:10:47 +1300 Subject: [PATCH] Fix smarty notices on Open Case --- CRM/Case/Form/Activity/OpenCase.php | 2 +- CRM/Case/Form/Case.php | 2 +- templates/CRM/Case/Form/Case.tpl | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CRM/Case/Form/Activity/OpenCase.php b/CRM/Case/Form/Activity/OpenCase.php index c159b6b2be..740e7cdb57 100644 --- a/CRM/Case/Form/Activity/OpenCase.php +++ b/CRM/Case/Form/Activity/OpenCase.php @@ -168,8 +168,8 @@ class CRM_Case_Form_Activity_OpenCase { if ($form->_currentlyViewedContactId) { list($displayName) = CRM_Contact_BAO_Contact::getDisplayAndImage($form->_currentlyViewedContactId); - $form->assign('clientName', $displayName); } + $form->assign('clientName', $displayName ?? NULL); $form->add('datepicker', 'start_date', ts('Case Start Date'), [], TRUE); diff --git a/CRM/Case/Form/Case.php b/CRM/Case/Form/Case.php index b22d709192..ec036cebc4 100644 --- a/CRM/Case/Form/Case.php +++ b/CRM/Case/Form/Case.php @@ -174,8 +174,8 @@ class CRM_Case_Form_Case extends CRM_Core_Form { if (!$contact->find(TRUE)) { CRM_Core_Error::statusBounce(ts('Client contact does not exist: %1', [1 => $this->_currentlyViewedContactId])); } - $this->assign('clientName', $contact->display_name); } + $this->assign('clientName', isset($this->_currentlyViewedContactId) ? $contact->display_name : NULL); $session = CRM_Core_Session::singleton(); $this->_currentUserId = $session->get('userID'); diff --git a/templates/CRM/Case/Form/Case.tpl b/templates/CRM/Case/Form/Case.tpl index bcbef3b5f7..9f53ea0708 100644 --- a/templates/CRM/Case/Form/Case.tpl +++ b/templates/CRM/Case/Form/Case.tpl @@ -34,12 +34,12 @@
{$activityTypeDescription}
{/if} -{if !empty($clientName)} +{if $clientName} {ts}Client{/ts} {$clientName} -{elseif empty($clientName) and $action eq 1} +{elseif $action eq 1} {if $context eq 'standalone'} {$form.client_id.label} {$form.client_id.html} -- 2.25.1