From: Matthew Wire Date: Sat, 20 Jan 2018 03:56:33 +0000 (+0700) Subject: Use fontawesome check for membership auto-renew status and add exclamation for auto... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=6bb529e7bf75711e0096e30a4c6faabd9aceefa0;p=civicrm-core.git Use fontawesome check for membership auto-renew status and add exclamation for auto-renew but error (eg. subscription cancelled). --- diff --git a/CRM/Member/Page/Tab.php b/CRM/Member/Page/Tab.php index ecbdab6b77..789bbf1f63 100644 --- a/CRM/Member/Page/Tab.php +++ b/CRM/Member/Page/Tab.php @@ -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; diff --git a/CRM/Member/Selector/Search.php b/CRM/Member/Selector/Search.php index 696623f668..36cda3a4d5 100644 --- a/CRM/Member/Selector/Search.php +++ b/CRM/Member/Selector/Search.php @@ -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 ); diff --git a/templates/CRM/Member/Form/Selector.tpl b/templates/CRM/Member/Form/Selector.tpl index b2ebddc194..b5ab5f59d6 100644 --- a/templates/CRM/Member/Form/Selector.tpl +++ b/templates/CRM/Member/Form/Selector.tpl @@ -67,7 +67,13 @@ {$row.membership_end_date|truncate:10:''|crmDate} {$row.membership_source} {$row.membership_status} - {if $row.auto_renew}{ts}Auto-renew{/ts} {/if} + + {if $row.auto_renew eq 1} + + {elseif $row.auto_renew eq 2} + + {/if} + {$row.action|replace:'xx':$row.membership_id} {if $row.owner_membership_id} diff --git a/templates/CRM/Member/Page/Tab.tpl b/templates/CRM/Member/Page/Tab.tpl index 6eaa36c054..05391e53b2 100644 --- a/templates/CRM/Member/Page/Tab.tpl +++ b/templates/CRM/Member/Page/Tab.tpl @@ -94,7 +94,13 @@ {$activeMember.end_date|crmDate} {$activeMember.status} {$activeMember.source} - {if $activeMember.auto_renew}{ts}Auto-renew{/ts} {/if} + + {if $activeMember.auto_renew eq 1} + + {elseif $activeMember.auto_renew eq 2} + + {/if} + {$activeMember.related_count} {$activeMember.action|replace:'xx':$activeMember.id} @@ -137,7 +143,13 @@ {$inActiveMember.end_date|crmDate} {$inActiveMember.status} {$inActiveMember.source} - {if $inActiveMember.auto_renew}{ts}Auto-renew{/ts} {/if} + + {if $inActiveMember.auto_renew eq 1} + + {elseif $inActiveMember.auto_renew eq 2} + + {/if} + {$inActiveMember.action|replace:'xx':$inActiveMember.id} {if $inActiveMember.owner_membership_id} {ts}View Primary{/ts}