Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/379463 )

Change subject: The big group clean up.
......................................................................

The big group clean up.

Bug: T174407
Change-Id: Id7308add86b6abeddfe28dd6afb740f9450907c6
---
A sites/all/modules/wmf_civicrm/update_7545.php
M sites/all/modules/wmf_civicrm/wmf_civicrm.install
2 files changed, 289 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/63/379463/1

diff --git a/sites/all/modules/wmf_civicrm/update_7545.php 
b/sites/all/modules/wmf_civicrm/update_7545.php
new file mode 100644
index 0000000..081479b
--- /dev/null
+++ b/sites/all/modules/wmf_civicrm/update_7545.php
@@ -0,0 +1,279 @@
+<?php
+
+function _wmf_civicrm_cleanup_groups() {
+  civicrm_initialize();
+
+  $groupsToAssignToLeanne = array(
+    258 => 'Major Gifts Reporting Group',
+    263 => 'All $1000 donors - RL',
+    264 => 'Organization $1000+ - RL',
+    265 => 'Individual $1000+ - RL',
+    266 => 'Monthly Figures - Foundation Gifts under $999.99',
+    268 => '$500+ smart group',
+    269 => '$5k+ smart group',
+    270 => '$1k+ smart group',
+    272 => '100000k+ donors',
+    287 => 'Recently modified recurring',
+    288 => 'Total giving $1000+',
+    289 => 'Total giving $500+',
+  );
+
+  $groupsToAssignToDanny = array(
+    296 => '1k+ in three years to today',
+    297 => 'Wikimedia in review newsletter',
+    298 => 'Wikimedia board report recipients',
+  );
+
+  $groupsToDelete = array(
+    30 => 'Do Not Trade',
+    33 => 'Organizations',
+    37 => 'People Opted-Out',
+    217 => 'Fundraiser 2010 Donors - 100-500',
+    218 => 'Fundraiser 2010 Donors - 50-99.99',
+    219 => 'Fundraiser 2010 Donors - 25-49.99',
+    220 => 'Fundraiser 2010 Donors',
+    221 => 'Fundraiser 2010 Donors - 0-24.99',
+    244 => 'FR2011 - Past - 0200-249.99',
+    245 => 'FR2011 - Past - 0-4.99',
+    283 => 'Recent Worldpay donors 2',
+    284 => 'Incomplete JP Morgan import',
+    243 => 'FR2011 - Past Donors',
+      1 => 'WMF Staff',
+    7 => 'Committees',
+    8 => 'Project Contacts',
+    11 => 'Vendors',
+    12 => 'Persons of Interest',
+    14 => 'Admins_EN_WP',
+    21 => 'Questionables',
+    23 => 'Large Acknowledged Donors',
+    38 => '1K+ October 2008 MG 1 Master Group',
+    39 => 'Recipients of 10/08 $1000 exactly major gifts email',
+    40 => 'Recipients of 10/08 $1001 - $9999 major gifts emailing',
+    41 => 'WMF Office Bulk Mailing List',
+    42 => 'Exclude group for MG 1 10/08 (Recent and special donations)',
+    43 => 'Snail Mail Group for MG 10/08 Mailing',
+    60 => 'Recipient of 12/12/08 Paper Mailing of Major Gifts Prospects',
+    61 => 'Dexia Import Records',
+    64 => '07/08 $1k+ Donors',
+    71 => 'WMF Board Members 09',
+    72 => 'WMF Advisory Board 09',
+    73 => 'Recurring Donors 09',
+    74 => 'Imported Moneybookers',
+    77 => 'Hyperlinked Benefactors Past',
+    80 => 'Gift Renewal Email for 09-10 Fundraising Drive',
+    83 => 'Prospects',
+    84 => 'Open House 12/03/09 Attendees',
+    85 => 'Fraud',
+    86 => 'US Fraud',
+    99 => 'WAC event Feb. 2010 (Invited)',
+    104 => '100.00-499.99 donors 07/01/08-01/29/10',
+    105 => 'London Prospects',
+    107 => 'Delivered Wikimedias 2008-09 Annual Report (100.00-499.99)',
+    108 => '02/10 Tulsa Oklahoma Prospects',
+    111 => '2000 English Donors for Wikipedia Supporters Discussion Group',
+    112 => 'WAC event Feb. 2010 (RSVP)',
+    113 => 'Los Angeles Prospects',
+    114 => '2010 Discussion Group',
+    115 => 'Volunteered after 2010 Discussion Group was full',
+    121 => '08/09 Annual Report Snail Mailing',
+    122 => 'Trial Group for CiviReport',
+    123 => 'November 09 Stewardship',
+    125 => 'Citibank France Feb. 2010',
+    126 => 'Stewardship Statistics General',
+    128 => 'New York City Prospects',
+    130 => 'Hyperlink Renewal Email Spring 2010',
+    144 => 'Wikimedia in Peru (Responded)',
+    145 => 'a personal thank you (Responded)',
+    146 => 'WAC event Feb. 2010 (Attended)',
+    149 => 'Goldman Sachs Employees',
+    153 => 'San Francisco Bay Area Prospects',
+    156 => 'Harnisch Inside the Globe Invitees',
+    157 => 'July 2010 $500+ Donor Report',
+    158 => 'Major Gifts Prospects',
+    159 => 'Hyperlinked Benefactors Current',
+    162 => 'Survey Group 1 (07/10)',
+    163 => 'Survey Group 2 (07/10)',
+    166 => 'Harnisch Inside the Globe Invitations Responded',
+    168 => 'Harnisch Inside the Globe Invitations RSVP "Yes"',
+    173 => 'Open Call',
+    175 => 'Harnisch Inside the Globe Attended',
+    176 => 'Harnisch Inside the Globe No-shows',
+    184 => 'Harnisch Inside the Globe Regrets Email',
+    187 => 'Do Not Email Ever',
+    194 => 'Focus Group Appeal (Usability)',
+    208 => '2010 Snail Mail Campaign',
+    209 => '2010 Fundraiser Donors',
+    210 => 'Do Not Email Ever - Duplicates',
+    229 => 'Quality Assurance',
+    231 => 'JVD Group',
+    234 => 'Wikimedia Deliverability Addresses',
+    242 => 'Fundraiser 2011 - Donor Duplicates',
+    250 => 'Matching Gift Soft Credits',
+    251 => 'Imported checks to review',
+    252 => '2011-12 5000+ and 0',
+    253 => '100 to 299 SF',
+    254 => 'Jimmy snail mail 2013',
+    255 => 'hand written thank you letters 7/1/13-9/30/13',
+    256 => '1000 and over in NYC',
+    259 => 'Annual Report Mail out 2014',
+    260 => 'TSmart Import',
+    271 => 'Office Visit - Interested In',
+    273 => 'Attended London Event 2014',
+    276 => 'MG Year End Appeal 2014',
+    277 => 'Receives WMF Quarterly Report',
+    278 => 'Work Place Giving Donors 2014',
+    279 => 'TSmart Import US and 5000+',
+    280 => 'TSmart Import 50 - 150 miles of SF',
+    281 => 'TSmart Import 0 - 150 miles of LA',
+    282 => 'Recent Worldpay donors',
+
+    // Mailings related
+    226 => 'Fundraiser 2010 - Email 2.r4',
+    227 => 'Fundraiser 2010 - Email 2.r5',
+    228 => 'Fundraiser 2010 - Email 2.r6',
+    211 => 'Fundraiser 2010 - Donor Duplicates',
+    212 => 'Fundraiser 2010 - Past Donors',
+    213 => 'Fundraiser 2010 Past Donors - 100-500',
+    214 => 'Fundraiser 2010 Past Donors - 50-99.99',
+    215 => 'Fundraiser 2010 Past Donors - 25-49.99',
+    216 => 'Fundraiser 2010 Past Donors - 0-24.99',
+    222 => 'Fundraiser 2010 - Email 2.r1',
+    223 => 'Fundraiser 2010 - Email 2.r3',
+    224 => 'Fundraiser 2010 - Email 2.r2',
+    196 => 'Fundraiser 2010 - Email 1.2',
+    197 => 'Fundraiser 2010 - Email 1.3',
+    198 => '$500+ Donors General Email',
+    199 => 'Fundraiser 2010 - Email 1.4',
+    200 => 'Fundraiser 2010 - Email 1.5',
+    202 => 'Fundraiser 2010 - Email 1.6',
+    203 => 'Fundraiser 2010 - Email 1.7',
+    204 => 'Fundraiser 2010 - Email 1.8',
+    205 => 'Fundraiser 2010 - Email 1.9',
+    206 => 'Fundraiser 2010 - Email 1.10',
+    207 => 'Fundraiser 2010 - Email 1.11',
+    87 => 'Recipient of 01/10 AR mailing (100.00-499.99)',
+    88 => 'Recipient of 01/10 AR mailing (75.00-99.99)',
+    89 => 'Recipient of 01/10 AR mailing (50.00-74.99)',
+    90 => 'Recipient of 01/10 AR mailing (35.00 to 39.99)',
+    91 => 'Recipient of 01/10 AR mailing (40.00 to 49.99)',
+    92 => 'Recipient of 01/10 AR mailing (30.00 to 34.99)',
+    93 => 'Recipient of 01/10 AR mailing (25.00 to 29.99)',
+    94 => 'Recipient of 01/10 AR mailing (20.00-24.99)',
+    95 => 'Recipient of 01/10 AR mailing (15.00 to 19.99)',
+    96 => 'Recipient of 01/10 AR mailing (10.00 to 14.99)',
+    97 => 'Recipient of 01/10 AR mailing (5.00 to 9.99)',
+    98 => 'Recipient of 01/10 AR mailing (1.00 to 4.99)',
+    45 => 'Recipient of the 10/31/08 $5 Group A email',
+    46 => 'Recipient of the 10/31/08 $5 Group B email',
+    47 => 'Recipient of the 10/31/08 $5.01-$9.99 Group A email',
+    48 => 'Recipient of the 10/31/08 $5.01-$9.99 Group B email',
+    49 => 'Recipient of 10/31/08 $10 Group A email',
+    50 => 'Recipient of 10/31/08 $10 Group B email',
+    51 => 'Recipient of 10/31/08 $10.01 to $14.99 Group A email',
+    52 => 'Recipient of 10/31/08 $10.01 to $14.99 Group B email',
+    53 => 'Recipients of 10/31/08 $15.00-$19.99 Group email',
+    54 => 'Recipients of the 10/31/08 $20 Group email',
+    55 => 'Recipients of the 10/31/08 $20.01 to $29.99 Group email',
+    56 => 'Recipients of the 10/31/08 $30.00 to $49.99 Group email',
+    57 => 'Recipient of the 10/31/08 $50 Group email',
+    58 => 'Recipient of the 10/31/08 $50.01 to $100.00 Group email',
+    59 => 'Recipient of 10/31/08 $100.01 to $999.99 Group email',
+    150 => 'Wikipedias new look email recipients (05/10)',
+    151 => 'Wikipedias new look email replied (05/10)',
+    152 => 'Wikipedias new look email opened',
+    193 => 'Fundraiser 2010 - Email 1',
+    101 => 'Recipient of 01/10 AR mailing (500.00-9999.99)',
+    102 => 'Recipient of 01/10 AR mailing (10,000+)',
+    160 => 'News from Wikimedia Email',
+    161 => 'News from Wikimedia Email Responded',
+
+    // kinda meaningless
+    131 => '4/28/10',
+    132 => '4/16/10-4/23/10 Paypal',
+    133 => 'April 2010 Missing Contributions',
+    134 => 'April 2010 Import 2',
+    135 => 'April 29 Import',
+    136 => '5/4/10',
+    137 => '4/29',
+    138 => 'April Errors',
+    140 => '5/5/10 Import',
+    142 => 'Temporary',
+    143 => '5/7/10',
+    147 => '5/10/10',
+    148 => 'Sample Group 5/14',
+    109 => 'Nov. 2010 Moneybookers Import',
+    110 => 'Dec. Moneybookers Import',
+    116 => 'Citibank France Dec. 2009',
+    117 => 'Jan. 2010 Citibank France Import',
+    118 => 'Dec. 2009 Citibank France Import',
+    119 => 'Jan. 2010 Moneybookers Import',
+    120 => 'Nov. 2009 Citibank France Import',
+    18 => 'RHandlers Spreadsheet',
+    20 => 'Rebeccas Prospects',
+    16 => 'To Be Reviewed',
+    249 => 'Edit List - Renee',
+    103 => '($100-499.99) Tagged for Review only (01/10 Mailing)',
+    81 => 'Megans Import Group 11/17/2009',
+    82 => 'Missing Contribution Import 11/18/2009',
+
+
+    // empty
+    154 => 'Bay Area Prospects',
+    155 => 'Sample Group 6/3/10',
+    261 => 'Current Donors US (Foundations) (empty)',
+    262 => 'Benefactor Donors - Rosie Lewis (empty)',
+
+    // Tests & broken.
+    235 => 'FR2011',
+    267 => 'Test - Scheduled Reminders',
+    236 => '$20 Test Group 1',
+    237 => '$20 Test Group 2',
+    238 => '$20 Test Group 3',
+    239 => '$20 Test Group 4',
+    240 => '$20 Test Group 5',
+    241 => '$20 Test Group 6',
+    25 => 'CiviTest',
+    26 => 'Test',
+    27 => 'Saras Spreadsheet for Rhandler',
+    29 => 'Community Gifts Test Group',
+    275 => 'International Checks - Test France',
+    232 => 'JVD TEST GROUP',
+    233 => 'Jamess Civi Test Group',
+    230 => 'Josh TEST',
+    225 => 'Peters Ltd Test Group',
+    195 => 'Brians Delivery Test Group',
+    188 => 'Brian Sisolaks Test Group',
+    189 => 'Cookie Experiment Group 1',
+    190 => 'Cookie Experiment Group 2',
+    191 => 'Cookie Experiment Group 3',
+    192 => 'Peters Test Group',
+    174 => 'Staff test group - Open Call Mailing',
+    185 => 'Webitects Fundraiser Testing Email Group 2',
+    186 => 'Webitects Testing Email Group 3',
+    15 => 'Rand Test',
+    17 => 'Robs Test Group',
+    75 => 'Rand Deleter 1',
+    100 => 'Tomasz Test',
+    129 => 'Stevens Test Group',
+    181 => 'Webitects Fundraiser Testing Email',
+    183 => 'Cookie Experiment Master Group',
+    248 => 'Test Donor Search Group',
+    34 => 'Email Address Known to be Invalid',
+    63 => 'Chars Wanted USA email',
+    293 => 'RL DAF TYLs test',
+    294 => 'DAF test',
+
+  );
+
+  foreach (array_keys($groupsToAssignToLeanne) as $group_id) {
+    civicrm_api3('Group', 'create', array('id' => $group_id, 'owner_id' => 
11027170));
+  }
+  foreach (array_keys($groupsToAssignToDanny) as $group_id) {
+    civicrm_api3('Group', 'create', array('id' => $group_id, 'owner_id' => 
15757664));
+  }
+
+  foreach (array_keys($groupsToDelete) as $group_id) {
+    civicrm_api3('Group', 'delete', array('id' => $group_id));
+  }
+
+}
\ No newline at end of file
diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.install 
b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
index 331df2c..d8447c7 100644
--- a/sites/all/modules/wmf_civicrm/wmf_civicrm.install
+++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
@@ -3121,4 +3121,14 @@
     }
   }
 
+  /**
+   * Clean up CiviCRM groups.
+   *
+   * T174407.
+   */
+  function wmf_civicrm_update_7545() {
+    require_once('update_7545.php');
+    _wmf_civicrm_cleanup_groups();
+  }
+
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/379463
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id7308add86b6abeddfe28dd6afb740f9450907c6
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Eileen <emcnaugh...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to