Fix notices on view membership
authorEileen McNaughton <emcnaughton@wikimedia.org>
Sat, 2 Dec 2023 23:15:51 +0000 (12:15 +1300)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Sun, 3 Dec 2023 00:54:22 +0000 (13:54 +1300)
CRM/Contact/Form/Inline.php
CRM/Member/Page/Tab.php
templates/CRM/Member/Page/Tab.tpl
templates/CRM/common/formButtons.tpl

index ea93dde40ddc58c02e7299e91bf7733201516a7d..253f667311052ae9648466f1dc5303155477876f 100644 (file)
@@ -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
index e6c543f1cd6681551663ddf03a09c3e623febb21..3149c915af57da3bde0df850f7288c88a2f2f79c 100644 (file)
@@ -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;
+  }
+
 }
index b1482ccef6f62843751ea97048e18aec2f51e7af..65943e0ebb5ebb811a92da740e7599472e97b6db 100644 (file)
@@ -28,7 +28,7 @@
         </div>
 
         <div class="action-link">
-          {include file="CRM/common/formButtons.tpl" location="top"}
+          {include file="CRM/common/formButtons.tpl" location="top" form=false}
         </div>
     {/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}
index 9ae42b57fc331f63721613f0f81258a8e9ed0530..05a7a60cd068a522f68af560b2297fe684d08e94 100644 (file)
@@ -27,8 +27,9 @@
     <a class="button{if array_key_exists('class', $linkButton)} {$linkButton.class}{/if}" {$linkname} href="{crmURL p=$linkButton.url q=$linkButton.qs}" {$accessKey} {if array_key_exists('extra', $linkButton)}{$linkButton.extra}>{/if}<span>{$icon|smarty:nodefaults}{$linkButton.title}</span></a>
   {/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}