From f36a6e1ae714e56304c3257a8e12df56f69c7781 Mon Sep 17 00:00:00 2001 From: Mathavan Veeramuthu Date: Tue, 17 Apr 2018 15:06:28 +0100 Subject: [PATCH 1/2] RED7114 display only public groups in GDPR tab --- CRM/Gdpr/Utils.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CRM/Gdpr/Utils.php b/CRM/Gdpr/Utils.php index aeb5a81..4db150b 100644 --- a/CRM/Gdpr/Utils.php +++ b/CRM/Gdpr/Utils.php @@ -102,7 +102,7 @@ public static function getallGroupSubscription($contactId) { civicrm_subscription_history s INNER JOIN civicrm_contact c ON s.contact_id = c.id INNER JOIN civicrm_group g ON g.id = s.group_id -WHERE s.contact_id = %1 ORDER BY s.date DESC"; +WHERE s.contact_id = %1 AND g.is_active = 1 AND g.visibility = 'Public Pages' ORDER BY s.date DESC"; $resource = CRM_Core_DAO::executeQuery($sql, array( 1 => array($contactId, 'Integer'))); while ($resource->fetch()) { $groupSubscriptions[$resource->id] = array( From bbd49cb4436853463da36e8eb054f3988f05d219 Mon Sep 17 00:00:00 2001 From: Mathavan Veeramuthu Date: Wed, 18 Apr 2018 18:39:17 +0100 Subject: [PATCH 2/2] #54 have a checkbox to filter out show hide all groups in GDPR Tab. --- CRM/Gdpr/Page/Tab.php | 1 + CRM/Gdpr/Utils.php | 6 ++++-- css/gdpr.css | 7 +++++++ templates/CRM/Gdpr/Page/Tab.tpl | 18 +++++++++++++++++- 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/CRM/Gdpr/Page/Tab.php b/CRM/Gdpr/Page/Tab.php index 42b4325..f7e1ccd 100644 --- a/CRM/Gdpr/Page/Tab.php +++ b/CRM/Gdpr/Page/Tab.php @@ -22,6 +22,7 @@ public function run() { $isGdprAdmin = CRM_Core_Permission::check('administer GDPR'); $this->assign('isGdprAdmin', $isGdprAdmin); + CRM_Core_Resources::singleton()->addStyleFile('uk.co.vedaconsulting.gdpr', 'css/gdpr.css'); parent::run(); } diff --git a/CRM/Gdpr/Utils.php b/CRM/Gdpr/Utils.php index 4db150b..335ae76 100644 --- a/CRM/Gdpr/Utils.php +++ b/CRM/Gdpr/Utils.php @@ -98,11 +98,11 @@ public static function getallGroupSubscription($contactId) { } $groupSubscriptions = array(); - $sql = "SELECT c.sort_name, g.title, s.date, s.id, s.contact_id, s.group_id, s.status FROM + $sql = "SELECT c.sort_name, g.title, s.date, s.id, s.contact_id, s.group_id, s.status, g.is_active, CASE WHEN g.visibility = 'Public Pages' THEN 1 ELSE 0 END as is_public FROM civicrm_subscription_history s INNER JOIN civicrm_contact c ON s.contact_id = c.id INNER JOIN civicrm_group g ON g.id = s.group_id -WHERE s.contact_id = %1 AND g.is_active = 1 AND g.visibility = 'Public Pages' ORDER BY s.date DESC"; +WHERE s.contact_id = %1 ORDER BY s.date DESC"; $resource = CRM_Core_DAO::executeQuery($sql, array( 1 => array($contactId, 'Integer'))); while ($resource->fetch()) { $groupSubscriptions[$resource->id] = array( @@ -113,6 +113,8 @@ public static function getallGroupSubscription($contactId) { 'date' => $resource->date, 'title' => $resource->title, 'status' => $resource->status, + 'is_active' => $resource->is_active, + 'is_public' => $resource->is_public, ); } diff --git a/css/gdpr.css b/css/gdpr.css index 44004b7..5f94e72 100644 --- a/css/gdpr.css +++ b/css/gdpr.css @@ -38,4 +38,11 @@ form#EventInfo .custom-group-Event_terms_and_conditions { .crm-gdpr-dashboard-settings-form-block div#help ul li { background-image: unset; +} + +.crm-grouo-subscription-list-form-block .in_active_groups td{ + color: red; +} +.crm-grouo-subscription-list-form-block .list_public_group_div { + padding: 10px 5px 10px 10px; } \ No newline at end of file diff --git a/templates/CRM/Gdpr/Page/Tab.tpl b/templates/CRM/Gdpr/Page/Tab.tpl index c7f56c5..70e23f5 100644 --- a/templates/CRM/Gdpr/Page/Tab.tpl +++ b/templates/CRM/Gdpr/Page/Tab.tpl @@ -38,6 +38,10 @@

{ts}Group Subscription Log{/ts}

+
+ + +
@@ -49,7 +53,7 @@ {foreach from=$groupSubscriptions key=id item=groupSubscription} - + @@ -66,6 +70,18 @@ cj(document).ready( function() { cj('#GroupSubscriptionListTable').DataTable({ "order": [[ 2, "desc" ]], }); + + cj('#display_public_group').prop('checked', true); + cj('#GroupSubscriptionListTable .display_all_groups').hide(); + + cj('#display_public_group').click(function(){ + if (cj(this).prop('checked')) { + cj('#GroupSubscriptionListTable .display_all_groups').hide(); + } + else{ + cj('#GroupSubscriptionListTable .display_all_groups').show(); + } + }); }); {/literal}
{$groupSubscription.title} {$groupSubscription.status} {$groupSubscription.date}