From 4e636a742c14517783ea37b702a1fa4709ca7b87 Mon Sep 17 00:00:00 2001 From: Andrew Hunt Date: Sat, 25 May 2013 17:30:29 -0400 Subject: [PATCH] changes from earlier PR 622 --- CRM/Activity/Form/Search.php | 53 ++++++++- CRM/Member/BAO/Membership.php | 124 ++++++++++++++------- CRM/Member/Page/DashBoard.php | 122 +++++++++++--------- templates/CRM/Member/Page/DashBoard.tpl | 141 ++++++++++++++++++------ 4 files changed, 310 insertions(+), 130 deletions(-) diff --git a/CRM/Activity/Form/Search.php b/CRM/Activity/Form/Search.php index da7e5efe90..f7352b2db7 100644 --- a/CRM/Activity/Form/Search.php +++ b/CRM/Activity/Form/Search.php @@ -435,7 +435,58 @@ class CRM_Activity_Form_Search extends CRM_Core_Form { if (!empty($this->_defaults)) { $this->setDefaults($this->_defaults); } - + + // Added for membership search + + $signupType = CRM_Utils_Request::retrieve('signupType', 'Positive', + CRM_Core_DAO::$_nullObject + ); + + if ($signupType) { + //$this->_formValues['activity_type_id'] = array(); + + $activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, FALSE, FALSE, 'name'); + $signup = CRM_Utils_Array::key('Membership Renewal', $activityTypes); + $renew = CRM_Utils_Array::key('Membership Signup', $activityTypes); + + switch ($signupType) { + case 3: // signups and renewals + $this->_formValues['activity_type_id'][$renew] = 1; + $this->_defaults['activity_type_id'][$renew] = 1; + case 1: // signups only + $this->_formValues['activity_type_id'][$signup] = 1; + $this->_defaults['activity_type_id'][$signup] = 1; + break; + + case 2: // renewals only + $this->_formValues['activity_type_id'][$renew] = 1; + $this->_defaults['activity_type_id'][$renew] = 1; + break; + } + } + + $dateLow = CRM_Utils_Request::retrieve('dateLow', 'Positive', + CRM_Core_DAO::$_nullObject + ); + + if ($dateLow) { + $this->_formValues['activity_date_low'] = $dateLow; + $this->_defaults['activity_date_low'] = $dateLow; + } + + $dateHigh = CRM_Utils_Request::retrieve('dateHigh', 'Positive', + CRM_Core_DAO::$_nullObject + ); + + if ($dateHigh) { + // Activity date time assumes midnight at the beginning of the date + // This sets it to almost midnight at the end of the date + if ($dateHigh <= 99999999) { + $dateHigh = 1000000 * $dateHigh + 235959; + } + $this->_formValues['activity_date_high'] = $dateHigh; + $this->_defaults['activity_date_high'] = $dateHigh; + } } function getFormValues() { diff --git a/CRM/Member/BAO/Membership.php b/CRM/Member/BAO/Membership.php index bc3d44682e..d50bf95895 100644 --- a/CRM/Member/BAO/Membership.php +++ b/CRM/Member/BAO/Membership.php @@ -41,6 +41,11 @@ class CRM_Member_BAO_Membership extends CRM_Member_DAO_Membership { * @static */ static $_importableFields = NULL; + + static $_renewalActType = NULL; + + static $_signupActType = NULL; + function __construct() { parent::__construct(); } @@ -1080,11 +1085,9 @@ INNER JOIN civicrm_membership_type type ON ( type.id = membership.membership_ty /** * Function to get membership joins/renewals for a specified membership - * type. Specifically, retrieves a count of memberships whose start_date - * is within a specified date range. Dates match the regexp - * "yyyy(mm(dd)?)?". Omitted portions of a date match the earliest start - * date or latest end date, i.e., 200803 is March 1st as a start date and - * March 31st as an end date. + * type. Specifically, retrieves a count of memberships whose "Membership + * Signup" or "Membership Renewal" activity falls in the given date range. + * Dates match the pattern "yyyy-mm-dd". * * @param int $membershipTypeId membership type id * @param int $startDate date on which to start counting @@ -1097,24 +1100,45 @@ INNER JOIN civicrm_membership_type type ON ( type.id = membership.membership_ty */ //LCD public static function getMembershipStarts($membershipTypeId, $startDate, $endDate, $isTest = 0, $isOwner = 0) { - $query = "SELECT count(civicrm_membership.id) as member_count - FROM civicrm_membership left join civicrm_membership_status on ( civicrm_membership.status_id = civicrm_membership_status.id ) -WHERE membership_type_id = %1 AND start_date >= '$startDate' AND start_date <= '$endDate' -AND civicrm_membership_status.is_current_member = 1 -AND civicrm_membership.contact_id NOT IN (SELECT id FROM civicrm_contact WHERE is_deleted = 1) -AND is_test = %2"; - // LCD + + $testClause = 'membership.is_test = 1'; + if (!$isTest) { + $testClause = '( membership.is_test IS NULL OR membership.is_test = 0 )'; + } + + if (!self::$_signupActType || !self::$_renewalActType) { + self::_getActTypes(); + } + + if (!self::$_signupActType || !self::$_renewalActType) { + return 0; + } + + $query = " + SELECT COUNT(DISTINCT membership.id) as member_count + FROM civicrm_membership membership +INNER JOIN civicrm_activity activity ON (activity.source_record_id = membership.id AND activity.activity_type_id in (%1, %2)) +INNER JOIN civicrm_membership_status status ON ( membership.status_id = status.id AND status.is_current_member = 1 ) +INNER JOIN civicrm_contact contact ON ( contact.id = membership.contact_id AND contact.is_deleted = 0 ) + WHERE membership.membership_type_id = %3 + AND activity.activity_date_time >= '$startDate' AND activity.activity_date_time <= '$endDate 23:59:59' + AND {$testClause}"; + $query .= ($isOwner) ? ' AND owner_membership_id IS NULL' : ''; - $params = array(1 => array($membershipTypeId, 'Integer'), - 2 => array($isTest, 'Boolean'), + + $params = array( + 1 => array(self::$_signupActType, 'Integer'), + 2 => array(self::$_renewalActType, 'Integer'), + 3 => array($membershipTypeId, 'Integer'), ); + $memberCount = CRM_Core_DAO::singleValueQuery($query, $params); return (int)$memberCount; } /** * Function to get a count of membership for a specified membership type, - * optionally for a specified date. The date must have the form yyyymmdd. + * optionally for a specified date. The date must have the form yyyy-mm-dd. * * If $date is omitted, this function counts as a member anyone whose * membership status_id indicates they're a current member. @@ -1134,8 +1158,8 @@ AND is_test = %2"; * $date. */ public static function getMembershipCount($membershipTypeId, $date = NULL, $isTest = 0, $isOwner = 0) { - if (!is_null($date) && !preg_match('/^\d{8}$/', $date)) { - CRM_Core_Error::fatal(ts('Invalid date "%1" (must have form yyyymmdd).', array(1 => $date))); + if (!CRM_Utils_Rule::date($date)) { + CRM_Core_Error::fatal(ts('Invalid date "%1" (must have form yyyy-mm-dd).', array(1 => $date))); } $params = array(1 => array($membershipTypeId, 'Integer'), @@ -1150,7 +1174,6 @@ AND civicrm_membership.is_test = %2"; $query .= " AND civicrm_membership_status.is_current_member = 1"; } else { - $date = substr($date, 0, 4) . '-' . substr($date, 4, 2) . '-' . substr($date, 6, 2); $query .= " AND civicrm_membership.start_date <= '$date' AND civicrm_membership_status.is_current_member = 1"; } // LCD @@ -2294,11 +2317,8 @@ LEFT JOIN civicrm_membership mem ON ( cr.id = mem.contribution_recur_id ) /** * Function to get membership joins for a specified membership * type. Specifically, retrieves a count of still current memberships whose - * join_date and start_date - * are within a specified date range. Dates match the regexp - * "yyyy(mm(dd)?)?". Omitted portions of a date match the earliest start - * date or latest end date, i.e., 200803 is March 1st as a start date and - * March 31st as an end date. + * join_date and start_date are within a specified date range. Dates match + * the pattern "yyyy-mm-dd". * * @param int $membershipTypeId membership type id * @param int $startDate date on which to start counting @@ -2314,18 +2334,29 @@ LEFT JOIN civicrm_membership mem ON ( cr.id = mem.contribution_recur_id ) if (!$isTest) { $testClause = '( membership.is_test IS NULL OR membership.is_test = 0 )'; } + if (!self::$_signupActType) { + self::_getActTypes(); + } + + if (!self::$_signupActType) { + return 0; + } $query = " - SELECT count( membership.id ) as member_count + SELECT COUNT(DISTINCT membership.id) as member_count FROM civicrm_membership membership +INNER JOIN civicrm_activity activity ON (activity.source_record_id = membership.id AND activity.activity_type_id = %1) INNER JOIN civicrm_membership_status status ON ( membership.status_id = status.id AND status.is_current_member = 1 ) -INNER JOIN civicrm_contact contact ON ( membership.contact_id = contact.id AND contact.is_deleted = 0 ) - WHERE membership.membership_type_id = %1 - AND membership.join_date >= '$startDate' AND membership.join_date <= '$endDate' - AND membership.start_date >= '$startDate' AND membership.start_date <= '$endDate' +INNER JOIN civicrm_contact contact ON ( contact.id = membership.contact_id AND contact.is_deleted = 0 ) + WHERE membership.membership_type_id = %2 + AND activity.activity_date_time >= '$startDate' AND activity.activity_date_time <= '$endDate 23:59:59' AND {$testClause}"; - $params = array(1 => array($membershipTypeId, 'Integer')); + $params = array( + 1 => array(self::$_signupActType, 'Integer'), + 2 => array($membershipTypeId, 'Integer'), + ); + $memberCount = CRM_Core_DAO::singleValueQuery($query, $params); return (int)$memberCount; @@ -2333,12 +2364,9 @@ INNER JOIN civicrm_contact contact ON ( membership.contact_id = contact.id AND /** * Function to get membership renewals for a specified membership - * type. Specifically, retrieves a count of still current memberships whose - * join_date is before and start_date - * is within a specified date range. Dates match the regexp - * "yyyy(mm(dd)?)?". Omitted portions of a date match the earliest start - * date or latest end date, i.e., 200803 is March 1st as a start date and - * March 31st as an end date. + * type. Specifically, retrieves a count of still current memberships + * whose join_date is before and start_date is within a specified date + * range. Dates match the pattern "yyyy-mm-dd". * * @param int $membershipTypeId membership type id * @param int $startDate date on which to start counting @@ -2354,18 +2382,28 @@ INNER JOIN civicrm_contact contact ON ( membership.contact_id = contact.id AND if (!$isTest) { $testClause = '( membership.is_test IS NULL OR membership.is_test = 0 )'; } + if (!self::$_renewalActType) { + self::_getActTypes(); + } + + if (!self::$_renewalActType) { + return 0; + } $query = " - SELECT count(membership.id) as member_count + SELECT COUNT(DISTINCT membership.id) as member_count FROM civicrm_membership membership +INNER JOIN civicrm_activity activity ON (activity.source_record_id = membership.id AND activity.activity_type_id = %1) INNER JOIN civicrm_membership_status status ON ( membership.status_id = status.id AND status.is_current_member = 1 ) INNER JOIN civicrm_contact contact ON ( contact.id = membership.contact_id AND contact.is_deleted = 0 ) - WHERE membership.membership_type_id = %1 - AND membership.join_date < '$startDate' - AND membership.start_date >= '$startDate' AND membership.start_date <= '$endDate' + WHERE membership.membership_type_id = %2 + AND activity.activity_date_time >= '$startDate' AND activity.activity_date_time <= '$endDate 23:59:59' AND {$testClause}"; - $params = array(1 => array($membershipTypeId, 'Integer')); + $params = array( + 1 => array(self::$_renewalActType, 'Integer'), + 2 => array($membershipTypeId, 'Integer'), + ); $memberCount = CRM_Core_DAO::singleValueQuery($query, $params); return (int)$memberCount; @@ -2742,5 +2780,11 @@ WHERE civicrm_membership.is_test = 0"; $fieldID = key($qf->_priceSet['fields']); $qf->_params['price_' . $fieldID] = CRM_Utils_Array::value('id', $editedResults); } + + static function _getActTypes() { + $activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, FALSE, FALSE, 'name'); + self::$_renewalActType = CRM_Utils_Array::key('Membership Renewal', $activityTypes); + self::$_signupActType = CRM_Utils_Array::key('Membership Signup', $activityTypes); + } } diff --git a/CRM/Member/Page/DashBoard.php b/CRM/Member/Page/DashBoard.php index 42cac7d0a9..13b8e1d218 100644 --- a/CRM/Member/Page/DashBoard.php +++ b/CRM/Member/Page/DashBoard.php @@ -49,17 +49,18 @@ class CRM_Member_Page_DashBoard extends CRM_Core_Page { function preProcess() { CRM_Utils_System::setTitle(ts('CiviMember')); $membershipSummary = array(); - $preMonth = CRM_Utils_Date::customFormat(date("Y-m-d", mktime(0, 0, 0, date("m") - 1, 01, date("Y"))), '%Y%m%d'); - $preMonthEnd = CRM_Utils_Date::customFormat(date("Y-m-t", mktime(0, 0, 0, date("m") - 1, 01, date("Y"))), '%Y%m%d'); - $prePreMonthEnd = CRM_Utils_Date::customFormat(date("Y-m-t", mktime(0, 0, 0, date("m") - 2, 01, date("Y"))), '%Y%m%d'); + $preMonth = date("Y-m-d", mktime(0, 0, 0, date("m") - 1, 01, date("Y"))); + $preMonthEnd = date("Y-m-t", mktime(0, 0, 0, date("m") - 1, 01, date("Y"))); $preMonthYear = mktime(0, 0, 0, substr($preMonth, 4, 2), 1, substr($preMonth, 0, 4)); - $today = getdate(); - $date = CRM_Utils_Date::getToday(); + $today = getdate(); + $date = CRM_Utils_Date::getToday(); $isCurrentMonth = 0; + // You can force the dashboard to display based upon a certain date $ym = CRM_Utils_Array::value('date', $_GET); + if ($ym) { if (preg_match('/^\d{6}$/', $ym) == 0 || !checkdate(substr($ym, 4, 2), 1, substr($ym, 0, 4)) || @@ -69,34 +70,22 @@ class CRM_Member_Page_DashBoard extends CRM_Core_Page { } $isPreviousMonth = 0; - $isCurrentMonth = substr($ym, 0, 4) == $today['year'] && substr($ym, 4, 2) == $today['mon']; - $ymd = date('Ymd', mktime(0, 0, -1, substr($ym, 4, 2) + 1, 1, substr($ym, 0, 4))); - $monthStartTs = mktime(0, 0, 0, substr($ym, 4, 2), 1, substr($ym, 0, 4)); - $current = CRM_Utils_Date::customFormat($date, '%Y%m%d'); + $isCurrentMonth = substr($ym, 0, 4) == $today['year'] && substr($ym, 4, 2) == $today['mon']; + $ymd = date('Y-m-d', mktime(0, 0, -1, substr($ym, 4, 2) + 1, 1, substr($ym, 0, 4))); + $monthStartTs = mktime(0, 0, 0, substr($ym, 4, 2), 1, substr($ym, 0, 4)); + $current = CRM_Utils_Date::customFormat($date, '%Y-%m-%d'); + $ym = substr($ym, 0, 4) . '-' . substr($ym, 4, 2); } else { - $ym = sprintf("%04d%02d", $today['year'], $today['mon']); - $ymd = sprintf("%04d%02d%02d", $today['year'], $today['mon'], $today['mday']); - $monthStartTs = mktime(0, 0, 0, $today['mon'], 1, $today['year']); - $current = NULL; - $isCurrentMonth = 1; + $ym = sprintf("%04d-%02d", $today['year'], $today['mon']); + $ymd = sprintf("%04d-%02d-%02d", $today['year'], $today['mon'], $today['mday']); + $monthStartTs = mktime(0, 0, 0, $today['mon'], 1, $today['year']); + $current = CRM_Utils_Date::customFormat($date, '%Y-%m-%d'); + $isCurrentMonth = 1; $isPreviousMonth = 1; } - $monthStart = $ym . '01'; - $yearStart = substr($ym, 0, 4) . '0101'; - - // $preMonthStart is the day before $monthStart - $preMonthStart = CRM_Utils_Date::customFormat(date("Y-m-t", - mktime(0, 0, 0, substr($ym, 4, 2) - 1, 01, substr($ym, 0, 4)) - ), - '%Y%m%d' - ); - // $preYearStart is the day before $yearStart - $preYearStart = CRM_Utils_Date::customFormat(date("Y-m-t", - mktime(0, 0, 0, 12, 31, substr($ym, 0, 4) - 1) - ), - '%Y%m%d' - ); + $monthStart = $ym . '-01'; + $yearStart = substr($ym, 0, 4) . '-01-01'; $membershipTypes = CRM_Member_BAO_MembershipType::getMembershipTypes(FALSE); // added @@ -175,6 +164,11 @@ class CRM_Member_Page_DashBoard extends CRM_Core_Page { $status = CRM_Member_BAO_MembershipStatus::getMembershipStatusCurrent(); $status = implode(',', $status); + /* Disabled for lack of appropriate search + + The Membership search isn't able to properly filter by join or renewal events. + Until that works properly, the subtotals shouldn't get links. + foreach ($membershipSummary as $typeID => $details) { foreach ($details as $key => $value) { switch ($key) { @@ -243,8 +237,26 @@ class CRM_Member_Page_DashBoard extends CRM_Core_Page { } } } - // LCD debug - //CRM_Core_Error::debug($membershipSummary); + */ + + // Temporary replacement for current totals column + + foreach ($membershipSummary as $typeID => $details) { + if (!$isCurrentMonth) { + $membershipSummary[$typeID]['total']['total']['url'] = CRM_Utils_System::url('civicrm/member/search', + "reset=1&force=1&start=&end=$ymd&status=$status&type=$typeID" + ); + $membershipSummary[$typeID]['total_owner']['total_owner']['url'] = CRM_Utils_System::url('civicrm/member/search', "reset=1&force=1&start=&end=$ymd&status=$status&type=$typeID&owner=1"); + } + else { + $membershipSummary[$typeID]['total']['total']['url'] = CRM_Utils_System::url('civicrm/member/search', + "reset=1&force=1&status=$status" + ); + $membershipSummary[$typeID]['total_owner']['total_owner']['url'] = CRM_Utils_System::url('civicrm/member/search', "reset=1&force=1&status=$status&owner=1"); + } + $membershipSummary[$typeID]['current']['total']['url'] = CRM_Utils_System::url('civicrm/member/search', "reset=1&force=1&status=$status&type=$typeID"); + $membershipSummary[$typeID]['current_owner']['current_owner']['url'] = CRM_Utils_System::url('civicrm/member/search', "reset=1&force=1&status=$status&type=$typeID&owner=1"); + } $totalCount = array(); @@ -276,64 +288,64 @@ class CRM_Member_Page_DashBoard extends CRM_Core_Page { $totalCount['premonth']['new'] = array( 'count' => $newCountPreMonth, - 'url' => CRM_Utils_System::url('civicrm/member/search', - "reset=1&force=1&status=$status&join=$preMonth&joinEnd=$preMonthEnd&start=$preMonth&end=$preMonthEnd" + 'url' => CRM_Utils_System::url('civicrm/activity/search', + "reset=1&force=1&signupType=1&dateLow=$preMonth&dateHigh=$preMonthEnd" ), ); $totalCount['premonth']['renew'] = array( 'count' => $renewCountPreMonth, - 'url' => CRM_Utils_System::url('civicrm/member/search', - "reset=1&force=1&status=$status&joinEnd=$prePreMonthEnd&start=$preMonth&end=$preMonthEnd" + 'url' => CRM_Utils_System::url('civicrm/activity/search', + "reset=1&force=1&signupType=2&dateLow=$preMonth&dateHigh=$preMonthEnd" ), ); $totalCount['premonth']['total'] = array( 'count' => $totalCountPreMonth, - 'url' => CRM_Utils_System::url('civicrm/member/search', - "reset=1&force=1&status=$status&start=$preMonth&end=$preMonthEnd" + 'url' => CRM_Utils_System::url('civicrm/activity/search', + "reset=1&force=1&signupType=3&dateLow=$preMonth&dateHigh=$preMonthEnd" ), ); $totalCount['month']['new'] = array( 'count' => $newCountMonth, - 'url' => CRM_Utils_System::url('civicrm/member/search', - "reset=1&force=1&status=$status&join=$monthStart&joinEnd=$ymd&start=$monthStart&end=$ymd" + 'url' => CRM_Utils_System::url('civicrm/activity/search', + "reset=1&force=1&signupType=1&dateLow=$monthStart&dateHigh=$ymd" ), ); $totalCount['month']['renew'] = array( 'count' => $renewCountMonth, - 'url' => CRM_Utils_System::url('civicrm/member/search', - "reset=1&force=1&status=$status&joinEnd=$preMonthStart&start=$monthStart&end=$ymd" + 'url' => CRM_Utils_System::url('civicrm/activity/search', + "reset=1&force=1&signupType=2&dateLow=$monthStart&dateHigh=$ymd" ), ); $totalCount['month']['total'] = array( 'count' => $totalCountMonth, - 'url' => CRM_Utils_System::url('civicrm/member/search', - "reset=1&force=1&status=$status&start=$monthStart&end=$ymd" + 'url' => CRM_Utils_System::url('civicrm/activity/search', + "reset=1&force=1&signupType=3&dateLow=$monthStart&dateHigh=$ymd" ), ); $totalCount['year']['new'] = array( 'count' => $newCountYear, - 'url' => CRM_Utils_System::url('civicrm/member/search', - "reset=1&force=1&status=$status&join=$yearStart&joinEnd=$ymd&start=$yearStart&end=$ymd" + 'url' => CRM_Utils_System::url('civicrm/activity/search', + "reset=1&force=1&signupType=1&dateLow=$yearStart&dateHigh=$ymd" ), ); $totalCount['year']['renew'] = array( 'count' => $renewCountYear, - 'url' => CRM_Utils_System::url('civicrm/member/search', - "reset=1&force=1&status=$status&joinEnd=$preYearStart&start=$yearStart&end=$ymd" + 'url' => CRM_Utils_System::url('civicrm/activity/search', + "reset=1&force=1&signupType=2&dateLow=$yearStart&dateHigh=$ymd" ), ); $totalCount['year']['total'] = array( 'count' => $totalCountYear, - 'url' => CRM_Utils_System::url('civicrm/member/search', - "reset=1&force=1&status=$status&start=$yearStart&end=$ymd" + 'url' => CRM_Utils_System::url('civicrm/activity/search', + "reset=1&force=1&signupType=3&dateLow=$yearStart&dateHigh=$ymd" ), ); @@ -360,6 +372,8 @@ class CRM_Member_Page_DashBoard extends CRM_Core_Page { ); } + // Activity search also unable to handle owner vs. inherited + //LCD add owner values $totalCount['premonth_owner']['premonth_owner'] = array( 'count' => $totalCountPreMonth_owner, @@ -368,28 +382,28 @@ class CRM_Member_Page_DashBoard extends CRM_Core_Page { $totalCount['month_owner']['month_owner'] = array( 'count' => $totalCountMonth_owner, - 'url' => CRM_Utils_System::url('civicrm/member/search', "reset=1&force=1&status=$status&start=$monthStart&end=$ymd&owner=1"), + // 'url' => CRM_Utils_System::url('civicrm/member/search', "reset=1&force=1&status=$status&start=$monthStart&end=$ymd&owner=1"), ); $totalCount['year_owner']['year_owner'] = array( 'count' => $totalCountYear_owner, - 'url' => CRM_Utils_System::url('civicrm/member/search', "reset=1&force=1&status=$status&start=$yearStart&end=$ymd&owner=1"), + // 'url' => CRM_Utils_System::url('civicrm/member/search', "reset=1&force=1&status=$status&start=$yearStart&end=$ymd&owner=1"), ); $totalCount['current_owner']['current_owner'] = array( 'count' => $totalCountCurrent_owner, - 'url' => CRM_Utils_System::url('civicrm/member/search', "reset=1&force=1&status=$status&owner=1"), + // 'url' => CRM_Utils_System::url('civicrm/member/search', "reset=1&force=1&status=$status&owner=1"), ); $totalCount['total_owner']['total_owner'] = array( 'count' => $totalCountTotal_owner, - 'url' => CRM_Utils_System::url('civicrm/member/search', "reset=1&force=1&status=$status&owner=1"), + // 'url' => CRM_Utils_System::url('civicrm/member/search', "reset=1&force=1&status=$status&owner=1"), ); if (!$isCurrentMonth) { $totalCount['total_owner']['total_owner'] = array( 'count' => $totalCountTotal_owner, - 'url' => CRM_Utils_System::url('civicrm/member/search', "reset=1&force=1&status=$status&start=&end=$ymd&owner=1"), + // 'url' => CRM_Utils_System::url('civicrm/member/search', "reset=1&force=1&status=$status&start=&end=$ymd&owner=1"), ); } //LCD end diff --git a/templates/CRM/Member/Page/DashBoard.tpl b/templates/CRM/Member/Page/DashBoard.tpl index bf57933a9e..cbd28ee175 100644 --- a/templates/CRM/Member/Page/DashBoard.tpl +++ b/templates/CRM/Member/Page/DashBoard.tpl @@ -58,41 +58,96 @@ {foreach from=$membershipSummary item=row} - {$row.month.total.name} - {if $preMonth} - {$row.premonth.new.count} - {$row.premonth.renew.count} - - - {$row.premonth.total.count}  - [ - {$row.premonth_owner.premonth_owner.count} ] - - {/if} + {$row.month.total.name} + {if $preMonth} + + {if $row.premonth.new.url}{$row.premonth.new.count} + {else}{$row.premonth.new.count}{/if} + + + {if $row.premonth.renew.url}{$row.premonth.renew.count} + {else}{$row.premonth.renew.count}{/if} + + + {if $row.premonth.total.url} + {$row.premonth.total.count} + {else} + {$row.premonth.total.count} + {/if} [ + {if $row.premonth_owner.premonth_owner.url} + {$row.premonth_owner.premonth_owner.count} + {else} + {$row.premonth_owner.premonth_owner.count} + {/if}] + + {/if} - {$row.month.new.count} - {$row.month.renew.count} - {$row.month.total.count}  - [ - {$row.month_owner.month_owner.count} ] - + + {if $row.month.new.url}{$row.month.new.count} + {else}{$row.month.new.count}{/if} + + + {if $row.month.renew.url}{$row.month.renew.count} + {else}{$row.month.renew.count}{/if} + + + {if $row.month.total.url} + {$row.month.total.count} + {else} + {$row.month.total.count} + {/if} [ + {if $row.month_owner.month_owner.url} + {$row.month_owner.month_owner.count} + {else} + {$row.month_owner.month_owner.count} + {/if}] + - {$row.year.new.count} - {$row.year.renew.count} - {$row.year.total.count}  - [ {$row.year_owner.year_owner.count} ] - + + {if $row.year.new.url}{$row.year.new.count} + {else}{$row.year.new.count}{/if} + + + {if $row.year.renew.url}{$row.year.renew.count} + {else}{$row.year.renew.count}{/if} + + + {if $row.year.total.url} + {$row.year.total.count} + {else} + {$row.year.total.count} + {/if} [ + {if $row.year_owner.year_owner.url} + {$row.year_owner.year_owner.count} + {else} + {$row.year_owner.year_owner.count} + {/if}] + - {if $isCurrent} - {$row.current.total.count}  - [ - {$row.current_owner.current_owner.count} ] + {if $isCurrent} + {if $row.current.total.url} + {$row.current.total.count} + {else} + {$row.current.total.count} + {/if} [ + {if $row.current_owner.current_owner.url} + {$row.current_owner.current_owner.count} + {else} + {$row.current_owner.current_owner.count} + {/if} ] + {else} + {if $row.total.total.url} + {$row.total.total.count} + {else} + {$row.total.total.count} + {/if} [ + {if $row.total_owner.total_owner.url} + {$row.total_owner.total_owner.count} {else} - {$row.total.total.count}  - [ - {$row.total_owner.total_owner.count} ] - {/if} + {$row.total_owner.total_owner.count} + {/if} ] + {/if} {* member/search?reset=1&force=1&membership_type_id=1¤t=1 *} {/foreach} @@ -106,7 +161,13 @@ {$totalCount.premonth.renew.count} {$totalCount.premonth.total.count} - [ {$totalCount.premonth_owner.premonth_owner.count} ] + [ + {if $totalCount.premonth_owner.premonth_owner.url} + {$totalCount.premonth_owner.premonth_owner.count} + {else} + {$totalCount.premonth_owner.premonth_owner.count} + {/if} + ] {/if} @@ -116,8 +177,13 @@ {$totalCount.month.renew.count} {$totalCount.month.total.count} - [ - {$totalCount.month_owner.month_owner.count} ] + [ + {if $totalCount.month_owner.month_owner.url} + {$totalCount.month_owner.month_owner.count} + {else} + {$totalCount.month_owner.month_owner.count} + {/if} + ] {$totalCount.year.new.count} @@ -125,8 +191,13 @@ {$totalCount.year.renew.count} {$totalCount.year.total.count} - [ {$totalCount.year_owner.year_owner.count} - ] + [ + {if $totalCount.year_owner.year_owner.url} + {$totalCount.year_owner.year_owner.count} + {else} + {$totalCount.year_owner.year_owner.count} + {/if} + ] -- 2.25.1