Membership js fix to work in popup
authorColeman Watts <coleman@civicrm.org>
Sat, 16 Aug 2014 19:37:19 +0000 (20:37 +0100)
committerColeman Watts <coleman@civicrm.org>
Sat, 16 Aug 2014 19:37:19 +0000 (20:37 +0100)
CRM/Member/Form/Membership.php
templates/CRM/Member/Form/Membership.tpl

index ab978a8563f870e6a19aaec525c10481b6562dad..3180b299f84669a1a9674a1d4acaf9c147dae36d 100644 (file)
@@ -121,7 +121,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form {
     $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
     $this->_contactID = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
     $this->_processors = array();
-    CRM_Core_Resources::singleton()->addSetting(array('ids' => array('contact' => $this->_contactID)));
+    $this->assign('contactID', $this->_contactID);
 
     // check for edit permission
     if (!CRM_Core_Permission::checkActionPermission('CiviMember', $this->_action)) {
index 77229a2dbb145b307594fba06a15453feb50644a..fad591f3c161e75e4347267f37f8d1e8424dd278 100644 (file)
       if ((memType > 0) && (allMemberships[memType]['has_related'])) {
         if (setDefault) cj('#max_related').val(allMemberships[memType]['max_related']);
         cj('#maxRelated').show();
-        if(CRM.ids.contact > 0) {
-          CRM.api('relationship', 'getcount', {'contact_id' : CRM.ids.contact, 'membership_type_id' : memType}, {
+        var cid = {/literal}{if $contactID}{$contactID}{else}null{/if}{literal};
+        if (cid) {
+          CRM.api('relationship', 'getcount', {contact_id: cid, membership_type_id: memType}, {
             success: function(result) {
               var relatable = ' ' + result.result + ts(' contacts are ');
               if(result.result === 0) {