From bb9f3cc940e505ec04893c0f5e5f4196c8469d43 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Sun, 3 Dec 2023 12:15:51 +1300 Subject: [PATCH] Fix notices on view membership --- CRM/Contact/Form/Inline.php | 1 + CRM/Member/Page/Tab.php | 28 +++++++++++++++++++++++++--- templates/CRM/Member/Page/Tab.tpl | 2 +- templates/CRM/common/formButtons.tpl | 6 ++++-- 4 files changed, 31 insertions(+), 6 deletions(-) diff --git a/CRM/Contact/Form/Inline.php b/CRM/Contact/Form/Inline.php index ea93dde40d..253f667311 100644 --- a/CRM/Contact/Form/Inline.php +++ b/CRM/Contact/Form/Inline.php @@ -157,6 +157,7 @@ abstract class CRM_Contact_Form_Inline extends CRM_Core_Form { $smarty = CRM_Core_Smarty::singleton(); $smarty->assign('contactId', $cid); $smarty->assign('external_identifier', CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $cid, 'external_identifier')); + $smarty->assign('created_date', CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $cid, 'created_date')); $smarty->assign('lastModified', CRM_Core_BAO_Log::lastModified($cid, 'civicrm_contact')); $viewOptions = CRM_Core_BAO_Setting::valueOptions(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'contact_view_options', TRUE diff --git a/CRM/Member/Page/Tab.php b/CRM/Member/Page/Tab.php index e6c543f1cd..3149c915af 100644 --- a/CRM/Member/Page/Tab.php +++ b/CRM/Member/Page/Tab.php @@ -25,7 +25,15 @@ class CRM_Member_Page_Tab extends CRM_Core_Page { public static $_membershipTypesLinks = NULL; public $_permission = NULL; - public $_contactId = NULL; + + /** + * Contact ID. + * + * @var int + * + * @deprecated + */ + public $_contactId; /** * @var bool @@ -332,8 +340,9 @@ class CRM_Member_Page_Tab extends CRM_Core_Page { $this->_action = CRM_Core_Action::ADD; } else { - $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE); - $this->assign('contactId', $this->_contactId); + $contactID = $this->getContactID(); + $this->assign('contactId', $contactID); + CRM_Contact_Form_Inline::renderFooter($contactID, FALSE); // check logged in url permission CRM_Contact_Page_View::checkUserPermission($this); @@ -669,4 +678,17 @@ class CRM_Member_Page_Tab extends CRM_Core_Page { } } + /** + * Get the contact ID. + * + * @api Supported for external use. + * + * @return int|null + * @throws \CRM_Core_Exception + */ + public function getContactID(): ?int { + $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE); + return $this->_contactId; + } + } diff --git a/templates/CRM/Member/Page/Tab.tpl b/templates/CRM/Member/Page/Tab.tpl index b1482ccef6..65943e0ebb 100644 --- a/templates/CRM/Member/Page/Tab.tpl +++ b/templates/CRM/Member/Page/Tab.tpl @@ -28,7 +28,7 @@ {/if} {if NOT ($activeMembers or $inActiveMembers) and $action ne 2 and $action ne 1 and $action ne 8 and $action ne 4 and $action ne 32768} diff --git a/templates/CRM/common/formButtons.tpl b/templates/CRM/common/formButtons.tpl index 9ae42b57fc..05a7a60cd0 100644 --- a/templates/CRM/common/formButtons.tpl +++ b/templates/CRM/common/formButtons.tpl @@ -27,8 +27,9 @@ {/if}{$icon|smarty:nodefaults}{$linkButton.title} {/foreach} {/if} - -{foreach from=$form.buttons item=button key=key name=btns} +{if $form} + {* This could be called from Membership View - which is a page not a form but uses it for the links above *} + {foreach from=$form.buttons item=button key=key name=btns} {if $key|substring:0:4 EQ '_qf_'} {if $location} {$form.buttons.$key.html|crmReplace:id:"$key-$location"} @@ -37,4 +38,5 @@ {/if} {/if} {/foreach} +{/if} {/crmRegion} -- 2.25.1