Use fontawesome check for membership auto-renew status and add exclamation for auto...
authorMatthew Wire <devel@mrwire.co.uk>
Sat, 20 Jan 2018 03:56:33 +0000 (10:56 +0700)
committerMatthew Wire <devel@mrwire.co.uk>
Sun, 21 Jan 2018 03:14:44 +0000 (10:14 +0700)
CRM/Member/Page/Tab.php
CRM/Member/Selector/Search.php
templates/CRM/Member/Form/Selector.tpl
templates/CRM/Member/Page/Tab.tpl

index ecbdab6b77f6afb0bdeec788f9d99b238845b958..789bbf1f63d2f04969466112f8402fd95cad5080 100644 (file)
@@ -156,11 +156,14 @@ class CRM_Member_Page_Tab extends CRM_Core_Page {
         );
       }
 
-      //does membership have auto renew CRM-7137.
-      if (!empty($membership[$dao->id]['contribution_recur_id']) &&
-        !CRM_Member_BAO_Membership::isSubscriptionCancelled($membership[$dao->id]['membership_id'])
-      ) {
-        $membership[$dao->id]['auto_renew'] = 1;
+      // Display Auto-renew status on page (0=disabled, 1=enabled, 2=enabled, but error
+      if (!empty($membership[$dao->id]['contribution_recur_id'])) {
+        if (CRM_Member_BAO_Membership::isSubscriptionCancelled($membership[$dao->id]['membership_id'])) {
+          $membership[$dao->id]['auto_renew'] = 2;
+        }
+        else {
+          $membership[$dao->id]['auto_renew'] = 1;
+        }
       }
       else {
         $membership[$dao->id]['auto_renew'] = 0;
index 696623f6683be470e0fcae3d7db4c17faa8937c4..36cda3a4d53642060b9d48d3b38b770b296a37ba 100644 (file)
@@ -316,7 +316,7 @@ class CRM_Member_Selector_Search extends CRM_Core_Selector_Base implements CRM_C
    * @param string $output
    *   What should the result set include (web/email/csv).
    *
-   * @return int
+   * @return array
    *   the total number of rows for this action
    */
   public function &getRows($action, $offset, $rowCount, $sort, $output = NULL) {
@@ -441,14 +441,18 @@ class CRM_Member_Selector_Search extends CRM_Core_Selector_Base implements CRM_C
         );
       }
 
-      //does membership have auto renew CRM-7137.
-      $autoRenew = FALSE;
-      if (isset($result->membership_recur_id) && $result->membership_recur_id &&
-        !CRM_Member_BAO_Membership::isSubscriptionCancelled($row['membership_id'])
-      ) {
-        $autoRenew = TRUE;
+      // Display Auto-renew status on page (0=disabled, 1=enabled, 2=enabled, but error
+      if (!empty($result->membership_recur_id)) {
+        if (CRM_Member_BAO_Membership::isSubscriptionCancelled($row['membership_id'])) {
+          $row['auto_renew'] = 2;
+        }
+        else {
+          $row['auto_renew'] = 1;
+        }
+      }
+      else {
+        $row['auto_renew'] = 0;
       }
-      $row['auto_renew'] = $autoRenew;
 
       $row['contact_type'] = CRM_Contact_BAO_Contact_Utils::getImage($result->contact_sub_type ? $result->contact_sub_type : $result->contact_type, FALSE, $result->contact_id
       );
index b2ebddc1943899758456b300bc9b79f94193b0e0..b5ab5f59d664807bf94c1128a29772cf8886d4d4 100644 (file)
     <td class="crm-membership-end_date">{$row.membership_end_date|truncate:10:''|crmDate}</td>
     <td class="crm-membership-source">{$row.membership_source}</td>
     <td class="crm-membership-status crm-membership-status_{$row.membership_status}">{$row.membership_status}</td>
-    <td class="crm-membership-auto_renew">{if $row.auto_renew}<img src="{$config->resourceBase}i/check.gif" alt="{ts}Auto-renew{/ts}" /> {/if}</td>
+    <td class="crm-membership-auto_renew">
+      {if $row.auto_renew eq 1}
+        <i class="fa fa-check" aria-hidden="true" title="{ts}Auto-renew active{/ts}"></i>
+      {elseif $row.auto_renew eq 2}
+        <i class="fa fa-exclamation" aria-hidden="true" title="{ts}Auto-renew error{/ts}"></i>
+      {/if}
+    </td>
     <td>
         {$row.action|replace:'xx':$row.membership_id}
         {if $row.owner_membership_id}
index 6eaa36c0542d8ce0adb3bd31c6b3709c1f6a278f..05391e53b22df26587449f9c5d22e68cf6ec8a34 100644 (file)
                 <td class="crm-membership-end_date" data-order="{$activeMember.end_date}">{$activeMember.end_date|crmDate}</td>
                 <td class="crm-membership-status">{$activeMember.status}</td>
                 <td class="crm-membership-source">{$activeMember.source}</td>
-                <td class="crm-membership-auto_renew">{if $activeMember.auto_renew}<img src="{$config->resourceBase}i/check.gif" alt="{ts}Auto-renew{/ts}" /> {/if}</td>
+                <td class="crm-membership-auto_renew">
+                  {if $activeMember.auto_renew eq 1}
+                      <i class="fa fa-check" aria-hidden="true" title="{ts}Auto-renew active{/ts}"></i>
+                  {elseif $activeMember.auto_renew eq 2}
+                      <i class="fa fa-exclamation" aria-hidden="true" title="{ts}Auto-renew error{/ts}"></i>
+                  {/if}
+                </td>
                 <td class="crm-membership-related_count">{$activeMember.related_count}</td>
     <td>
                     {$activeMember.action|replace:'xx':$activeMember.id}
                 <td class="crm-membership-end_date" data-order="{$inActiveMember.end_date}">{$inActiveMember.end_date|crmDate}</td>
                 <td class="crm-membership-status">{$inActiveMember.status}</td>
                 <td class="crm-membership-source">{$inActiveMember.source}</td>
-                <td class="crm-membership-auto_renew">{if $inActiveMember.auto_renew}<img src="{$config->resourceBase}i/check.gif" alt="{ts}Auto-renew{/ts}" /> {/if}</td>
+                <td class="crm-membership-auto_renew">
+                  {if $inActiveMember.auto_renew eq 1}
+                    <i class="fa fa-check" aria-hidden="true" title="{ts}Auto-renew active{/ts}"></i>
+                  {elseif $inActiveMember.auto_renew eq 2}
+                    <i class="fa fa-exclamation" aria-hidden="true" title="{ts}Auto-renew error{/ts}"></i>
+                  {/if}
+                </td>
     <td>{$inActiveMember.action|replace:'xx':$inActiveMember.id}
     {if $inActiveMember.owner_membership_id}
       <a href="{crmURL p='civicrm/membership/view' q="reset=1&id=`$inActiveMember.owner_membership_id`&action=view&context=membership&selectedChild=member"}" title="{ts}View Primary member record{/ts}" class="crm-hover-button action-item">{ts}View Primary{/ts}