[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Enforce limit on 1 with fishing net rule.

2018-01-15 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/404330 )

Change subject: Enforce limit on 1 with fishing net rule.
..

Enforce limit on 1 with fishing net rule.

The fishing net rule is more intensive that other rules so should only run on a
single contact.

On testing I was not hitting a large query using 'merge and go to listing' like
I thought I identified in the ticket so I think people may have been doing a 
merge
& winding up at the main dedupe screen & choosing the rule from there. I'll 
double check
with Leanne if there is another way to trigger a bad query. I think the 
exacerbating thing
here is that if the contact you start from is deleted (standard if they have 
the higher
id) then the redirect back to see other dedupe pairs doesn't find any & you 
wind up
on the main screen.

I think we need to add this hook to fix that flow
https://github.com/civicrm/civicrm-core/pull/11519

Bug: T182251
Change-Id: Idab71e3f11dfac1bab0d1de7ee9258bbdbbedb23
---
M sites/all/modules/wmf_civicrm/wmf_civicrm.module
1 file changed, 4 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/30/404330/1

diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.module 
b/sites/all/modules/wmf_civicrm/wmf_civicrm.module
index 67664cd..aaf6054 100644
--- a/sites/all/modules/wmf_civicrm/wmf_civicrm.module
+++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.module
@@ -3967,6 +3967,10 @@
 if (!$fields['limit']) {
   $errors['limit'] = ts('Save the database. Use a limit');
 }
+$ruleGroupID = $form->rgid;
+if ($fields['limit'] > 1 && 'fishing_net' === civicrm_api3('RuleGroup', 
'getvalue', ['id' => $ruleGroupID, 'return' => 'name'])) {
+  $errors['limit'] = ts('The fishing net rule should only be applied to a 
single contact');
+}
   }
   if ($formName == 'CRM_Contribute_Form_Contribution') {
 $engageErrors = wmf_civicrm_validate_contribution($fields, $form);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idab71e3f11dfac1bab0d1de7ee9258bbdbbedb23
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Add civitoken extension.

2018-01-15 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/404329 )

Change subject: Add civitoken extension.
..

Add civitoken extension.

This extension adds a load of tokens for use in mailings. The one Major Gifts 
require is the
address block token, which prints out an address block per site config, without 
extra
lines where a field (e.g city) is blank.

Civitoken is an existing extension which is a bit of a dumping ground for random
tokens. I considered trying to port this one into core... until I saw the core 
code
and also trying to strip the relevant extension out into something separate, but
I opted for creating the ability to disable unloved tokens. The ones I have 
enabled are

address_block - formatted address block in html, suitable for MG letters
address_text  - formatted address block in text - mostly for text only emails
conditional_country - I think this is required for the above, printed country 
if not US
(since WMF is configured as US)
today_format_full - yes this really is missing from core - a today's date token
today_format_raw - same deal, mostly useful if some sort of code comparison is 
in play
so maybe not so much for us.

Bug: T184647
Change-Id: I2c6c77acf947b4a252f8708cf6cc938c6109793a
---
M sites/all/modules/wmf_civicrm/wmf_civicrm.install
A sites/default/civicrm/extensions/nz.co.fuzion.civitoken/LICENSE.txt
A sites/default/civicrm/extensions/nz.co.fuzion.civitoken/README.md
A sites/default/civicrm/extensions/nz.co.fuzion.civitoken/ang/civitoken.ang.php
A sites/default/civicrm/extensions/nz.co.fuzion.civitoken/ang/civitoken.css
A sites/default/civicrm/extensions/nz.co.fuzion.civitoken/ang/civitoken.js
A 
sites/default/civicrm/extensions/nz.co.fuzion.civitoken/ang/civitoken/Setting.html
A 
sites/default/civicrm/extensions/nz.co.fuzion.civitoken/ang/civitoken/Setting.js
A sites/default/civicrm/extensions/nz.co.fuzion.civitoken/civitoken.civix.php
A sites/default/civicrm/extensions/nz.co.fuzion.civitoken/civitoken.php
A sites/default/civicrm/extensions/nz.co.fuzion.civitoken/docs/token_listing.png
A 
sites/default/civicrm/extensions/nz.co.fuzion.civitoken/docs/token_listing_2.png
A sites/default/civicrm/extensions/nz.co.fuzion.civitoken/info.xml
A sites/default/civicrm/extensions/nz.co.fuzion.civitoken/phpunit.xml.dist
A 
sites/default/civicrm/extensions/nz.co.fuzion.civitoken/settings/Civitoken.setting.php
A 
sites/default/civicrm/extensions/nz.co.fuzion.civitoken/tests/phpunit/CRM/BaseUnitTestClass.php
A 
sites/default/civicrm/extensions/nz.co.fuzion.civitoken/tests/phpunit/CRM/CivitokenTest.php
A 
sites/default/civicrm/extensions/nz.co.fuzion.civitoken/tests/phpunit/bootstrap.php
A sites/default/civicrm/extensions/nz.co.fuzion.civitoken/tokens/.gitignore
A sites/default/civicrm/extensions/nz.co.fuzion.civitoken/tokens/README.md
A sites/default/civicrm/extensions/nz.co.fuzion.civitoken/tokens/address.inc
A sites/default/civicrm/extensions/nz.co.fuzion.civitoken/tokens/date.inc
A 
sites/default/civicrm/extensions/nz.co.fuzion.civitoken/tokens/latestcontribs.inc
A 
sites/default/civicrm/extensions/nz.co.fuzion.civitoken/tokens/latestcurrentmembership.inc
A sites/default/civicrm/extensions/nz.co.fuzion.civitoken/tokens/phones.inc
A 
sites/default/civicrm/extensions/nz.co.fuzion.civitoken/tokens/relationships.inc
A 
sites/default/civicrm/extensions/nz.co.fuzion.civitoken/tokens/upcomingevents.inc
A sites/default/civicrm/extensions/nz.co.fuzion.civitoken/tokens/user.inc
28 files changed, 2,548 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/29/404329/1

diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.install 
b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
index b92f1c4..dbc86d7 100644
--- a/sites/all/modules/wmf_civicrm/wmf_civicrm.install
+++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
@@ -64,8 +64,8 @@
   wmf_civicrm_update_7575();
   wmf_civicrm_update_7580();
   wmf_civicrm_update_7585();
-  wmf_civicrm_update_7595();
   wmf_civicrm_update_7605();
+  wmf_civicrm_update_7610();
 }
 
 /**
@@ -3324,3 +3324,25 @@
   civicrm_api3('extension', 'refresh', array());
   civicrm_api3('extension', 'install', array('key' => 
'org.wikimedia.contacteditor'));
 }
+
+/**
+ * Add civitoken extension.
+ *
+ * We want the formatted address blocks from here.
+ *
+ * We disable most of the others to keep things clean.
+ *
+ * Bug: T184647
+ */
+function wmf_civicrm_update_7610() {
+  civicrm_initialize();
+  civicrm_api3('extension', 'refresh', array());
+  civicrm_api3('extension', 'install', array('key' => 
'nz.co.fuzion.civitoken'));
+  civicrm_api3('Setting', 'create', array('civitoken_enabled_tokens' => array(
+'address.address_block',
+'address.address_text',
+'address.conditional_country',
+'date.today_format_full',
+'date.today_format_raw',
+  )));
+}
diff --git 
a/sites/default/civicrm/extensions/

[MediaWiki-commits] [Gerrit] wikimedia...crm[deployment]: Merge branch 'master' of https://gerrit.wikimedia.org/r/wiki...

2018-01-11 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/403874 )

Change subject: Merge branch 'master' of 
https://gerrit.wikimedia.org/r/wikimedia/fundraising/crm into deployment
..

Merge branch 'master' of 
https://gerrit.wikimedia.org/r/wikimedia/fundraising/crm into deployment

Change-Id: Ia39284980bb927f4043dd88addfe71396473e42a
---
D phpunit.xml
1 file changed, 0 insertions(+), 59 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/74/403874/1

diff --git a/phpunit.xml b/phpunit.xml
deleted file mode 100644
index 211d2a2..000
--- a/phpunit.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-<<< HEAD   (354f32 Update CiviCRM submodule)
-===
-http://www.w3.org/2001/XMLSchema-instance";
-xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/3.7/phpunit.xsd";
-bootstrap="sites/default/bootstrap-phpunit.php">
-
-
-
-  
-sites/all/modules/large_donation/tests
-  
-  
-sites/all/modules/offline2civicrm/tests
-
sites/all/modules/offline2civicrm/tests/includes/BaseChecksFileTest.php
-  
-  
-sites/all/modules/exchange_rates/tests/phpunit
-  
-  
-
sites/all/modules/metrics_reporting/tests/phpunit
-  
-  
-sites/all/modules/orphan_slayer/tests/phpunit
-  
-  
-sites/all/modules/queue2civicrm/tests/phpunit
-  
-  
-sites/all/modules/recurring_globalcollect/tests
-  
-  
-sites/all/modules/thank_you/tests/phpunit
-  
-  
-sites/all/modules/wmf_audit/tests
-  
-  
-sites/all/modules/wmf_campaigns/tests
-  
-  
-sites/all/modules/wmf_civicrm/tests/phpunit
-  
-  
-sites/all/modules/wmf_common/tests/phpunit
-  
-  
-
sites/all/modules/wmf_communication/tests/phpunit
-
sites/all/modules/wmf_communication/tests/phpunit/CiviMailTestBase.php
-  
-  
-
sites/default/civicrm/extensions/org.wikimedia.omnimail/tests/phpunit
-  
-  
-
sites/default/civicrm/extensions/org.wikimedia.contacteditor/tests/phpunit
-  
-
-
->>> BRANCH (a8d515 Update CiviCRM submodule)

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia39284980bb927f4043dd88addfe71396473e42a
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: deployment
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[deployment]: Update CiviCRM submodule

2018-01-10 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/403559 )

Change subject: Update CiviCRM submodule
..

Update CiviCRM submodule

9017e2e CRM-21634 Stdise search fields as they relate to contacts

Change-Id: I0ca5498e4515d691aff9ec6d607ece1e3b77f2b0
---
M civicrm
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/59/403559/1

diff --git a/civicrm b/civicrm
index 9fbcd49..9017e2e 16
--- a/civicrm
+++ b/civicrm
@@ -1 +1 @@
-Subproject commit 9fbcd496bd919097cf6f87bebf9ff325aa184c7c
+Subproject commit 9017e2e90a7324edc34c7d0c4eea62fbeb32940e

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0ca5498e4515d691aff9ec6d607ece1e3b77f2b0
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: deployment
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[deployment]: Add extension to change contact types

2018-01-10 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/403558 )

Change subject: Add extension to change contact types
..

Add extension to change contact types

Note we need some (already upstreamed) civicrm fixes merged +
progress on this https://github.com/civicrm/civicrm-core/pull/11405
before the tests will pass.

I propose that we actually DON'T skip processing greetings
when the amount is $500+ because it would benefit major gifts if that were set.

Bug: T156193
Change-Id: I7c34be4225c04ac112d74891035607144178fd5f
---
M sites/all/modules/wmf_civicrm/wmf_civicrm.install
A 
sites/default/civicrm/extensions/org.wikimedia.contacteditor/ActivityTypeContactChange.mgd.php
A 
sites/default/civicrm/extensions/org.wikimedia.contacteditor/CRM/Contacteditor/ChangeContactType.php
A 
sites/default/civicrm/extensions/org.wikimedia.contacteditor/CRM/Contacteditor/Form/ContactTypeChange.php
A sites/default/civicrm/extensions/org.wikimedia.contacteditor/LICENSE.txt
A sites/default/civicrm/extensions/org.wikimedia.contacteditor/README.md
A 
sites/default/civicrm/extensions/org.wikimedia.contacteditor/contacteditor.civix.php
A sites/default/civicrm/extensions/org.wikimedia.contacteditor/contacteditor.php
A sites/default/civicrm/extensions/org.wikimedia.contacteditor/info.xml
A sites/default/civicrm/extensions/org.wikimedia.contacteditor/phpunit.xml.dist
A 
sites/default/civicrm/extensions/org.wikimedia.contacteditor/templates/CRM/Contacteditor/Form/ContactTypeChange.tpl
A 
sites/default/civicrm/extensions/org.wikimedia.contacteditor/tests/phpunit/BaseUnitTestClass.php
A 
sites/default/civicrm/extensions/org.wikimedia.contacteditor/tests/phpunit/ContactEditorTest.php
A 
sites/default/civicrm/extensions/org.wikimedia.contacteditor/tests/phpunit/bootstrap.php
A 
sites/default/civicrm/extensions/org.wikimedia.contacteditor/xml/Menu/contacteditor.xml
15 files changed, 2,211 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/58/403558/1

diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.install 
b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
index 3b30ed8..b92f1c4 100644
--- a/sites/all/modules/wmf_civicrm/wmf_civicrm.install
+++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
@@ -64,6 +64,8 @@
   wmf_civicrm_update_7575();
   wmf_civicrm_update_7580();
   wmf_civicrm_update_7585();
+  wmf_civicrm_update_7595();
+  wmf_civicrm_update_7605();
 }
 
 /**
@@ -3311,3 +3313,14 @@
 civicrm_api3('Contact', 'create', array('id' => $result->id));
   }
 }
+
+/**
+ * Add contact type editor extension.
+ *
+ * Bug: TT156193
+ */
+function wmf_civicrm_update_7605() {
+  civicrm_initialize();
+  civicrm_api3('extension', 'refresh', array());
+  civicrm_api3('extension', 'install', array('key' => 
'org.wikimedia.contacteditor'));
+}
diff --git 
a/sites/default/civicrm/extensions/org.wikimedia.contacteditor/ActivityTypeContactChange.mgd.php
 
b/sites/default/civicrm/extensions/org.wikimedia.contacteditor/ActivityTypeContactChange.mgd.php
new file mode 100644
index 000..d790c4d
--- /dev/null
+++ 
b/sites/default/civicrm/extensions/org.wikimedia.contacteditor/ActivityTypeContactChange.mgd.php
@@ -0,0 +1,15 @@
+ array(
+'name' => 'Contact Type Changed',
+'entity' => 'OptionValue',
+'params' => array(
+  'version' => 3,
+  'option_group_id' => 'activity_type',
+  'label' => 'Contact Type Changed',
+  'name' => 'contact_type_changed',
+  'description' => 'Contact type changed',
+  'filter' => 1,
+),
+  ),
+);
diff --git 
a/sites/default/civicrm/extensions/org.wikimedia.contacteditor/CRM/Contacteditor/ChangeContactType.php
 
b/sites/default/civicrm/extensions/org.wikimedia.contacteditor/CRM/Contacteditor/ChangeContactType.php
new file mode 100644
index 000..6a10e4f
--- /dev/null
+++ 
b/sites/default/civicrm/extensions/org.wikimedia.contacteditor/CRM/Contacteditor/ChangeContactType.php
@@ -0,0 +1,331 @@
+getApiRequest();
+if ($request['entity'] !== 'Contact' || $request['action'] !== 'create') {
+  return;
+}
+if (empty($request['params']['id']) || 
empty($request['params']['contact_type'])) {
+  // Hook is only interested in changes that update contact type.
+  return;
+}
+$contactID = $request['params']['id'];
+$newContactType = $request['params']['contact_type'];
+// Usually we will return after getting this - if we proceed past here we 
do more extensive data gathering as it is 'the real deal'.
+$existingContactType = civicrm_api3('Contact', 'getvalue', [
+  'id' => $contactID,
+  'return' => 'contact_type',
+]);
+if ($existingContactType === $newContactType) {
+  return;
+}
+if (!empty($request['params']['check_permissions']) && 
!CRM_Core_Permission::check(array('Change CiviCRM contact type'))) {
+  throw new CRM_Core_Exception('You do have not perm

[MediaWiki-commits] [Gerrit] wikimedia...crm[deployment]: CiviCRM submodule update

2018-01-10 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/403555 )

Change subject: CiviCRM submodule update
..

CiviCRM submodule update

9fbcd49 CRM-16819 improve on CRM_Utils_Request::retrieve
6134e93 Removed use of deprecated =

Change-Id: I67f33ad7064409a061514ff303fd26d3426bd1f5
---
M civicrm
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/55/403555/1

diff --git a/civicrm b/civicrm
index bd3fadb..9fbcd49 16
--- a/civicrm
+++ b/civicrm
@@ -1 +1 @@
-Subproject commit bd3fadbf3335985e0b7ac425217b05ee5e963f11
+Subproject commit 9fbcd496bd919097cf6f87bebf9ff325aa184c7c

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I67f33ad7064409a061514ff303fd26d3426bd1f5
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: deployment
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[deployment]: Add Citibank International to payment instruments on new ins...

2018-01-10 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/403556 )

Change subject: Add Citibank International to payment instruments on new 
installs.
..

Add Citibank International to payment instruments on new installs.

There are 2 Citibank payment instruments on live but neither are added via the 
install script
for test sites. I have stuck all the code that adds payment instruments into 
one function
and it is always called on new installs. A new function needs to be added to 
get them onto
live like wmf_civicrm_update_7595. I've removed older instances of the 
payment_instrument
adds - I don't feel like it adds some amazing historical value to keep them all.

I also added a few extension installs update functions to the new-install to 
make sure
they get enabled

Change-Id: Ib1ca183c597f464d4493bbe754fd482c7d496691
---
A sites/all/modules/wmf_civicrm/update_payment_instruments.php
M sites/all/modules/wmf_civicrm/wmf_civicrm.install
2 files changed, 110 insertions(+), 158 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/56/403556/1

diff --git a/sites/all/modules/wmf_civicrm/update_payment_instruments.php 
b/sites/all/modules/wmf_civicrm/update_payment_instruments.php
new file mode 100644
index 000..920cb56
--- /dev/null
+++ b/sites/all/modules/wmf_civicrm/update_payment_instruments.php
@@ -0,0 +1,101 @@
+ array(array('total_amount', 'receive_date')),
   ));
-}
-
-/**
- * Add Latin American payment methods for AstroPay
- */
-function wmf_civicrm_update_7195() {
-  $payment_instruments = array(
-'Credit Card: Elo',
-'Credit Card: HiperCard',
-'Credit Card: MercadoLivre',
-'Credit Card: Cabal',
-'Credit Card: Naranja',
-'Credit Card: Tarjeta Shopping',
-'Credit Card: Nativa',
-'Credit Card: Cencosud',
-'Credit Card: Argencard',
-'Credit Card: Webpay',
-'Banamex',
-'Bancomer',
-'Davivienda',
-'Efecty',
-'OXXO',
-'Pago Facil',
-'Provencia Pagos',
-'Red Pagos',
-'Rapi Pago',
-'Santander',
-  );
-  wmf_civicrm_bootstrap_civi();
-  wmf_civicrm_create_option_values('payment_instrument', $payment_instruments);
-}
-
-/**
- * Add a few more Chilean credit cards
- */
-function wmf_civicrm_update_7196() {
-  $payment_instruments = array(
-'Credit Card: CMR Falabella',
-'Credit Card: Magna',
-'Credit Card: Presto',
-  );
-  wmf_civicrm_bootstrap_civi();
-  wmf_civicrm_create_option_values('payment_instrument', $payment_instruments);
 }
 
 /**
@@ -3016,17 +2878,6 @@
 }
 
 /**
- * Add Bijcard
- */
-function wmf_civicrm_update_7521() {
-  $payment_instruments = array(
-'Credit Card: Bijenkorf',
-  );
-  wmf_civicrm_bootstrap_civi();
-  wmf_civicrm_create_option_values('payment_instrument', $payment_instruments);
-}
-
-/**
  * Normalize old phone numbers
  **/
 function wmf_civicrm_update_7522() {
@@ -3434,7 +3285,7 @@
 /**
  * Add Stripe payment instrument
  */
-function wmf_civicrm_update_7590() {
-  civicrm_initialize();
-  wmf_civicrm_create_option_values('payment_instrument', array('Stripe'));
+function wmf_civicrm_update_7595() {
+  require_once 'update_payment_instruments.php';
+  wmf_install_add_missing_payment_instruments();
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib1ca183c597f464d4493bbe754fd482c7d496691
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: deployment
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[deployment]: Re-save any contacts without a display name.

2018-01-10 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/403557 )

Change subject: Re-save any contacts without a display name.
..

Re-save any contacts without a display name.

Doing a blank re-save will cause the display name to be recalculated by Civi
 * rules.
 *
 * Not useful here but possibly for Major Gifts letter addressing it also
 * will allow us to update addressing fields (e.g Dear Fred) for sending 
letters.
 * We don't do that for all contacts but could for MG.
 *
 * Bug: T179118

Change-Id: Ib74916c507217524d57afb277e97ad8ac297adbe
---
M sites/all/modules/wmf_civicrm/wmf_civicrm.install
1 file changed, 22 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/57/403557/1

diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.install 
b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
index 4340077..3b30ed8 100644
--- a/sites/all/modules/wmf_civicrm/wmf_civicrm.install
+++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
@@ -3289,3 +3289,25 @@
   require_once 'update_payment_instruments.php';
   wmf_install_add_missing_payment_instruments();
 }
+
+/**
+ * Re-save any contacts without a display name.
+ *
+ * Doing a blank re-save will cause the display name to be recalculated by Civi
+ * rules.
+ *
+ * Not useful here but possibly for Major Gifts letter addressing it also
+ * will allow us to update addressing fields (e.g Dear Fred) for sending 
letters.
+ * We don't do that for all contacts but could for MG.
+ *
+ * Bug: T179118
+ */
+function wmf_civicrm_update_7600() {
+  civicrm_initialize();
+  $result = CRM_Core_DAO::executeQuery(
+"SELECT id FROM civicrm_contact WHERE (display_name is null  OR 
display_name = '') AND is_deleted= 0"
+  );
+  while ($result->fetch()) {
+civicrm_api3('Contact', 'create', array('id' => $result->id));
+  }
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib74916c507217524d57afb277e97ad8ac297adbe
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: deployment
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Update CiviCRM submodule

2018-01-10 Thread Eileen (Code Review)
Eileen has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/403554 )

Change subject: Update CiviCRM submodule
..


Update CiviCRM submodule

9017e2e CRM-21634 Stdise search fields as they relate to contacts

Change-Id: I0ca5498e4515d691aff9ec6d607ece1e3b77f2b0
---
M civicrm
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  jenkins-bot: Verified
  Eileen: Looks good to me, approved



diff --git a/civicrm b/civicrm
index 9fbcd49..9017e2e 16
--- a/civicrm
+++ b/civicrm
@@ -1 +1 @@
-Subproject commit 9fbcd496bd919097cf6f87bebf9ff325aa184c7c
+Subproject commit 9017e2e90a7324edc34c7d0c4eea62fbeb32940e

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I0ca5498e4515d691aff9ec6d607ece1e3b77f2b0
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Eileen 
Gerrit-Reviewer: Eileen 
Gerrit-Reviewer: Ejegg 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Update CiviCRM submodule

2018-01-10 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/403554 )

Change subject: Update CiviCRM submodule
..

Update CiviCRM submodule

9017e2e CRM-21634 Stdise search fields as they relate to contacts

Change-Id: I0ca5498e4515d691aff9ec6d607ece1e3b77f2b0
---
M civicrm
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/54/403554/1

diff --git a/civicrm b/civicrm
index 9fbcd49..9017e2e 16
--- a/civicrm
+++ b/civicrm
@@ -1 +1 @@
-Subproject commit 9fbcd496bd919097cf6f87bebf9ff325aa184c7c
+Subproject commit 9017e2e90a7324edc34c7d0c4eea62fbeb32940e

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0ca5498e4515d691aff9ec6d607ece1e3b77f2b0
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Add extension to change contact types

2018-01-10 Thread Eileen (Code Review)
Eileen has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/398176 )

Change subject: Add extension to change contact types
..


Add extension to change contact types

Note we need some (already upstreamed) civicrm fixes merged +
progress on this https://github.com/civicrm/civicrm-core/pull/11405
before the tests will pass.

I propose that we actually DON'T skip processing greetings
when the amount is $500+ because it would benefit major gifts if that were set.

Bug: T156193
Change-Id: I7c34be4225c04ac112d74891035607144178fd5f
---
M phpunit.xml
M sites/all/modules/wmf_civicrm/wmf_civicrm.install
A 
sites/default/civicrm/extensions/org.wikimedia.contacteditor/ActivityTypeContactChange.mgd.php
A 
sites/default/civicrm/extensions/org.wikimedia.contacteditor/CRM/Contacteditor/ChangeContactType.php
A 
sites/default/civicrm/extensions/org.wikimedia.contacteditor/CRM/Contacteditor/Form/ContactTypeChange.php
A sites/default/civicrm/extensions/org.wikimedia.contacteditor/LICENSE.txt
A sites/default/civicrm/extensions/org.wikimedia.contacteditor/README.md
A 
sites/default/civicrm/extensions/org.wikimedia.contacteditor/contacteditor.civix.php
A sites/default/civicrm/extensions/org.wikimedia.contacteditor/contacteditor.php
A sites/default/civicrm/extensions/org.wikimedia.contacteditor/info.xml
A sites/default/civicrm/extensions/org.wikimedia.contacteditor/phpunit.xml.dist
A 
sites/default/civicrm/extensions/org.wikimedia.contacteditor/templates/CRM/Contacteditor/Form/ContactTypeChange.tpl
A 
sites/default/civicrm/extensions/org.wikimedia.contacteditor/tests/phpunit/BaseUnitTestClass.php
A 
sites/default/civicrm/extensions/org.wikimedia.contacteditor/tests/phpunit/ContactEditorTest.php
A 
sites/default/civicrm/extensions/org.wikimedia.contacteditor/tests/phpunit/bootstrap.php
A 
sites/default/civicrm/extensions/org.wikimedia.contacteditor/xml/Menu/contacteditor.xml
16 files changed, 2,214 insertions(+), 0 deletions(-)

Approvals:
  jenkins-bot: Verified
  Ejegg: Looks good to me, approved



diff --git a/phpunit.xml b/phpunit.xml
index 5507958..5731077 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -49,5 +49,8 @@
   
 
sites/default/civicrm/extensions/org.wikimedia.omnimail/tests/phpunit
   
+  
+
sites/default/civicrm/extensions/org.wikimedia.contacteditor/tests/phpunit
+  
 
 
diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.install 
b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
index 3b30ed8..b92f1c4 100644
--- a/sites/all/modules/wmf_civicrm/wmf_civicrm.install
+++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
@@ -64,6 +64,8 @@
   wmf_civicrm_update_7575();
   wmf_civicrm_update_7580();
   wmf_civicrm_update_7585();
+  wmf_civicrm_update_7595();
+  wmf_civicrm_update_7605();
 }
 
 /**
@@ -3311,3 +3313,14 @@
 civicrm_api3('Contact', 'create', array('id' => $result->id));
   }
 }
+
+/**
+ * Add contact type editor extension.
+ *
+ * Bug: TT156193
+ */
+function wmf_civicrm_update_7605() {
+  civicrm_initialize();
+  civicrm_api3('extension', 'refresh', array());
+  civicrm_api3('extension', 'install', array('key' => 
'org.wikimedia.contacteditor'));
+}
diff --git 
a/sites/default/civicrm/extensions/org.wikimedia.contacteditor/ActivityTypeContactChange.mgd.php
 
b/sites/default/civicrm/extensions/org.wikimedia.contacteditor/ActivityTypeContactChange.mgd.php
new file mode 100644
index 000..d790c4d
--- /dev/null
+++ 
b/sites/default/civicrm/extensions/org.wikimedia.contacteditor/ActivityTypeContactChange.mgd.php
@@ -0,0 +1,15 @@
+ array(
+'name' => 'Contact Type Changed',
+'entity' => 'OptionValue',
+'params' => array(
+  'version' => 3,
+  'option_group_id' => 'activity_type',
+  'label' => 'Contact Type Changed',
+  'name' => 'contact_type_changed',
+  'description' => 'Contact type changed',
+  'filter' => 1,
+),
+  ),
+);
diff --git 
a/sites/default/civicrm/extensions/org.wikimedia.contacteditor/CRM/Contacteditor/ChangeContactType.php
 
b/sites/default/civicrm/extensions/org.wikimedia.contacteditor/CRM/Contacteditor/ChangeContactType.php
new file mode 100644
index 000..6a10e4f
--- /dev/null
+++ 
b/sites/default/civicrm/extensions/org.wikimedia.contacteditor/CRM/Contacteditor/ChangeContactType.php
@@ -0,0 +1,331 @@
+getApiRequest();
+if ($request['entity'] !== 'Contact' || $request['action'] !== 'create') {
+  return;
+}
+if (empty($request['params']['id']) || 
empty($request['params']['contact_type'])) {
+  // Hook is only interested in changes that update contact type.
+  return;
+}
+$contactID = $request['params']['id'];
+$newContactType = $request['params']['contact_type'];
+// Usually we will return after getting this - if we proceed past here we 
do more extensive data gathering as it is 'the real deal'.
+$existingContactType = civicrm_api3('Contact', 'getvalue', [
+  

[MediaWiki-commits] [Gerrit] wikimedia...civicrm[master]: CRM-21634 Stdise search fields as they relate to contacts

2018-01-08 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/403098 )

Change subject: CRM-21634 Stdise search fields as they relate to contacts
..

CRM-21634 Stdise search fields as they relate to contacts

https://github.com/civicrm/civicrm-core/pull/11492

Bug: 184496
Change-Id: Id7edd36e043a7a3ce0f693a53da6d05af746747d
---
M CRM/Contribute/Form/Search.php
M CRM/Core/Form/Search.php
M CRM/Event/Form/Search.php
M CRM/Member/Form/Search.php
M CRM/Pledge/Form/Search.php
A templates/CRM/Contact/Form/Search/ContactSearchFields.tpl
M templates/CRM/Contribute/Form/Search.tpl
M templates/CRM/Event/Form/Search.tpl
M templates/CRM/Member/Form/Search.tpl
M templates/CRM/Pledge/Form/Search.tpl
10 files changed, 195 insertions(+), 73 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm/civicrm 
refs/changes/98/403098/1

diff --git a/CRM/Contribute/Form/Search.php b/CRM/Contribute/Form/Search.php
index e79c29b..30bb298 100644
--- a/CRM/Contribute/Form/Search.php
+++ b/CRM/Contribute/Form/Search.php
@@ -173,25 +173,7 @@
*/
   public function buildQuickForm() {
 parent::buildQuickForm();
-$this->addSortNameField();
-
-$this->_group = CRM_Core_PseudoConstant::nestedGroup();
-
-// multiselect for groups
-if ($this->_group) {
-  $this->add('select', 'group', ts('Groups'), $this->_group, FALSE,
-array('id' => 'group', 'multiple' => 'multiple', 'class' => 
'crm-select2')
-  );
-}
-
-// multiselect for tags
-$contactTags = CRM_Core_BAO_Tag::getTags();
-
-if ($contactTags) {
-  $this->add('select', 'contact_tags', ts('Tags'), $contactTags, FALSE,
-array('id' => 'contact_tags', 'multiple' => 'multiple', 'class' => 
'crm-select2')
-  );
-}
+$this->addContactSearchFields();
 
 CRM_Contribute_BAO_Query::buildSearchForm($this);
 
@@ -237,6 +219,36 @@
   }
 
   /**
+   * Get the label for the tag field.
+   *
+   * We do this in a function so the 'ts' wraps the whole string to allow
+   * better translation.
+   *
+   * @return string
+   */
+  protected function getTagLabel() {
+return ts('Contributor Tag(s)');
+  }
+
+  /**
+   * Get the label for the group field.
+   *
+   * @return string
+   */
+  protected function getGroupLabel() {
+return ts('Contributor Group(s)');
+  }
+
+  /**
+   * Get the label for the group field.
+   *
+   * @return string
+   */
+  protected function getContactTypeLabel() {
+return ts('Contributor Contact Type');
+  }
+
+  /**
* The post processing of the form gets done here.
*
* Key things done during post processing are
diff --git a/CRM/Core/Form/Search.php b/CRM/Core/Form/Search.php
index ec2ef48..dabab86 100644
--- a/CRM/Core/Form/Search.php
+++ b/CRM/Core/Form/Search.php
@@ -199,4 +199,39 @@
 return 'search';
   }
 
+  /**
+   * Add generic fields that specify the contact.
+   */
+  protected function addContactSearchFields() {
+$this->addSortNameField();
+
+$this->_group = CRM_Core_PseudoConstant::nestedGroup();
+if ($this->_group) {
+  $this->add('select', 'group', $this->getGroupLabel(), $this->_group, 
FALSE,
+array(
+  'id' => 'group',
+  'multiple' => 'multiple',
+  'class' => 'crm-select2',
+)
+  );
+}
+
+$contactTags = CRM_Core_BAO_Tag::getTags();
+if ($contactTags) {
+  $this->add('select', 'contact_tags', $this->getTagLabel(), $contactTags, 
FALSE,
+array(
+  'id' => 'contact_tags',
+  'multiple' => 'multiple',
+  'class' => 'crm-select2',
+)
+  );
+}
+$this->addField('contact_type', array('entity' => 'Contact'));
+
+if (CRM_Core_Permission::check('access deleted contacts') && 
Civi::settings()->get('contact_undelete')) {
+  $this->addElement('checkbox', 'deleted_contacts', ts('Search in Trash') 
. '' . ts('(deleted contacts)'));
+}
+
+  }
+
 }
diff --git a/CRM/Event/Form/Search.php b/CRM/Event/Form/Search.php
index 4552103..5f5783d 100644
--- a/CRM/Event/Form/Search.php
+++ b/CRM/Event/Form/Search.php
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2017
- * $Id$
- *
  */
 
 /**
@@ -168,11 +166,7 @@
*/
   public function buildQuickForm() {
 parent::buildQuickForm();
-$this->addSortNameField();
-
-if (CRM_Core_Permission::check('access deleted contacts') and 
Civi::settings()->get('contact_undelete')) {
-  $this->addElement('checkbox', 'deleted_contacts', ts('Search in Trash') 
. '' . ts('(deleted contacts)'));
-}
+$this->addContactSearchFields();
 
 CRM_Event_BAO_Query::buildSearchForm($this);
 
@@ -273,6 +267,36 @@
   }
 
   /**
+   * Get the label for the tag field.
+   *
+   * We do this in a function so the 'ts' wraps the whole string to allow
+   * better translation.
+   *
+   * @return string
+   */
+  protected function getTagLabel() {
+return ts('Part

[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: CiviCRM submodule update

2018-01-08 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/403097 )

Change subject: CiviCRM submodule update
..

CiviCRM submodule update

9fbcd49 CRM-16819 improve on CRM_Utils_Request::retrieve
6134e93 Removed use of deprecated =

Change-Id: I67f33ad7064409a061514ff303fd26d3426bd1f5
---
M civicrm
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/97/403097/1

diff --git a/civicrm b/civicrm
index bd3fadb..9fbcd49 16
--- a/civicrm
+++ b/civicrm
@@ -1 +1 @@
-Subproject commit bd3fadbf3335985e0b7ac425217b05ee5e963f11
+Subproject commit 9fbcd496bd919097cf6f87bebf9ff325aa184c7c

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I67f33ad7064409a061514ff303fd26d3426bd1f5
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Re-save any contacts without a display name.

2018-01-08 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/403080 )

Change subject: Re-save any contacts without a display name.
..

Re-save any contacts without a display name.

Doing a blank re-save will cause the display name to be recalculated by Civi
 * rules.
 *
 * Not useful here but possibly for Major Gifts letter addressing it also
 * will allow us to update addressing fields (e.g Dear Fred) for sending 
letters.
 * We don't do that for all contacts but could for MG.
 *
 * Bug: T179118

Change-Id: Ib74916c507217524d57afb277e97ad8ac297adbe
---
M sites/all/modules/wmf_civicrm/wmf_civicrm.install
1 file changed, 22 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/80/403080/1

diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.install 
b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
index 4340077..3b30ed8 100644
--- a/sites/all/modules/wmf_civicrm/wmf_civicrm.install
+++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
@@ -3289,3 +3289,25 @@
   require_once 'update_payment_instruments.php';
   wmf_install_add_missing_payment_instruments();
 }
+
+/**
+ * Re-save any contacts without a display name.
+ *
+ * Doing a blank re-save will cause the display name to be recalculated by Civi
+ * rules.
+ *
+ * Not useful here but possibly for Major Gifts letter addressing it also
+ * will allow us to update addressing fields (e.g Dear Fred) for sending 
letters.
+ * We don't do that for all contacts but could for MG.
+ *
+ * Bug: T179118
+ */
+function wmf_civicrm_update_7600() {
+  civicrm_initialize();
+  $result = CRM_Core_DAO::executeQuery(
+"SELECT id FROM civicrm_contact WHERE (display_name is null  OR 
display_name = '') AND is_deleted= 0"
+  );
+  while ($result->fetch()) {
+civicrm_api3('Contact', 'create', array('id' => $result->id));
+  }
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib74916c507217524d57afb277e97ad8ac297adbe
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...civicrm[master]: CRM-16819 improve on CRM_Utils_Request::retrieve

2018-01-08 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/402905 )

Change subject: CRM-16819 improve on CRM_Utils_Request::retrieve
..

CRM-16819 improve on CRM_Utils_Request::retrieve

I'm proposing this as an improved (but not perfect) way to retrieve data from 
http requests.

The biggest issue IMHO with the CRM_Utils_Request::retrieve method is that the 
third
parameter is & - and if any of the subsequent parameters need to be passed a 
NULL
array must be generated. The practice of passing a specific static NULL array 
is known to
have caused errors due to contamination. This commit offers an alternate 
function without that
parameter (my suggestion is to create a new function again where we really do 
want  to
work but in general it seems flakey to me). I have also re-ordered the 
parameters as I perceive
 as being more commonly required than  (renamed from 'abort').

I have also made it so the new function will throw an exception rather than use 
the deprecated
fatal - as a new function I feel we can enforce this change and I have made 
some changes
to the error message thrown in the validate function so it returns a list of 
permissable
values for the  string as the existing error is hard for developers to work 
with, as it
can be hard to realise why 'int' is wrong (casing) or what should have been 
passed.

Finally I made the visibility on CRM_Utils_Retrieve::getValues protected. This 
function
is not called from within core & is downright unsafe as it does no validation 
so we should
not permit anyone to accidentally use it (I have no reason to think they have

Change-Id: I5531ed061cf3b7f486aa57d073b425d0874c4df0
---
M CRM/Utils/Request.php
M CRM/Utils/Type.php
2 files changed, 77 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm/civicrm 
refs/changes/05/402905/1

diff --git a/CRM/Utils/Request.php b/CRM/Utils/Request.php
index 2748e07..ad6bf09 100644
--- a/CRM/Utils/Request.php
+++ b/CRM/Utils/Request.php
@@ -79,17 +79,15 @@
*   Default value of the variable if not present.
* @param string $method
*   Where to look for the variable - 'GET', 'POST' or 'REQUEST'.
+   * @param bool $isThrowException
+   *   Should a an exception be thrown rather than a fatal.
*
* @return mixed
*   The value of the variable
+   *
+   * @throws \CRM_Core_Exception
*/
-  public static function retrieve($name, $type, &$store = NULL, $abort = 
FALSE, $default = NULL, $method = 'REQUEST') {
-
-// hack to detect stuff not yet converted to new style
-if (!is_string($type)) {
-  CRM_Core_Error::backtrace();
-  CRM_Core_Error::fatal(ts("Please convert retrieve call to use new 
function signature"));
-}
+  public static function retrieve($name, $type, &$store = NULL, $abort = 
FALSE, $default = NULL, $method = 'REQUEST', $isThrowException = FALSE) {
 
 $value = NULL;
 switch ($method) {
@@ -117,6 +115,9 @@
 }
 
 if (!isset($value) && $abort) {
+  if ($isThrowException) {
+throw new CRM_Core_Exception(ts("Could not find valid value for %1", 
array(1 => $name)));
+  }
   CRM_Core_Error::fatal(ts("Could not find valid value for %1", array(1 => 
$name)));
 }
 
@@ -145,7 +146,7 @@
* @return mixed
*The value of the variable
*/
-  public static function getValue($name, $method) {
+  protected static function getValue($name, $method) {
 if (isset($method[$name])) {
   return $method[$name];
 }
@@ -165,6 +166,10 @@
   }
 
   /**
+   * @deprecated
+   *
+   * We should use a function that checks url values.
+   *
* This is a replacement for $_REQUEST which includes $_GET/$_POST
* but excludes $_COOKIE / $_ENV / $_SERVER.
*
@@ -186,4 +191,32 @@
 return $result;
   }
 
+  /**
+   * Retrieve a variable from the http request.
+   *
+   * @param string $name
+   *   Name of the variable to be retrieved.
+   * @param string $type
+   *   Type of the variable (see CRM_Utils_Type for details).
+   *   Most common options are:
+   *   - 'Integer'
+   *   - 'Positive'
+   *   - 'CommaSeparatedIntegers'
+   *   - 'Boolean'
+   *   - 'String'
+   *
+   * @param mixed $defaultValue
+   *   Default value of the variable if not present.
+   * @param bool $isRequired
+   *   Is the variable required for this function to proceed without an 
exception.
+   * @param string $method
+   *   Where to look for the value - GET|POST|REQUEST
+   *
+   * @return mixed
+   */
+  public static function retrieveValue($name, $type, $defaultValue = NULL, 
$isRequired = FALSE, $method = 'REQUEST') {
+$null = NULL;
+return CRM_Utils_Request::retrieve((string) $name, (string) $type, $null, 
(bool) $isRequired, $defaultValue, $method, TRUE);
+  }
+
 }
diff --git a/CRM/Utils/Type.php b/CRM/Utils/Type.php
index fbe1c93..48e575e 100644
--- a/CRM/Utils/Type.php
+++ b/CRM/Utils/Type.php
@@ -369,13 +

[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: WIP Citibank import

2018-01-03 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/401819 )

Change subject: WIP Citibank import
..

WIP Citibank import

Add Citibank import. Some things to think about
1) I chose the existing payment instrument 'Citibank International'
(which had only about 10 existing contributions)
2) From the csv provided it appears most are Organizations but
a few are Individuals maybe and it's not clear how to identify those
from the code
3) There is relatively little data about each transaction. I have mapped:
  'Account Name' => 'gateway_account',
  'Global Reference Number' => 'gateway_txn_id',
  'Amount' => 'gross',
  'Date Posted' => 'settlement_date',
  'Date Received' => 'date',
  'Originator Name' => 'organization_name',
4) Special instructions Line 1 contains some data which might be marginally 
useful?
I have not mapped at this stage
5) I have mapped Date posted to 'settlement_date' & Date Received to 'date' - is
this right? I didn't use time received. SHould I?
6) I have used the following defaults (from JP Morgan) are they correct?
  'contact_type' => 'Organization',
  'contact_source' => 'citibank import',
  'gateway' => 'citibank',
  'gift_source' => 'Community Gift',
  'no_thank_you' => 'No Contact Details',
  'payment_instrument' => 'Citibank International',
  'restrictions' => 'Unrestricted - General',
  'currency' => 'USD',

Change-Id: Ib9aa8c630249d1e398871ccd07424cdcde947afd
---
A sites/all/modules/offline2civicrm/CitibankFile.php
M sites/all/modules/offline2civicrm/offline2civicrm.info
M sites/all/modules/offline2civicrm/offline2civicrm.module
A sites/all/modules/offline2civicrm/tests/CitibankFileTest.php
A sites/all/modules/offline2civicrm/tests/data/citibank.csv
M sites/all/modules/offline2civicrm/tests/includes/BaseChecksFileTest.php
6 files changed, 120 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/19/401819/1

diff --git a/sites/all/modules/offline2civicrm/CitibankFile.php 
b/sites/all/modules/offline2civicrm/CitibankFile.php
new file mode 100644
index 000..9ea2385
--- /dev/null
+++ b/sites/all/modules/offline2civicrm/CitibankFile.php
@@ -0,0 +1,68 @@
+ 'gateway_account',
+  'Global Reference Number' => 'gateway_txn_id',
+  'Amount' => 'gross',
+  'Date Posted' => 'settlement_date',
+  'Date Received' => 'date',
+  'Originator Name' => 'organization_name',
+  // Should we map this anywhere - not super informative but?
+  //'Special Instructions Line 1' => 'source',
+);
+  }
+
+  protected function getDatetimeFields() {
+return array(
+  'date',
+  'settlement_date',
+);
+  }
+
+  protected function mungeMessage(&$msg) {
+parent::mungeMessage($msg);
+if (substr($msg['organization_name'], 0, 2) == '1/') {
+  // For reasons that are unclear sometimes this string appears at the 
start of the Originator Name field.
+  $msg['organization_name'] = substr($msg['organization_name'], 2);
+}
+
+  }
+
+  protected function getDefaultValues() {
+return array_merge(parent::getDefaultValues(), array(
+  'contact_type' => 'Organization',
+  'contact_source' => 'citibank import',
+  'gateway' => 'citibank',
+  'gift_source' => 'Community Gift',
+  'no_thank_you' => 'No Contact Details',
+  'payment_instrument' => 'Citibank International',
+  'restrictions' => 'Unrestricted - General',
+  'currency' => 'USD',
+));
+  }
+
+}
diff --git a/sites/all/modules/offline2civicrm/offline2civicrm.info 
b/sites/all/modules/offline2civicrm/offline2civicrm.info
index 058cd03..473e1ed 100644
--- a/sites/all/modules/offline2civicrm/offline2civicrm.info
+++ b/sites/all/modules/offline2civicrm/offline2civicrm.info
@@ -19,6 +19,7 @@
 files[] = IgnoredRowException.php
 files[] = JpMorganFile.php
 files[] = BenevityFile.php
+files[] = CitibankFile.php
 files[] = PayPalChecksFile.php
 files[] = RefundFile.php
 files[] = SquareFile.php
diff --git a/sites/all/modules/offline2civicrm/offline2civicrm.module 
b/sites/all/modules/offline2civicrm/offline2civicrm.module
index ed491c3..a286eb1 100644
--- a/sites/all/modules/offline2civicrm/offline2civicrm.module
+++ b/sites/all/modules/offline2civicrm/offline2civicrm.module
@@ -107,6 +107,7 @@
 '#default_value' => 'generic_ind',
 '#options' => array(
   'benevity' => t('Benevity'),
+  'citibank' => t('Citibank'),
   'engage' => t('Engage'),
   'coinbase' => t('Coinbase Merchant Orders'),
   'foreign_checks' => t('Foreign Checks'),
@@ -183,6 +184,10 @@
   $importer = new BenevityFile($file->uri);
   break;
 
+case 'citibank':
+  $importer = new CitibankFile($file->uri);
+  break;
+
 case 'paypal':
   $importer = new PayPalChecksFile($file->uri);
   break;
diff --git a

[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Add Citibank International to payment instruments on new ins...

2018-01-03 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/401817 )

Change subject: Add Citibank International to payment instruments on new 
installs.
..

Add Citibank International to payment instruments on new installs.

There are 2 Citibank payment instruments on live but neither are added via the 
install script
for test sites. I have stuck all the code that adds payment instruments into 
one function
and it is always called on new installs. A new function needs to be added to 
get them onto
live like wmf_civicrm_update_7590. I've removed older instances of the 
payment_instrument
adds - I don't feel like it adds some amazing historical value to keep them all.

I also added a few extension installs update functions to the new-install to 
make sure
they get enabled

Change-Id: Ib1ca183c597f464d4493bbe754fd482c7d496691
---
A sites/all/modules/wmf_civicrm/update_payment_instruments.php
M sites/all/modules/wmf_civicrm/wmf_civicrm.install
2 files changed, 110 insertions(+), 150 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/17/401817/1

diff --git a/sites/all/modules/wmf_civicrm/update_payment_instruments.php 
b/sites/all/modules/wmf_civicrm/update_payment_instruments.php
new file mode 100644
index 000..920cb56
--- /dev/null
+++ b/sites/all/modules/wmf_civicrm/update_payment_instruments.php
@@ -0,0 +1,101 @@
+ array(array('total_amount', 'receive_date')),
   ));
-}
-
-/**
- * Add Latin American payment methods for AstroPay
- */
-function wmf_civicrm_update_7195() {
-  $payment_instruments = array(
-'Credit Card: Elo',
-'Credit Card: HiperCard',
-'Credit Card: MercadoLivre',
-'Credit Card: Cabal',
-'Credit Card: Naranja',
-'Credit Card: Tarjeta Shopping',
-'Credit Card: Nativa',
-'Credit Card: Cencosud',
-'Credit Card: Argencard',
-'Credit Card: Webpay',
-'Banamex',
-'Bancomer',
-'Davivienda',
-'Efecty',
-'OXXO',
-'Pago Facil',
-'Provencia Pagos',
-'Red Pagos',
-'Rapi Pago',
-'Santander',
-  );
-  wmf_civicrm_bootstrap_civi();
-  wmf_civicrm_create_option_values('payment_instrument', $payment_instruments);
-}
-
-/**
- * Add a few more Chilean credit cards
- */
-function wmf_civicrm_update_7196() {
-  $payment_instruments = array(
-'Credit Card: CMR Falabella',
-'Credit Card: Magna',
-'Credit Card: Presto',
-  );
-  wmf_civicrm_bootstrap_civi();
-  wmf_civicrm_create_option_values('payment_instrument', $payment_instruments);
 }
 
 /**
@@ -3016,17 +2886,6 @@
 }
 
 /**
- * Add Bijcard
- */
-function wmf_civicrm_update_7521() {
-  $payment_instruments = array(
-'Credit Card: Bijenkorf',
-  );
-  wmf_civicrm_bootstrap_civi();
-  wmf_civicrm_create_option_values('payment_instrument', $payment_instruments);
-}
-
-/**
  * Normalize old phone numbers
  **/
 function wmf_civicrm_update_7522() {
@@ -3434,7 +3293,7 @@
 /**
  * Add Stripe payment instrument
  */
-function wmf_civicrm_update_7590() {
-  civicrm_initialize();
-  wmf_civicrm_create_option_values('payment_instrument', array('Stripe'));
+function wmf_civicrm_update_7595() {
+  require_once 'update_payment_instruments.php';
+  wmf_install_add_missing_payment_instruments();
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib1ca183c597f464d4493bbe754fd482c7d496691
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[deployment]: Merge branch 'master' of https://gerrit.wikimedia.org/r/wiki...

2018-01-02 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/401648 )

Change subject: Merge branch 'master' of 
https://gerrit.wikimedia.org/r/wikimedia/fundraising/crm into deployment
..

Merge branch 'master' of 
https://gerrit.wikimedia.org/r/wikimedia/fundraising/crm into deployment

bcb405b2a89b8f9785dc21386df0ae96dbec58dc Fix for secondary emails on 
unsubscribe email page

Change-Id: If180a20ce6d3627163bf5318b847f93f3960c9ac
---
0 files changed, 0 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/48/401648/1


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If180a20ce6d3627163bf5318b847f93f3960c9ac
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: deployment
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...civicrm[master]: WIP stock upgrade to 4.7.30

2018-01-02 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/401644 )

Change subject: WIP stock upgrade to 4.7.30
..

WIP stock upgrade to 4.7.30

Change-Id: If665c08ddec410c711caf99d3a3b9a92a385898c
---
M CONTRIBUTORS.txt
M CRM/ACL/BAO/ACL.php
M CRM/ACL/BAO/Cache.php
M CRM/ACL/Form/WordPress/Permissions.php
M CRM/ACL/Page/ACL.php
M CRM/ACL/Page/ACLBasic.php
M CRM/ACL/Page/EntityRole.php
M CRM/Activity/ActionMapping.php
M CRM/Activity/BAO/Activity.php
M CRM/Activity/BAO/ActivityAssignment.php
M CRM/Activity/BAO/ActivityTarget.php
M CRM/Activity/BAO/Query.php
M CRM/Activity/DAO/Activity.php
M CRM/Activity/Form/Activity.php
M CRM/Activity/Form/ActivityFilter.php
M CRM/Activity/Form/ActivityLinks.php
M CRM/Activity/Form/Search.php
M CRM/Activity/Form/Task.php
M CRM/Activity/Form/Task/Batch.php
M CRM/Activity/Form/Task/PickOption.php
M CRM/Activity/Form/Task/SearchTaskHookSample.php
M CRM/Activity/Import/Form/Preview.php
M CRM/Activity/Import/Parser.php
M CRM/Activity/Page/AJAX.php
M CRM/Activity/Page/Tab.php
M CRM/Activity/Selector/Search.php
M CRM/Activity/Tokens.php
M CRM/Admin/Form/Extensions.php
M CRM/Admin/Form/MessageTemplates.php
M CRM/Admin/Form/Navigation.php
M CRM/Admin/Form/Options.php
M CRM/Admin/Form/Preferences.php
M CRM/Admin/Form/Preferences/Contribute.php
M CRM/Admin/Form/Preferences/Display.php
M CRM/Admin/Form/Preferences/Mailing.php
M CRM/Admin/Form/RelationshipType.php
M CRM/Admin/Form/ScheduleReminders.php
M CRM/Admin/Form/Setting.php
A CRM/Admin/Form/Setting/Case.php
M CRM/Admin/Form/Setting/Debugging.php
M CRM/Admin/Form/Setting/Localization.php
M CRM/Admin/Form/Setting/Mail.php
M CRM/Admin/Form/Setting/Smtp.php
M CRM/Admin/Page/AJAX.php
M CRM/Admin/Page/Extensions.php
M CRM/Admin/Page/Job.php
M CRM/Badge/Form/Layout.php
M CRM/Batch/BAO/Batch.php
M CRM/Batch/Form/Batch.php
M CRM/Batch/Form/Entry.php
M CRM/Batch/Page/AJAX.php
M CRM/Campaign/BAO/Petition.php
M CRM/Campaign/BAO/Query.php
M CRM/Campaign/BAO/Survey.php
M CRM/Campaign/PseudoConstant.php
M CRM/Case/BAO/Case.php
M CRM/Case/BAO/CaseType.php
M CRM/Case/BAO/Query.php
M CRM/Case/DAO/Case.php
M CRM/Case/Form/Activity.php
M CRM/Case/Form/Activity/ChangeCaseStartDate.php
M CRM/Case/Form/Activity/ChangeCaseStatus.php
M CRM/Case/Form/Activity/ChangeCaseType.php
M CRM/Case/Form/Activity/OpenCase.php
M CRM/Case/Form/ActivityToCase.php
M CRM/Case/Form/ActivityView.php
M CRM/Case/Form/Case.php
M CRM/Case/Form/CustomData.php
M CRM/Case/Info.php
M CRM/Case/Page/AJAX.php
M CRM/Case/XMLProcessor/Process.php
M CRM/Case/XMLProcessor/Report.php
M CRM/Case/XMLRepository.php
M CRM/Case/xml/Menu/Case.xml
M CRM/Case/xml/configuration.sample/Settings.xml
M CRM/Contact/BAO/Contact.php
D CRM/Contact/BAO/Contact/Optimizer.php
M CRM/Contact/BAO/Contact/Utils.php
M CRM/Contact/BAO/Group.php
M CRM/Contact/BAO/GroupContactCache.php
M CRM/Contact/BAO/Individual.php
M CRM/Contact/BAO/Query.php
M CRM/Contact/BAO/Relationship.php
M CRM/Contact/BAO/SavedSearch.php
M CRM/Contact/DAO/Contact.php
M CRM/Contact/DAO/Group.php
M CRM/Contact/DAO/SavedSearch.php
M CRM/Contact/DAO/SubscriptionHistory.php
M CRM/Contact/Form/Contact.php
M CRM/Contact/Form/DedupeRules.php
M CRM/Contact/Form/Edit/CommunicationPreferences.php
M CRM/Contact/Form/Edit/TagsAndGroups.php
M CRM/Contact/Form/GroupContact.php
M CRM/Contact/Form/Inline/CommunicationPreferences.php
M CRM/Contact/Form/Merge.php
M CRM/Contact/Form/RelatedContact.php
M CRM/Contact/Form/Search/Basic.php
M CRM/Contact/Form/Search/Custom/ActivitySearch.php
M CRM/Contact/Form/Search/Custom/ContribSYBNT.php
M CRM/Contact/Form/Search/Custom/Proximity.php
M CRM/Contact/Form/Task.php
M CRM/Contact/Form/Task/Batch.php
M CRM/Contact/Form/Task/Email.php
M CRM/Contact/Form/Task/EmailCommon.php
D CRM/Contact/Form/Task/FindDuplicates.php
M CRM/Contact/Form/Task/Label.php
M CRM/Contact/Form/Task/PDF.php
M CRM/Contact/Form/Task/PDFLetterCommon.php
M CRM/Contact/Form/Task/SMSCommon.php
M CRM/Contact/Import/Form/Preview.php
M CRM/Contact/Import/Parser.php
M CRM/Contact/Import/Parser/Contact.php
M CRM/Contact/Page/AJAX.php
M CRM/Contact/Page/DedupeFind.php
M CRM/Contact/Page/DedupeMerge.php
M CRM/Contact/Page/DedupeRules.php
M CRM/Contact/Page/View/Note.php
M CRM/Contact/Page/View/UserDashBoard/GroupContact.php
M CRM/Contact/Selector.php
M CRM/Contact/Selector/Custom.php
M CRM/Contact/Task.php
M CRM/Contribute/BAO/Contribution.php
M CRM/Contribute/BAO/Contribution/Utils.php
M CRM/Contribute/BAO/ContributionPage.php
M CRM/Contribute/BAO/ContributionRecur.php
M CRM/Contribute/BAO/ManagePremiums.php
M CRM/Contribute/BAO/Query.php
M CRM/Contribute/BAO/Widget.php
M CRM/Contribute/DAO/Contribution.php
M CRM/Contribute/DAO/ContributionPage.php
M CRM/Contribute/Form/AbstractEditPayment.php
M CRM/Contribute/Form/AdditionalInfo.php
M CRM/Contribute/Form/AdditionalPayment.php
M CRM/Contribute/Form/Contribution.php
M CRM/Contribute/Form/Contribution/Confirm.php
M CRM

[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Fix for secondary emails on unsubscribe email page

2018-01-01 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/401426 )

Change subject: Fix for secondary emails on unsubscribe email page
..

Fix for secondary emails on unsubscribe email page

An issue was logged on our extension on github pointing out that the 
unsubscribe email screen (civicrm/a/#/email/unsubscribe) is not displaying 
non-primary emails to remove the bulk mail tag for if there are no primaries 
with that email. In practice I suspect this has no real effect on us as I 
suspect we don't deal much in that flag but we should port up.

https://github.com/eileenmcnaughton/org.wikimedia.unsubscribeemail/issues/2

Bug: T183884
Change-Id: I91edf3c94414d9531961250d0649f2957824e611
---
M 
sites/default/civicrm/extensions/org.wikimedia.unsubscribeemail/ang/unsubscribeemail/UnsubCntrl.html
M sites/default/civicrm/extensions/org.wikimedia.unsubscribeemail/info.xml
2 files changed, 28 insertions(+), 29 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/26/401426/1

diff --git 
a/sites/default/civicrm/extensions/org.wikimedia.unsubscribeemail/ang/unsubscribeemail/UnsubCntrl.html
 
b/sites/default/civicrm/extensions/org.wikimedia.unsubscribeemail/ang/unsubscribeemail/UnsubCntrl.html
index 76b38b4..910d5e6 100755
--- 
a/sites/default/civicrm/extensions/org.wikimedia.unsubscribeemail/ang/unsubscribeemail/UnsubCntrl.html
+++ 
b/sites/default/civicrm/extensions/org.wikimedia.unsubscribeemail/ang/unsubscribeemail/UnsubCntrl.html
@@ -57,32 +57,31 @@
 
   
 
-{{ts('Emails to remove bulk 
email flag from (non primary)')}}
-  {{ ts('These contacts have %1 as as a non-primary email. Leave 
them checked and click
-unsubscribe to unset the bulk email flag on them.', {1: 
formVars.enteredEmail}) }}
-  
-
-  
-{{ ts('Contact') }}
-{{ ts('Unset bulk email flag on email address?') }}
-  
-  
-
-  {{unsubscribeEmail.contact_id_display_name}}
-
-
-  {{ ts('Email is not set as bulk email') 
}}
-  {{ ts('Bulk email flag has been removed from 
this email') }}
-  
-
-  
-
-  
-
-  
+  
+  {{ts('Emails to remove bulk 
email flag from (non primary)')}}
+{{ ts('These contacts have %1 as as a non-primary email. Leave them 
checked and click
+  unsubscribe to unset the bulk email flag on them.', {1: 
formVars.enteredEmail}) }}
+
+  
+
+  {{ ts('Contact') }}
+  {{ ts('Unset bulk email flag on email address?') }}
+
+
+  
+{{unsubscribeEmail.contact_id_display_name}}
+  
+  
+{{ ts('Email is not set as bulk email') 
}}
+{{ ts('Bulk email flag has been removed from 
this email') }}
+
+  
+
+  
+
+  
 
   
-
 
 
   {{ts ('The email %1 is not used as a the primary email for any contact 
in your database and it is not subscribed to any bulk emails', {1:
diff --git 
a/sites/default/civicrm/extensions/org.wikimedia.unsubscribeemail/info.xml 
b/sites/default/civicrm/extensions/org.wikimedia.unsubscribeemail/info.xml
index 112e5ed..e340578 100755
--- a/sites/default/civicrm/extensions/org.wikimedia.unsubscribeemail/info.xml
+++ b/sites/default/civicrm/extensions/org.wikimedia.unsubscribeemail/info.xml
@@ -9,13 +9,13 @@
 emcnaugh...@wikimedia.org
   
   
-http://FIXME
-http://FIXME
-http://FIXME
+https://github.com/eileenmcnaughton/org.wikimedia.unsubscribeemail
+https://github.com/eileenmcnaughton/org.wikimedia.unsubscribeemail
+https://github.com/eileenmcnaughton/org.wikimedia.unsubscribeemail
 http://www.gnu.org/licenses/agpl-3.0.html
   
-  2016-11-22
-  1.0
+  2018-01-02
+  1.1
   stable
   
 4.7

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I91edf3c94414d9531961250d0649f2957824e611
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[deployment]: Merge branch 'master' of https://gerrit.wikimedia.org/r/wiki...

2017-12-20 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/399547 )

Change subject: Merge branch 'master' of 
https://gerrit.wikimedia.org/r/wikimedia/fundraising/crm into deployment
..

Merge branch 'master' of 
https://gerrit.wikimedia.org/r/wikimedia/fundraising/crm into deployment

+ 994a789bcee7766c404d2f609c40c917bdb9e3de Pass in skip_greeting_proceessing 
param
+ 90b7dd4d67a4110fe86a79251aa3de963885b383 Update CiviCRM submodule
bd3fadb CRM-21551 Add parameter to support skipping processing greetings 
when calling api contact.create
fc9dc65 Fix for CRM-21180: Inline changes to custom fields aren't reflected 
in custom greetings.
ad68507 Greetings fixes (already upstreamed)
4ded9af Greetings fixes to support contact type change.

Change-Id: Iebd7b9a2eeb52e9c4614be896fa9b79482ff9f5c
---
0 files changed, 0 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/47/399547/1


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iebd7b9a2eeb52e9c4614be896fa9b79482ff9f5c
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: deployment
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Update CiviCRM submodule

2017-12-20 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/399545 )

Change subject: Update CiviCRM submodule
..

Update CiviCRM submodule

bd3fadb CRM-21551 Add parameter to support skipping processing greetings when 
calling api contact.create
fc9dc65 Fix for CRM-21180: Inline changes to custom fields aren't reflected in 
custom greetings.
ad68507 Greetings fixes (already upstreamed)
4ded9af Greetings fixes to support contact type change.

Bug:  T156193
Change-Id: Iadcf4697c10ce8413de0dadb52e3f4803d0546f4
---
M civicrm
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/45/399545/1

diff --git a/civicrm b/civicrm
index b2fab9d..bd3fadb 16
--- a/civicrm
+++ b/civicrm
@@ -1 +1 @@
-Subproject commit b2fab9d9d24b1187e845ec601f4165683278243c
+Subproject commit bd3fadbf3335985e0b7ac425217b05ee5e963f11

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iadcf4697c10ce8413de0dadb52e3f4803d0546f4
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Extract function to get Importer class (to re-use from anoth...

2017-12-19 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/399251 )

Change subject: Extract function to get Importer class (to re-use from another 
place)
..

Extract function to get Importer class (to re-use from another place)

Bug: T182808
Change-Id: I8968d9b2d50996c96e4706c8a7e69253510e717b
---
M sites/all/modules/offline2civicrm/offline2civicrm.module
1 file changed, 53 insertions(+), 40 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/51/399251/1

diff --git a/sites/all/modules/offline2civicrm/offline2civicrm.module 
b/sites/all/modules/offline2civicrm/offline2civicrm.module
index ed491c3..7fd4fe3 100644
--- a/sites/all/modules/offline2civicrm/offline2civicrm.module
+++ b/sites/all/modules/offline2civicrm/offline2civicrm.module
@@ -166,46 +166,7 @@
   civicrm_initialize();
   $smellyTmp = CRM_Core_TemporaryErrorScope::useException();
 
-  switch ($form_state['values']['import_upload_format']) {
-case 'engage':
-  $importer = new EngageChecksFile($file->uri);
-  break;
-case 'coinbase':
-  $importer = new CoinbaseFile($file->uri);
-  break;
-case 'generic_ind':
-  $importer = new WmfImportFile($file->uri);
-  break;
-case 'generic_org':
-  $importer = new WmfOrgImportFile($file->uri);
-  break;
-case 'benevity':
-  $importer = new BenevityFile($file->uri);
-  break;
-
-case 'paypal':
-  $importer = new PayPalChecksFile($file->uri);
-  break;
-case 'jpmorgan':
-  $importer = new JpMorganFile($file->uri);
-  break;
-case 'foreign_checks':
-  $importer = new ForeignChecksFile($file->uri);
-  break;
-case 'square':
-  $importer = new SquareFile($file->uri);
-  break;
-
-case 'stripe':
-  $importer = new StripeFile($file->uri);
-  break;
-
-case 'trilogy':
-  $importer = new TrilogyFile($file->uri);
-  break;
-default:
-  throw new Exception('Bad file format selection');
-  }
+  $importer = 
getImporterClass($form_state['values']['import_upload_format'], $file->uri);
   $messages = $importer->import();
   drupal_set_message((implode(' ', $messages)));
 }
@@ -224,3 +185,55 @@
 }
   }
 }
+
+/**
+ * Get the class for the import.
+ *
+ * @param string $uploadFormat
+ * @param string $fileUri
+ *
+ * @return \ChecksFile
+ *
+ * @throws \Exception
+ */
+function getImporterClass($uploadFormat, $fileUri) {
+  switch ($uploadFormat) {
+case 'engage':
+  return new EngageChecksFile($fileUri);
+
+case 'coinbase':
+  return new CoinbaseFile($fileUri);
+
+case 'generic_ind':
+  return new WmfImportFile($fileUri);
+
+case 'generic_org':
+  return new WmfOrgImportFile($fileUri);
+
+case 'benevity':
+  return new BenevityFile($fileUri);
+
+case 'paypal':
+  return new PayPalChecksFile($fileUri);
+
+case 'jpmorgan':
+  return JpMorganFile($fileUri);
+
+case 'foreign_checks':
+  return new ForeignChecksFile($fileUri);
+
+case 'square':
+  return new SquareFile($fileUri);
+
+case 'stripe':
+  return new StripeFile($fileUri);
+  break;
+
+case 'trilogy':
+  return new TrilogyFile($fileUri);
+
+default:
+  throw new Exception('Bad file format selection');
+  }
+
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8968d9b2d50996c96e4706c8a7e69253510e717b
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Allow Benevity currencies

2017-12-19 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/399252 )

Change subject: Allow Benevity currencies
..

Allow Benevity currencies

Bug: T182808
Change-Id: Ie16624628c818c08aaa64eb8298a7a4c92c63b08
---
M sites/all/modules/offline2civicrm/BenevityFile.php
M sites/all/modules/offline2civicrm/ChecksFile.php
M sites/all/modules/offline2civicrm/offline2civicrm.module
3 files changed, 59 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/52/399252/1

diff --git a/sites/all/modules/offline2civicrm/BenevityFile.php 
b/sites/all/modules/offline2civicrm/BenevityFile.php
index 683c8c7..97a5322 100644
--- a/sites/all/modules/offline2civicrm/BenevityFile.php
+++ b/sites/all/modules/offline2civicrm/BenevityFile.php
@@ -452,4 +452,24 @@
 return $main ? $main : $matched;
   }
 
+  /**
+   * Get any fields that can be set on import at an import wide level.
+   */
+  public function getImportFields() {
+return array(
+  'usd_total' => array(
+'#title' => t('USD Total'),
+'#type' => 'text_format',
+  ),
+  'original_currency' => array(
+'#title' => t('Original Currency'),
+'#type' => 'text_format',
+  ),
+  'original_currency_total' => array(
+'#title' => t('Original Currency Total'),
+'#type' => 'textfield',
+  ),
+);
+  }
+
 }
diff --git a/sites/all/modules/offline2civicrm/ChecksFile.php 
b/sites/all/modules/offline2civicrm/ChecksFile.php
index f5f0ae0..c29d768 100644
--- a/sites/all/modules/offline2civicrm/ChecksFile.php
+++ b/sites/all/modules/offline2civicrm/ChecksFile.php
@@ -57,9 +57,11 @@
 $this->skipped_file_uri = str_replace('.csv', '_skipped.' . $suffix, 
$file_uri);
 $this->ignored_file_uri = str_replace('.csv', '_ignored.' . $suffix, 
$file_uri);
 $this->all_missed_file_uri = str_replace('.csv', '_all_missed.' . $suffix, 
$file_uri);
-wmf_common_set_smashpig_message_source(
-  'direct', 'Offline importer: ' . get_class($this)
-);
+if ($file_uri) {
+  wmf_common_set_smashpig_message_source(
+'direct', 'Offline importer: ' . get_class($this)
+  );
+}
   }
 
   /**
@@ -674,4 +676,11 @@
 return  wmf_civicrm_get_contributions_from_gateway_id($msg['gateway'], 
$msg['gateway_txn_id']);
   }
 
+  /**
+   * Get any fields that can be set on import at an import wide level.
+   */
+  public function getImportFields() {
+return array();
+  }
+
 }
diff --git a/sites/all/modules/offline2civicrm/offline2civicrm.module 
b/sites/all/modules/offline2civicrm/offline2civicrm.module
index 7fd4fe3..ed84121 100644
--- a/sites/all/modules/offline2civicrm/offline2civicrm.module
+++ b/sites/all/modules/offline2civicrm/offline2civicrm.module
@@ -118,7 +118,21 @@
   'stripe' => t('Stripe'),
   'trilogy' => t('Trilogy'),
 ),
+'#ajax' => array(
+  'callback' => 'offline2civicrm_import_fields',
+  'wrapper' => 'offline2civicrm_settings',
+  'method' => 'replace',
+  'event' => 'change',
+),
   );
+  // Will be replaced by import specific fields.
+  $form['offline2civicrm_settings'] = array(
+'#type' => 'container',
+'#tree' => TRUE,
+'#prefix' => '',
+'#suffix' => '',
+  );
+
   $form['log'] = array(
 '#markup' => $log_html,
   );
@@ -129,6 +143,19 @@
 }
 
 /**
+ * Custom callback to build form fields.
+ */
+function offline2civicrm_import_fields($form, &$form_state) {
+  $values = $form_state['values'];
+  $importer = getImporterClass($values['import_upload_format'], NULL);
+  $fields = $importer->getImportFields();
+  foreach ($fields as $name => $field) {
+$form['offline2civicrm_settings'][$name] = $field;
+  }
+  return $form['offline2civicrm_settings'];
+}
+
+/**
  * Download a results csv.
  *
  * @param $file_name

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie16624628c818c08aaa64eb8298a7a4c92c63b08
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Pass in skip_greeting_proceessing param

2017-12-17 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/398788 )

Change subject: Pass in skip_greeting_proceessing param
..

Pass in skip_greeting_proceessing param

Having moved this skip from a hack to a param we need to pass this in on our
main contact import shim. It doesn't matter if we by-pass it sometimes, this
is for performance rather than for functionality so as
long as we get the main volume q.

Bug: T156193
Change-Id: I14b55e54d18239febf01c93894c62dd68021e8b1
---
M sites/all/modules/wmf_civicrm/wmf_civicrm.module
1 file changed, 4 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/88/398788/1

diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.module 
b/sites/all/modules/wmf_civicrm/wmf_civicrm.module
index 9485811..67664cd 100644
--- a/sites/all/modules/wmf_civicrm/wmf_civicrm.module
+++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.module
@@ -1089,6 +1089,10 @@
 'contact_type' => $msg['contact_type'],
 'contact_source' => $msg['contact_source'],
 'debug' => TRUE,
+// We speed up our imports by passing in this param.
+// going forwards there is scope to a) improve the processing
+// upstream rather than skip & b) not skip for Major Gifts contacts.
+'skip_greeting_processing' => TRUE,
 );
 if (strtolower($msg['contact_type']) !== "organization") {
   foreach (array('first_name', 'last_name', 'middle_name') as $name) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I14b55e54d18239febf01c93894c62dd68021e8b1
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: CiviCRM updates to support changing contact type.

2017-12-17 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/398787 )

Change subject: CiviCRM updates to support changing contact type.
..

CiviCRM updates to support changing contact type.

These are mostly around processing greetings, which we in fact opt out of
when doing bulk processing

Bug: T156193
Change-Id: I30ac3cfc698c74606e6b270508cfd585df3fafe5
---
M civicrm
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/87/398787/1

diff --git a/civicrm b/civicrm
index b2fab9d..bd3fadb 16
--- a/civicrm
+++ b/civicrm
@@ -1 +1 @@
-Subproject commit b2fab9d9d24b1187e845ec601f4165683278243c
+Subproject commit bd3fadbf3335985e0b7ac425217b05ee5e963f11

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I30ac3cfc698c74606e6b270508cfd585df3fafe5
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...civicrm[master]: CRM-21551 Add parameter to support skipping processing greet...

2017-12-17 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/398786 )

Change subject: CRM-21551 Add parameter to support skipping processing 
greetings when calling api contact.create
..

CRM-21551 Add parameter to support skipping processing greetings when calling 
api contact.create

https://github.com/civicrm/civicrm-core/pull/11405

This allows unit tests in the extension to run for us & on stock & brings us 
closer
to stock

Change-Id: Ib99a659495b7c584a986d056d53667b23f62494c
---
M CRM/Contact/BAO/Contact.php
M api/v3/Contact.php
2 files changed, 12 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm/civicrm 
refs/changes/86/398786/1

diff --git a/CRM/Contact/BAO/Contact.php b/CRM/Contact/BAO/Contact.php
index 53730bd..7511c4f 100644
--- a/CRM/Contact/BAO/Contact.php
+++ b/CRM/Contact/BAO/Contact.php
@@ -437,8 +437,12 @@
   }
 }
 
-// process greetings CRM-4575, cache greetings
-// NOT: self::processGreetings($contact);
+// In order to prevent a series of expensive queries in intensive batch 
processing
+// api calls may pass in skip_greeting_processing, probably doing it later 
via the
+// scheduled job. CRM-21551
+if (empty($params['skip_greeting_processing'])) {
+  self::processGreetings($contact);
+}
 
 return $contact;
   }
diff --git a/api/v3/Contact.php b/api/v3/Contact.php
index 7329458..c8332d2 100644
--- a/api/v3/Contact.php
+++ b/api/v3/Contact.php
@@ -153,6 +153,12 @@
 'description' => 'Throw error if contact create matches dedupe rule',
 'type' => CRM_Utils_Type::T_BOOLEAN,
   );
+  $params['skip_greeting_processing'] = array(
+'title' => 'Skip Greeting processing',
+'description' => 'Do not process greetings, (these can be done by 
scheduled job and there may be a preference to do so for performance reasons)',
+'type' => CRM_Utils_Type::T_BOOLEAN,
+'api.default' => 0,
+  );
   $params['prefix_id']['api.aliases'] = array('individual_prefix', 
'individual_prefix_id');
   $params['suffix_id']['api.aliases'] = array('individual_suffix', 
'individual_suffix_id');
   $params['gender_id']['api.aliases'] = array('gender');

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib99a659495b7c584a986d056d53667b23f62494c
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm/civicrm
Gerrit-Branch: master
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[deployment]: Extend risk score limiting to cover components of the score

2017-12-17 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/398783 )

Change subject: Extend risk score limiting to cover components of the score
..

Extend risk score limiting to cover components of the score

Bug: T183102
Change-Id: I3c1b1a0d24bad9a27930d8246f9fdc448b7f1219
---
M sites/all/modules/queue2civicrm/fredge/AntifraudQueueConsumer.php
1 file changed, 3 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/83/398783/1

diff --git a/sites/all/modules/queue2civicrm/fredge/AntifraudQueueConsumer.php 
b/sites/all/modules/queue2civicrm/fredge/AntifraudQueueConsumer.php
index 0e5dfb0..9613f27 100644
--- a/sites/all/modules/queue2civicrm/fredge/AntifraudQueueConsumer.php
+++ b/sites/all/modules/queue2civicrm/fredge/AntifraudQueueConsumer.php
@@ -94,6 +94,9 @@
}
if ( $id ) {
foreach ( $msg['score_breakdown'] as $test => $score ) {
+ if ($score > 1) {
+   $score = 1;
+}
$breakdown = array(
'payments_fraud_id' => $id,
'filter_name' => $test,

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3c1b1a0d24bad9a27930d8246f9fdc448b7f1219
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: deployment
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Apply drupal formatting to AntifraudQueueConsumer.php

2017-12-17 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/398782 )

Change subject: Apply drupal formatting to AntifraudQueueConsumer.php
..

Apply drupal formatting to AntifraudQueueConsumer.php

Change-Id: I5279c87e5c80a4561753709e6e72a8ec0aea73a2
---
M sites/all/modules/queue2civicrm/fredge/AntifraudQueueConsumer.php
1 file changed, 107 insertions(+), 100 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/82/398782/1

diff --git a/sites/all/modules/queue2civicrm/fredge/AntifraudQueueConsumer.php 
b/sites/all/modules/queue2civicrm/fredge/AntifraudQueueConsumer.php
index 9613f27..a0aa736 100644
--- a/sites/all/modules/queue2civicrm/fredge/AntifraudQueueConsumer.php
+++ b/sites/all/modules/queue2civicrm/fredge/AntifraudQueueConsumer.php
@@ -6,112 +6,119 @@
 
 class AntifraudQueueConsumer extends WmfQueueConsumer {
 
-   /**
-* Validate and store messages from the payments-antifraud queue
-*
-* @param array $message
-* @throws WmfException
-*/
-   function processMessage( $message ) {
-   $id = "{$message['gateway']}-{$message['order_id']}";
-   watchdog(
-   'fredge',
-   "Beginning processing of payments-antifraud message for 
$id: " .
-   json_encode( $message ),
-   array(),
-   WATCHDOG_INFO
-   );
+  /**
+   * Validate and store messages from the payments-antifraud queue
+   *
+   * @param array $message
+   *
+   * @throws WmfException
+   */
+  function processMessage($message) {
+$id = "{$message['gateway']}-{$message['order_id']}";
+watchdog(
+  'fredge',
+  "Beginning processing of payments-antifraud message for $id: " .
+  json_encode($message),
+  array(),
+  WATCHDOG_INFO
+);
 
-   // handle the IP address conversion to binary so we can do 
database voodoo later.
-   if ( array_key_exists( 'user_ip', $message ) ) {
-   // check for IPv6
-   if ( strpos( ':', $message['user_ip'] ) !== false ) {
-   /**
-* despite a load of documentation to the 
contrary, the following line
-* ***doesn't work at all***.
-* Which is okay for now: We force IPv4 on 
payments.
-* @TODO eventually: Actually handle IPv6 here.
-*/
-   // $message['user_ip'] = 
inet_pton($message['user_ip']);
+// handle the IP address conversion to binary so we can do database voodoo 
later.
+if (array_key_exists('user_ip', $message)) {
+  // check for IPv6
+  if (strpos(':', $message['user_ip']) !== FALSE) {
+/**
+ * despite a load of documentation to the contrary, the following line
+ * ***doesn't work at all***.
+ * Which is okay for now: We force IPv4 on payments.
+ *
+ * @TODO eventually: Actually handle IPv6 here.
+ */
+// $message['user_ip'] = inet_pton($message['user_ip']);
 
-   watchdog(
-   'fredge',
-   'Weird. Somehow an ipv6 address got 
through on payments. ' .
-   "Caught in antifraud consumer. 
$id",
-   array(),
-   WATCHDOG_WARNING
-   );
-   $message['user_ip'] = 0;
-   } else {
-   $message['user_ip'] = ip2long( 
$message['user_ip'] );
-   }
-   }
+watchdog(
+  'fredge',
+  'Weird. Somehow an ipv6 address got through on payments. ' .
+  "Caught in antifraud consumer. $id",
+  array(),
+  WATCHDOG_WARNING
+);
+$message['user_ip'] = 0;
+  }
+  else {
+$message['user_ip'] = ip2long($message['user_ip']);
+  }
+}
 
-   $this->insertAntifraudData( $message, $id );
-   }
+$this->insertAntifraudData($message, $id);
+  }
 
-   /**
-* take a message and insert or update rows in payments_fraud and 
payments_fraud_breakdown.
-* If there is not yet an antifraud row for this ct_id and order_id, 
all fields
-* in the table must be present in the message.
-* @param array $msg the message that you want to upsert.
-* @param string $logIdentifier Some small string for the log that will 
help id
-* the message if something goes amiss and we have to log about it.
-* @throws FredgeDataValidationException
-*/
-   prot

[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Extend risk score test to cover components

2017-12-17 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/398780 )

Change subject: Extend risk score test to cover components
..

Extend risk score test to cover components

Bug: T183102
Change-Id: I3c1b1a0d24bad9a27930d8246f9fdc448b7f1219
---
M sites/all/modules/queue2civicrm/tests/data/payments-antifraud-high.json
1 file changed, 2 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/80/398780/1

diff --git 
a/sites/all/modules/queue2civicrm/tests/data/payments-antifraud-high.json 
b/sites/all/modules/queue2civicrm/tests/data/payments-antifraud-high.json
index 91ce046..10eb556 100644
--- a/sites/all/modules/queue2civicrm/tests/data/payments-antifraud-high.json
+++ b/sites/all/modules/queue2civicrm/tests/data/payments-antifraud-high.json
@@ -9,7 +9,8 @@
"getScoreUtmCampaignMap": "0",
"getScoreEmailDomainMap": "0",
"minfraud_filter": "0.10",
-   "IPVelocityFilter": "0"
+   "IPVelocityFilter": "0",
+"SessionVelocity" : "4.6602755623854E+38"
},
"php-message-class": 
"SmashPig\\CrmLink\\Messages\\DonationInterfaceAntifraud",
"user_ip": "1.2.3.4",

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3c1b1a0d24bad9a27930d8246f9fdc448b7f1219
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[deployment]: Top out risk score at 100 million.

2017-12-17 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/398779 )

Change subject: Top out risk score at 100 million.
..

Top out risk score at 100 million.

100 million is effectively 'infinite risk' & the DB breaks somewhere above that 
point

Bug: T183102

Change-Id: I5529ff86abf082c41b9c5d075bdc9c164f762872
---
M sites/all/modules/queue2civicrm/fredge/wmf_fredge_qc.module
1 file changed, 5 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/79/398779/1

diff --git a/sites/all/modules/queue2civicrm/fredge/wmf_fredge_qc.module 
b/sites/all/modules/queue2civicrm/fredge/wmf_fredge_qc.module
index 4dd223d..47de8e4 100644
--- a/sites/all/modules/queue2civicrm/fredge/wmf_fredge_qc.module
+++ b/sites/all/modules/queue2civicrm/fredge/wmf_fredge_qc.module
@@ -136,6 +136,11 @@
   if (array_key_exists('mysql_type', $definition) && 
$definition['mysql_type'] === 'DATETIME') {
 $msg[$field] = wmf_common_date_unix_to_sql($msg[$field]);
   }
+  // e.g. 3.5848273556811E+38 breaks the db - use 100 mill as 'infinitely 
dubious'
+  if (!empty($msg['risk_score']) && $msg['risk_score'] > 1) {
+$msg['risk_score'] = 1;
+  }
+
   $data[$field] = $msg[$field];
 }
   }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5529ff86abf082c41b9c5d075bdc9c164f762872
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: deployment
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Top out risk score at 100 million.

2017-12-17 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/398777 )

Change subject: Top out risk score at 100 million.
..

Top out risk score at 100 million.

100 million is effectively 'infinite risk' & the DB breaks somewhere above that 
point

Bug: T183102

Change-Id: I5529ff86abf082c41b9c5d075bdc9c164f762872
---
M sites/all/modules/queue2civicrm/fredge/wmf_fredge_qc.module
M sites/all/modules/queue2civicrm/tests/phpunit/AntifraudQueueTest.php
2 files changed, 29 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/77/398777/1

diff --git a/sites/all/modules/queue2civicrm/fredge/wmf_fredge_qc.module 
b/sites/all/modules/queue2civicrm/fredge/wmf_fredge_qc.module
index 4dd223d..79f697a 100644
--- a/sites/all/modules/queue2civicrm/fredge/wmf_fredge_qc.module
+++ b/sites/all/modules/queue2civicrm/fredge/wmf_fredge_qc.module
@@ -136,6 +136,12 @@
   if (array_key_exists('mysql_type', $definition) && 
$definition['mysql_type'] === 'DATETIME') {
 $msg[$field] = wmf_common_date_unix_to_sql($msg[$field]);
   }
+  if (stristr($msg['risk_score'], 'E')) {
+// e.g. 3.5848273556811E+38 breaks the db - use 100 mill as 
'infinitely dubious'
+if ($msg['risk_score'] > 1) {
+  $msg['risk_score'] = 1;
+}
+  }
   $data[$field] = $msg[$field];
 }
   }
diff --git 
a/sites/all/modules/queue2civicrm/tests/phpunit/AntifraudQueueTest.php 
b/sites/all/modules/queue2civicrm/tests/phpunit/AntifraudQueueTest.php
index ea63274..feffc91 100644
--- a/sites/all/modules/queue2civicrm/tests/phpunit/AntifraudQueueTest.php
+++ b/sites/all/modules/queue2civicrm/tests/phpunit/AntifraudQueueTest.php
@@ -32,7 +32,29 @@
$this->compareMessageWithDb( $message, 
$message['score_breakdown'] );
}
 
-   /**
+  /**
+   * If the risk score is more than 100 million it should be set to 100 mil.
+   *
+   * This is effectively 'infinite risk' and our db can't cope with
+   * real value! '3.5848273556811E+38'
+   */
+  public function testFraudMessageWithOutOfRangeScore() {
+$message = json_decode(
+  file_get_contents(__DIR__ . '/../data/payments-antifraud-high.json'),
+  TRUE
+);
+$ctId = mt_rand();
+$oId = $ctId . '.0';
+$message['contribution_tracking_id'] = $ctId;
+$message['order_id'] = $oId;
+$this->consumer->processMessage($message);
+
+$message['risk_score'] = 1;
+
+$this->compareMessageWithDb($message, $message['score_breakdown']);
+  }
+
+/**
 * The first message for a ct_id / order_id pair needs to be complete
 *
 * @expectedException FredgeDataValidationException

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5529ff86abf082c41b9c5d075bdc9c164f762872
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...civicrm[master]: Fix for CRM-21180: Inline changes to custom fields aren't re...

2017-12-13 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/398210 )

Change subject: Fix for CRM-21180: Inline changes to custom fields aren't 
reflected in custom greetings.
..

Fix for CRM-21180: Inline changes to custom fields aren't reflected in custom 
greetings.

https://github.com/civicrm/civicrm-core/pull/11364/commits

Toward CRM-21180: Better static var handling.

Toward CRM-21180: removed static vars; removed unused method parameters.

CRM-21180 add unit test for custom field being set in address

CRM-21180 Inline changes to custom fields aren't reflected in custom greetings

This incorporates Allan's work to cause custom fields to be updated
when a custom value is updated. These have been reconciled with the changes to 
allow
greeting fields to be set to null per CRM-21474

CRM-21474 add support for setting non-required fields to 'null'

When a field is not required in the database the 'null' should be pass through 
the pseudoconstant validation.

Note the unit test on this is failing because the BAO is not respecting setting 
null. Follow up patch

CRM-21474, CRM-21880 fix error in Contact schema causing test fail.

The pseudoConstant was against the wrong field

Change-Id: If0365cd1fa34e46004a67d19377882368d063574
---
M CRM/Contact/BAO/Contact.php
M CRM/Contact/BAO/Contact/Utils.php
M CRM/Contact/DAO/Contact.php
M CRM/Core/BAO/CustomQuery.php
M CRM/Core/BAO/CustomValueTable.php
M api/v3/Contact.php
M api/v3/utils.php
M templates/CRM/Contact/Page/View/CustomDataFieldView.tpl
8 files changed, 167 insertions(+), 40 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm/civicrm 
refs/changes/10/398210/1

diff --git a/CRM/Contact/BAO/Contact.php b/CRM/Contact/BAO/Contact.php
index 5689082..53730bd 100644
--- a/CRM/Contact/BAO/Contact.php
+++ b/CRM/Contact/BAO/Contact.php
@@ -151,16 +151,11 @@
   $params['source'] = $params['contact_source'];
 }
 
-// Fix for preferred communication method.
-$prefComm = CRM_Utils_Array::value('preferred_communication_method', 
$params, '');
-if ($prefComm && is_array($prefComm)) {
+if (isset($params['preferred_communication_method']) && 
is_array($params['preferred_communication_method'])) {
+  
CRM_Utils_Array::formatArrayKeys($params['preferred_communication_method']);
+  $contact->preferred_communication_method = 
CRM_Utils_Array::implodePadded($params['preferred_communication_method']);
   unset($params['preferred_communication_method']);
-
-  CRM_Utils_Array::formatArrayKeys($prefComm);
-  $prefComm = CRM_Utils_Array::implodePadded($prefComm);
 }
-
-$contact->preferred_communication_method = $prefComm;
 
 $allNull = $contact->copyValues($params);
 
@@ -183,6 +178,12 @@
 $allNull = FALSE;
 $contact->display_name = $contact->sort_name = 
CRM_Utils_Array::value('organization_name', $params, '');
   }
+}
+if (strlen($contact->display_name) > 128) {
+  $contact->display_name = substr($contact->display_name, 0, 128);
+}
+if (strlen($contact->sort_name) > 128) {
+  $contact->sort_name = substr($contact->sort_name, 0, 128);
 }
 
 $privacy = CRM_Utils_Array::value('privacy', $params);
@@ -286,7 +287,7 @@
   }
 }
 
-$config = CRM_Core_Config::singleton();
+self::ensureGreetingParamsAreSet($params);
 
 // CRM-6942: set preferred language to the current language if it’s unset 
(and we’re creating a contact).
 if (empty($params['contact_id'])) {
@@ -295,15 +296,10 @@
 $params['preferred_language'] = $language;
   }
 
-  // CRM-9739: set greeting & addressee if unset and we’re creating a 
contact.
-  foreach (self::$_greetingTypes as $greeting) {
-if (empty($params[$greeting . '_id'])) {
-  if ($defaultGreetingTypeId
-= 
CRM_Contact_BAO_Contact_Utils::defaultGreeting($params['contact_type'], 
$greeting)
-  ) {
-$params[$greeting . '_id'] = $defaultGreetingTypeId;
-  }
-}
+  // CRM-21041: set default 'Communication Style' if unset when creating a 
contact.
+  if (empty($params['communication_style_id'])) {
+$defaultCommunicationStyleId = 
CRM_Core_OptionGroup::values('communication_style', TRUE, NULL, NULL, 'AND 
is_default = 1');
+$params['communication_style_id'] = 
array_pop($defaultCommunicationStyleId);
   }
 }
 
@@ -448,6 +444,53 @@
   }
 
   /**
+   * Ensure greeting parameters are set.
+   *
+   * By always populating greetings here we can be sure they are set if 
required & avoid a call later.
+   * (ie. knowing we have definitely tried disambiguates between NULL & not 
loaded.)
+   *
+   * @param array $params
+   */
+  public static function ensureGreetingParamsAreSet(&$params) {
+$allGreetingParams = array('addressee' => 'addressee_id', 
'postal_greeting' => 'postal_greeting_id', 'email_greeting' => 

[MediaWiki-commits] [Gerrit] wikimedia...civicrm[master]: Greetings fixes (already upstreamed)

2017-12-13 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/398190 )

Change subject: Greetings fixes (already upstreamed)
..

Greetings fixes (already upstreamed)

https://github.com/civicrm/civicrm-core/pull/11313/commits

CRM-21471 remove unused core function CRM_Core_Pseudoconstant::greetingDefaults

Bug: T156193
Change-Id: I26e7800e2ad1850aeda9731b989f2deeffe87b59
---
M CRM/Contact/BAO/Contact.php
M CRM/Core/PseudoConstant.php
2 files changed, 11 insertions(+), 75 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm/civicrm 
refs/changes/90/398190/1

diff --git a/CRM/Contact/BAO/Contact.php b/CRM/Contact/BAO/Contact.php
index f9edbba..5689082 100644
--- a/CRM/Contact/BAO/Contact.php
+++ b/CRM/Contact/BAO/Contact.php
@@ -2687,15 +2687,8 @@
*
* @param object $contact
*   Contact object after save.
-   * @param bool $useDefaults
-   *   Use default greeting values.
*/
-  public static function processGreetings(&$contact, $useDefaults = FALSE) {
-if ($useDefaults) {
-  //retrieve default greetings
-  $defaultGreetings = CRM_Core_PseudoConstant::greetingDefaults();
-  $contactDefaults = $defaultGreetings[$contact->contact_type];
-}
+  public static function processGreetings(&$contact) {
 
 // note that contact object not always has required greeting related
 // fields that are required to calculate greeting and
@@ -2729,14 +2722,7 @@
   $updateQueryString[] = " email_greeting_custom = NULL ";
 }
 else {
-  if ($useDefaults) {
-reset($contactDefaults['email_greeting']);
-$emailGreetingID = key($contactDefaults['email_greeting']);
-$emailGreetingString = 
$contactDefaults['email_greeting'][$emailGreetingID];
-$updateQueryString[] = " email_greeting_id = $emailGreetingID ";
-$updateQueryString[] = " email_greeting_custom = NULL ";
-  }
-  elseif ($contact->email_greeting_custom) {
+  if ($contact->email_greeting_custom) {
 $updateQueryString[] = " email_greeting_display = NULL ";
   }
 }
@@ -2765,14 +2751,7 @@
   $updateQueryString[] = " postal_greeting_custom = NULL ";
 }
 else {
-  if ($useDefaults) {
-reset($contactDefaults['postal_greeting']);
-$postalGreetingID = key($contactDefaults['postal_greeting']);
-$postalGreetingString = 
$contactDefaults['postal_greeting'][$postalGreetingID];
-$updateQueryString[] = " postal_greeting_id = $postalGreetingID ";
-$updateQueryString[] = " postal_greeting_custom = NULL ";
-  }
-  elseif ($contact->postal_greeting_custom) {
+  if ($contact->postal_greeting_custom) {
 $updateQueryString[] = " postal_greeting_display = NULL ";
   }
 }
@@ -2802,14 +2781,7 @@
   $updateQueryString[] = " addressee_custom = NULL ";
 }
 else {
-  if ($useDefaults) {
-reset($contactDefaults['addressee']);
-$addresseeID = key($contactDefaults['addressee']);
-$addresseeString = $contactDefaults['addressee'][$addresseeID];
-$updateQueryString[] = " addressee_id = $addresseeID ";
-$updateQueryString[] = " addressee_custom = NULL ";
-  }
-  elseif ($contact->addressee_custom) {
+  if ($contact->addressee_custom) {
 $updateQueryString[] = " addressee_display = NULL ";
   }
 }
diff --git a/CRM/Core/PseudoConstant.php b/CRM/Core/PseudoConstant.php
index abf51f1..96fa655 100644
--- a/CRM/Core/PseudoConstant.php
+++ b/CRM/Core/PseudoConstant.php
@@ -156,12 +156,6 @@
   private static $greeting;
 
   /**
-   * Default Greetings
-   * @var array
-   */
-  private static $greetingDefaults;
-
-  /**
* Extensions of type module
* @var array
*/
@@ -1679,6 +1673,10 @@
*   array reference of all greetings.
*/
   public static function greeting($filter, $columnName = 'label') {
+if (!isset(Civi::$statics[__CLASS__]['greeting'])) {
+  Civi::$statics[__CLASS__]['greeting'] = array();
+}
+
 $index = $filter['greeting_type'] . '_' . $columnName;
 
 // also add contactType to the array
@@ -1687,11 +1685,7 @@
   $index .= '_' . $contactType;
 }
 
-if (NULL === self::$greeting) {
-  self::$greeting = array();
-}
-
-if (!CRM_Utils_Array::value($index, self::$greeting)) {
+if (!CRM_Utils_Array::value($index, 
Civi::$statics[__CLASS__]['greeting'])) {
   $filterCondition = NULL;
   if ($contactType) {
 $filterVal = 'v.filter =';
@@ -1711,40 +1705,10 @@
 $filterCondition .= "AND (v.filter = 0 OR {$filterVal}) ";
   }
 
-  self::$greeting[$index] = 
CRM_Core_OptionGroup::values($filter['greeting_type'], NULL, NULL, NULL, 
$filterCondition, $columnName);
+  Civi::$statics[__CLASS__]['greeting'][$index] = 
CRM_Core_OptionGroup::values($filter['greeting_type'], NULL, NULL, NULL, 
$filterCondition, $columnName);
 

[MediaWiki-commits] [Gerrit] wikimedia...civicrm[master]: Greetings fixes to support contact type change.

2017-12-13 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/398188 )

Change subject: Greetings fixes to support contact type change.
..

Greetings fixes to support contact type change.

2 commits from https://github.com/civicrm/civicrm-core/pull/11310

CRM-21466 - Fix (obscure) enotice when updating greeting for contact, add test
CRM-21466 follow up, add unit test to ensure custom fields can be populated.

This involves fixing the caching to be flushed during testing

Change-Id: Ic296f2b37a8ea169b93df314b95d2502d2e2b3f1
---
M CRM/Core/OptionGroup.php
M CRM/Core/PseudoConstant.php
M CRM/Utils/Token.php
M api/v3/Contact.php
4 files changed, 16 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm/civicrm 
refs/changes/88/398188/1

diff --git a/CRM/Core/OptionGroup.php b/CRM/Core/OptionGroup.php
index 89c8eb1..250c93c 100644
--- a/CRM/Core/OptionGroup.php
+++ b/CRM/Core/OptionGroup.php
@@ -676,6 +676,12 @@
 );
   }
 
+  /**
+   * Flush all the places where option values are cached.
+   *
+   * Note that this is called from CRM_Core_PseudoConstant::flush() so we 
should resist
+   * the intuitive urge to flush that class.
+   */
   public static function flushAll() {
 self::$_values = array();
 self::$_cache = array();
diff --git a/CRM/Core/PseudoConstant.php b/CRM/Core/PseudoConstant.php
index 75793c8..abf51f1 100644
--- a/CRM/Core/PseudoConstant.php
+++ b/CRM/Core/PseudoConstant.php
@@ -594,6 +594,9 @@
 }
 if ($name == 'cache') {
   CRM_Core_OptionGroup::flushAll();
+  if (isset(\Civi::$statics[__CLASS__])) {
+unset(\Civi::$statics[__CLASS__]);
+  }
 }
   }
 
diff --git a/CRM/Utils/Token.php b/CRM/Utils/Token.php
index 257a1b1..8e43fd2 100644
--- a/CRM/Utils/Token.php
+++ b/CRM/Utils/Token.php
@@ -657,17 +657,14 @@
 $returnBlankToken = FALSE,
 $escapeSmarty = FALSE
   ) {
+// Refresh contact tokens in case they have changed. There is heavy caching
+// in exportable fields so there is no benefit in doing this conditionally.
+self::$_tokens['contact'] = array_merge(
+  array_keys(CRM_Contact_BAO_Contact::exportableFields('All')),
+  array('checksum', 'contact_id')
+);
+
 $key = 'contact';
-if (self::$_tokens[$key] == NULL) {
-  // This should come from UF
-
-  self::$_tokens[$key]
-= array_merge(
-  array_keys(CRM_Contact_BAO_Contact::exportableFields('All')),
-  array('checksum', 'contact_id')
-);
-}
-
 // here we intersect with the list of pre-configured valid tokens
 // so that we remove anything we do not recognize
 // I hope to move this step out of here soon and
diff --git a/api/v3/Contact.php b/api/v3/Contact.php
index 2d1da21..b671106 100644
--- a/api/v3/Contact.php
+++ b/api/v3/Contact.php
@@ -623,7 +623,6 @@
 
 $nullValue = FALSE;
 $filter = array(
-  'contact_type' => $params['contact_type'],
   'greeting_type' => "{$key}{$greeting}",
 );
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic296f2b37a8ea169b93df314b95d2502d2e2b3f1
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm/civicrm
Gerrit-Branch: master
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Add extension to change contact types

2017-12-13 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/398176 )

Change subject: Add extension to change contact types
..

Add extension to change contact types

Bug: T156193
Change-Id: I7c34be4225c04ac112d74891035607144178fd5f
---
M phpunit.xml
M sites/all/modules/wmf_civicrm/wmf_civicrm.install
A 
sites/default/civicrm/extensions/org.wikimedia.contacteditor/ActivityTypeContactChange.mgd.php
A 
sites/default/civicrm/extensions/org.wikimedia.contacteditor/CRM/Contacteditor/ChangeContactType.php
A 
sites/default/civicrm/extensions/org.wikimedia.contacteditor/CRM/Contacteditor/Form/ContactTypeChange.php
A sites/default/civicrm/extensions/org.wikimedia.contacteditor/LICENSE.txt
A sites/default/civicrm/extensions/org.wikimedia.contacteditor/README.md
A 
sites/default/civicrm/extensions/org.wikimedia.contacteditor/contacteditor.civix.php
A sites/default/civicrm/extensions/org.wikimedia.contacteditor/contacteditor.php
A sites/default/civicrm/extensions/org.wikimedia.contacteditor/info.xml
A sites/default/civicrm/extensions/org.wikimedia.contacteditor/phpunit.xml.dist
A 
sites/default/civicrm/extensions/org.wikimedia.contacteditor/templates/CRM/Contacteditor/Form/ContactTypeChange.tpl
A 
sites/default/civicrm/extensions/org.wikimedia.contacteditor/tests/phpunit/BaseUnitTestClass.php
A 
sites/default/civicrm/extensions/org.wikimedia.contacteditor/tests/phpunit/ContactEditorTest.php
A 
sites/default/civicrm/extensions/org.wikimedia.contacteditor/tests/phpunit/bootstrap.php
A 
sites/default/civicrm/extensions/org.wikimedia.contacteditor/xml/Menu/contacteditor.xml
16 files changed, 2,144 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/76/398176/1

diff --git a/phpunit.xml b/phpunit.xml
index 5507958..5731077 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -49,5 +49,8 @@
   
 
sites/default/civicrm/extensions/org.wikimedia.omnimail/tests/phpunit
   
+  
+
sites/default/civicrm/extensions/org.wikimedia.contacteditor/tests/phpunit
+  
 
 
diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.install 
b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
index 543b696..581a38d 100644
--- a/sites/all/modules/wmf_civicrm/wmf_civicrm.install
+++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
@@ -69,6 +69,7 @@
   wmf_civicrm_update_7526();
   wmf_civicrm_update_7530();
   wmf_civicrm_update_7590();
+  wmf_civicrm_update_7595();
 }
 
 /**
@@ -3438,3 +3439,14 @@
   civicrm_initialize();
   wmf_civicrm_create_option_values('payment_instrument', array('Stripe'));
 }
+
+/**
+ * Add contact type editor extension.
+ *
+ * Bug: TT156193
+ */
+function wmf_civicrm_update_7595() {
+  civicrm_initialize();
+  civicrm_api3('extension', 'refresh', array());
+  civicrm_api3('extension', 'install', array('key' => 
'org.wikimedia.contacteditor'));
+}
diff --git 
a/sites/default/civicrm/extensions/org.wikimedia.contacteditor/ActivityTypeContactChange.mgd.php
 
b/sites/default/civicrm/extensions/org.wikimedia.contacteditor/ActivityTypeContactChange.mgd.php
new file mode 100644
index 000..5914128
--- /dev/null
+++ 
b/sites/default/civicrm/extensions/org.wikimedia.contacteditor/ActivityTypeContactChange.mgd.php
@@ -0,0 +1,14 @@
+ array(
+'name' => 'Contact Type Changed',
+'entity' => 'OptionValue',
+'params' => array(
+  'version' => 3,
+  'option_group_id' => 'activity_type',
+  'label' => 'Contact Type Changed',
+  'name' => 'contact_type_changed',
+  'description' => 'Contact type changed',
+),
+  ),
+);
\ No newline at end of file
diff --git 
a/sites/default/civicrm/extensions/org.wikimedia.contacteditor/CRM/Contacteditor/ChangeContactType.php
 
b/sites/default/civicrm/extensions/org.wikimedia.contacteditor/CRM/Contacteditor/ChangeContactType.php
new file mode 100644
index 000..0f68625
--- /dev/null
+++ 
b/sites/default/civicrm/extensions/org.wikimedia.contacteditor/CRM/Contacteditor/ChangeContactType.php
@@ -0,0 +1,303 @@
+getApiRequest();
+if ($request['entity'] !== 'Contact' || $request['action']  !== 'create') {
+  return;
+}
+if (empty($request['params']['id']) || 
empty($request['params']['contact_type'])) {
+  // Hook is only interested in changes that update contact type.
+  return;
+}
+$contactID = $request['params']['id'];
+$newContactType = $request['params']['contact_type'];
+// Usually we will return after getting this - if we proceed past here we 
do more extensive data gathering as it is 'the real deal'.
+$existingContactType = civicrm_api3('Contact', 'getvalue', ['id' => 
$contactID, 'return' => 'contact_type']);
+if ($existingContactType ===  $newContactType) {
+  return;
+}
+if (!CRM_Core_Permission::check(array('Change CiviCRM contact type'))) {
+  throw new CRM_Core_Exception('You do have not permission to change the 
co

[MediaWiki-commits] [Gerrit] wikimedia...crm[deployment]: Allow Organization merge to resolve casing on organization_name

2017-12-06 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/395882 )

Change subject: Allow Organization merge to resolve casing on organization_name
..

Allow Organization merge to resolve casing on organization_name

Bug: T18108
Change-Id: I31f9cd0cb539f7e9dcbd2f1921906a9d7ca6d5a5
---
M sites/all/modules/wmf_civicrm/wmf_civicrm.module
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/82/395882/1

diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.module 
b/sites/all/modules/wmf_civicrm/wmf_civicrm.module
index 6e07755..746c901 100644
--- a/sites/all/modules/wmf_civicrm/wmf_civicrm.module
+++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.module
@@ -2546,7 +2546,7 @@
  * @return bool
  */
 function _wmf_civicrm_merge_resolve_casing_conflict($fieldName, 
&$moveFieldValue, &$valueToKeep, &$valueToOverwrite) {
-  $fieldsToResolveCasingFor = array('last_name', 'first_name');
+  $fieldsToResolveCasingFor = array('last_name', 'first_name', 
'organization_name');
   if (!in_array(str_replace('move_', '', $fieldName), 
$fieldsToResolveCasingFor)) {
 return FALSE;
   }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I31f9cd0cb539f7e9dcbd2f1921906a9d7ca6d5a5
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: deployment
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Allow Organization merge to resolve casing on organization_name

2017-12-06 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/395858 )

Change subject: Allow Organization merge to resolve casing on organization_name
..

Allow Organization merge to resolve casing on organization_name

Bug: T18108
Change-Id: I31f9cd0cb539f7e9dcbd2f1921906a9d7ca6d5a5
---
M sites/all/modules/wmf_civicrm/tests/phpunit/MergeTest.php
M sites/all/modules/wmf_civicrm/wmf_civicrm.module
2 files changed, 26 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/58/395858/1

diff --git a/sites/all/modules/wmf_civicrm/tests/phpunit/MergeTest.php 
b/sites/all/modules/wmf_civicrm/tests/phpunit/MergeTest.php
index e5eb6cb..7a0051c 100644
--- a/sites/all/modules/wmf_civicrm/tests/phpunit/MergeTest.php
+++ b/sites/all/modules/wmf_civicrm/tests/phpunit/MergeTest.php
@@ -915,6 +915,31 @@
   }
 
   /**
+   * Test that a conflict on casing in first names is handled for 
organization_name.
+   */
+  public function testBatchMergeConflictNameCasingOrgs() {
+$rule_group_id = civicrm_api3('RuleGroup', 'getvalue', array(
+  'contact_type' => 'Organization',
+  'used' => 'Unsupervised',
+  'return' => 'id',
+  'options' => array('limit' => 1),
+));
+
+// Do a pre-merge to get us to a known 'no mergeable contacts' state.
+$this->callAPISuccess('Job', 'process_batch_merge', array('mode' => 
'safe', 'rule_group_id' => $rule_group_id));
+
+$org1 = $this->callAPISuccess('Contact', 'create', 
array('organization_name' => 'donald duck', 'contact_type' => 'Organization'));
+$org2 = $this->callAPISuccess('Contact', 'create', 
array('organization_name' => 'Donald Duck', 'contact_type' => 'Organization'));
+
+$result = $this->callAPISuccess('Job', 'process_batch_merge', array('mode' 
=> 'safe', 'rule_group_id' => $rule_group_id));
+$this->assertEquals(0, count($result['values']['skipped']));
+$this->assertEquals(1, count($result['values']['merged']));
+
+$contact = $this->callAPISuccess('Contact', 'get', array('id' => 
$org1['id'], 'sequential' => 1));
+$this->assertEquals('Donald Duck', 
$contact['values'][0]['organization_name']);
+  }
+
+  /**
* Make sure José whomps Jose.
*
* Test diacritic matches are resolved to the one using 'authentic' 
characters.
diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.module 
b/sites/all/modules/wmf_civicrm/wmf_civicrm.module
index d1c525d..1ad487d 100644
--- a/sites/all/modules/wmf_civicrm/wmf_civicrm.module
+++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.module
@@ -2543,7 +2543,7 @@
  * @return bool
  */
 function _wmf_civicrm_merge_resolve_casing_conflict($fieldName, 
&$moveFieldValue, &$valueToKeep, &$valueToOverwrite) {
-  $fieldsToResolveCasingFor = array('last_name', 'first_name');
+  $fieldsToResolveCasingFor = array('last_name', 'first_name', 
'organization_name');
   if (!in_array(str_replace('move_', '', $fieldName), 
$fieldsToResolveCasingFor)) {
 return FALSE;
   }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I31f9cd0cb539f7e9dcbd2f1921906a9d7ca6d5a5
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[deployment]: Allow Major gift contacts with conflicting addresses to merge.

2017-12-05 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/395661 )

Change subject: Allow Major gift contacts with conflicting addresses to merge.
..

Allow Major gift contacts with conflicting addresses to merge.

By removing the conflict we allow all the prioritisation rules developed for 
other
contacts to apply

Unit tests updated to reflect the fact that merge now takes place and the most 
recent
donor's details are now used. Comfortingly all the 'resolvable' conflict tests 
are
unchanged, still selecting the preferable addresses. The 'unresolvable' conflict
tests have been updated to reflect use of most recent donor detail. (a couple
of test names had to be updated to be accurate about that distinction

Bug: T181088
Change-Id: Ie78e3a517b796967976936b4fc93d2352a7aa14e
---
M sites/all/modules/wmf_civicrm/wmf_civicrm.module
1 file changed, 9 insertions(+), 22 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/61/395661/1

diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.module 
b/sites/all/modules/wmf_civicrm/wmf_civicrm.module
index 0f1961e..6e07755 100644
--- a/sites/all/modules/wmf_civicrm/wmf_civicrm.module
+++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.module
@@ -2487,29 +2487,16 @@
   $refs['is_major_gift'] = 
_wmf_civicrm_is_merged_contact_major_donor($mainId, $otherId);
 }
 $fieldParts = explode('_', $moveField);
-if (!$refs['is_major_gift']) {
-  if ($fieldParts[2] == 'email') {
-$mainIsOnHold = 
$refs['migration_info']['main_details']['location_blocks']['email'][$fieldParts[3]]['on_hold'];
-$otherIsOnHold = 
$refs['migration_info']['other_details']['location_blocks']['email'][$fieldParts[3]]['on_hold'];
-if ($mainIsOnHold + $otherIsOnHold === 1) {
-  // One is one hold & the other isn't - conflict.
-  return;
-}
-  }
-  unset($refs['fields_in_conflict'][$moveField]);
-}
-else {
-  if (_wmf_civicrm_merge_is_address_conflict_resolvable(
-$refs['migration_info']['rows'][$moveField]['other'],
-$refs['migration_info']['rows'][$moveField]['main'],
-
$refs['migration_info']['other_details']['location_blocks'][$fieldParts[2]][$fieldParts[3]],
-
$refs['migration_info']['main_details']['location_blocks'][$fieldParts[2]][$fieldParts[3]]
-)) {
-  // Actual resolution is in alterLocationMergeData hook.
-  unset($refs['fields_in_conflict'][$moveField]);
-  }
-}
 
+if ($fieldParts[2] == 'email') {
+  $mainIsOnHold = 
$refs['migration_info']['main_details']['location_blocks']['email'][$fieldParts[3]]['on_hold'];
+  $otherIsOnHold = 
$refs['migration_info']['other_details']['location_blocks']['email'][$fieldParts[3]]['on_hold'];
+  if ($mainIsOnHold + $otherIsOnHold === 1) {
+// One is one hold & the other isn't - conflict.
+return;
+  }
+}
+unset($refs['fields_in_conflict'][$moveField]);
   }
 }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie78e3a517b796967976936b4fc93d2352a7aa14e
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: deployment
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Add stripe to initial install

2017-12-05 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/395649 )

Change subject: Add stripe to initial install
..

Add stripe to initial install

Bug T172423

Change-Id: If50f42af300518b8c180652f46d4608d824b96e7
---
M sites/all/modules/wmf_civicrm/wmf_civicrm.install
1 file changed, 1 insertion(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/49/395649/1

diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.install 
b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
index f739ff9..543b696 100644
--- a/sites/all/modules/wmf_civicrm/wmf_civicrm.install
+++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
@@ -68,6 +68,7 @@
   wmf_civicrm_update_7525();
   wmf_civicrm_update_7526();
   wmf_civicrm_update_7530();
+  wmf_civicrm_update_7590();
 }
 
 /**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If50f42af300518b8c180652f46d4608d824b96e7
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Remove major-gifts specific dedupe code.

2017-12-05 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/395645 )

Change subject: Remove major-gifts specific dedupe code.
..

Remove major-gifts specific dedupe code.

I struggled to make myself do this as I seem to believe it will be back in some 
form
However, trying to convince myself to 'trust in git'. Have put as a separate 
patch
for easier retrieval...

Bug: T181088
Change-Id: Id89df916d7e1e865547eb285d6a78c9fe44e95be
---
M sites/all/modules/wmf_civicrm/wmf_civicrm.module
1 file changed, 0 insertions(+), 25 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/45/395645/1

diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.module 
b/sites/all/modules/wmf_civicrm/wmf_civicrm.module
index 6e07755..d1c525d 100644
--- a/sites/all/modules/wmf_civicrm/wmf_civicrm.module
+++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.module
@@ -2483,9 +2483,6 @@
   }
 
   if (substr($moveField, 0, 13) === 'move_location') {
-if (!isset($refs['is_major_gift'])) {
-  $refs['is_major_gift'] = 
_wmf_civicrm_is_merged_contact_major_donor($mainId, $otherId);
-}
 $fieldParts = explode('_', $moveField);
 
 if ($fieldParts[2] == 'email') {
@@ -2958,28 +2955,6 @@
  */
 function _wmf_civicrm_count_capital_letters($string) {
   return strlen(preg_replace('/[^A-Z]+/', '', $string));
-}
-
-/**
- * Has the combined contact given $500 or more?
- *
- * @param int $mainId
- * @param int $otherId
- *
- * @return bool
- *
- * @throws \CiviCRM_API3_Exception
- */
-function _wmf_civicrm_is_merged_contact_major_donor($mainId, $otherId) {
-  $total = 0;
-  $donations = civicrm_api3('Contribution', 'get', array(
-'return' => 'total_amount',
-'contact_id' => array('IN' => array($mainId, $otherId)),
-  ));
-  foreach ($donations['values'] as $donation) {
-$total += $donation['total_amount'];
-  }
-  return ($total >= 500) ? TRUE : FALSE;
 }
 
 /**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id89df916d7e1e865547eb285d6a78c9fe44e95be
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Add stripe payment instrument.

2017-12-05 Thread Eileen (Code Review)
Eileen has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/395142 )

Change subject: Add stripe payment instrument.
..


Add stripe payment instrument.

Bug: T172423
Change-Id: Ic648ad8bb4e3b13c8cb33c62221c1358bb128a14
---
M sites/all/modules/wmf_civicrm/wmf_civicrm.install
1 file changed, 8 insertions(+), 0 deletions(-)

Approvals:
  Mepps: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.install 
b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
index 3e1509d..f739ff9 100644
--- a/sites/all/modules/wmf_civicrm/wmf_civicrm.install
+++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
@@ -3429,3 +3429,11 @@
 )),
   ));
 }
+
+/**
+ * Add Stripe payment instrument
+ */
+function wmf_civicrm_update_7590() {
+  civicrm_initialize();
+  wmf_civicrm_create_option_values('payment_instrument', array('Stripe'));
+}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic648ad8bb4e3b13c8cb33c62221c1358bb128a14
Gerrit-PatchSet: 2
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Eileen 
Gerrit-Reviewer: Eileen 
Gerrit-Reviewer: Ejegg 
Gerrit-Reviewer: Mepps 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: verbosity on test

2017-12-04 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/395172 )

Change subject: verbosity on test
..

verbosity on test

Change-Id: I3c711c74a9ac675f84c18292a98c3b05a7963cb9
---
M sites/all/modules/offline2civicrm/offline2civicrm.common.inc
M sites/all/modules/wmf_common/WmfDatabase.php
2 files changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/72/395172/1

diff --git a/sites/all/modules/offline2civicrm/offline2civicrm.common.inc 
b/sites/all/modules/offline2civicrm/offline2civicrm.common.inc
index 284dce5..b003e1f 100644
--- a/sites/all/modules/offline2civicrm/offline2civicrm.common.inc
+++ b/sites/all/modules/offline2civicrm/offline2civicrm.common.inc
@@ -27,7 +27,7 @@
 $used[$upper] = true;
   }
   if ( $duplicates ) {
-throw new WmfException( 'INVALID_FILE_FORMAT', 'Duplicate column headers: 
' . implode( ", ", $duplicates ) );
+throw new WmfException( 'INVALID_FILE_FORMAT', 'Duplicate column headers: 
' . implode( ", ", $duplicates )  . print_r($row, 1));
   }
   watchdog( 'offline2civicrm', 'Import checks: Column headers loaded from 
file', array(), WATCHDOG_INFO );
 
diff --git a/sites/all/modules/wmf_common/WmfDatabase.php 
b/sites/all/modules/wmf_common/WmfDatabase.php
index d52dddf..01bb205 100644
--- a/sites/all/modules/wmf_common/WmfDatabase.php
+++ b/sites/all/modules/wmf_common/WmfDatabase.php
@@ -16,7 +16,7 @@
* @throws \Exception
*/
 static function transactionalCall( $callback, $params ) {
-watchdog( 'wmf_common', "Beginning DB transaction", NULL, 
WATCHDOG_INFO );
+watchdog( 'wmf_common', "Beginning DB transaction", debug_backtrace(), 
WATCHDOG_INFO );
 $drupal_transaction = db_transaction( 'wmf_default', array( 'target' 
=> 'default' ) );
 $crm_transaction = db_transaction( 'wmf_civicrm', array( 'target' => 
'civicrm' ) );
 $native_civi_transaction = new CRM_Core_Transaction();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3c711c74a9ac675f84c18292a98c3b05a7963cb9
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Add stripe payment instrument.

2017-12-04 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/395142 )

Change subject: Add stripe payment instrument.
..

Add stripe payment instrument.

Bug: T172423
Change-Id: Ic648ad8bb4e3b13c8cb33c62221c1358bb128a14
---
M sites/all/modules/wmf_civicrm/wmf_civicrm.install
1 file changed, 8 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/42/395142/1

diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.install 
b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
index 3e1509d..f739ff9 100644
--- a/sites/all/modules/wmf_civicrm/wmf_civicrm.install
+++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
@@ -3429,3 +3429,11 @@
 )),
   ));
 }
+
+/**
+ * Add Stripe payment instrument
+ */
+function wmf_civicrm_update_7590() {
+  civicrm_initialize();
+  wmf_civicrm_create_option_values('payment_instrument', array('Stripe'));
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic648ad8bb4e3b13c8cb33c62221c1358bb128a14
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Allow Major gift contacts with conflicting addresses to merge.

2017-11-29 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/394239 )

Change subject: Allow Major gift contacts with conflicting addresses to merge.
..

Allow Major gift contacts with conflicting addresses to merge.

By removing the conflict we allow all the prioritisation rules developed for 
other
contacts to apply

Unit tests updated to reflect the fact that merge now takes place and the most 
recent
donor's details are now used. Comfortingly all the 'resolvable' conflict tests 
are
unchanged, still selecting the preferable addresses. The 'unresolvable' conflict
tests have been updated to reflect use of most recent donor detail. (a couple
of test names had to be updated to be accurate about that distinction

Bug: T181088
Change-Id: Ie78e3a517b796967976936b4fc93d2352a7aa14e
---
M sites/all/modules/wmf_civicrm/tests/phpunit/MergeTest.php
M sites/all/modules/wmf_civicrm/wmf_civicrm.module
2 files changed, 88 insertions(+), 77 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/39/394239/1

diff --git a/sites/all/modules/wmf_civicrm/tests/phpunit/MergeTest.php 
b/sites/all/modules/wmf_civicrm/tests/phpunit/MergeTest.php
index 44fde89..e5eb6cb 100644
--- a/sites/all/modules/wmf_civicrm/tests/phpunit/MergeTest.php
+++ b/sites/all/modules/wmf_civicrm/tests/phpunit/MergeTest.php
@@ -221,10 +221,10 @@
 if ($dataSet['is_major_gifts']) {
   $this->contributionCreate(array('contact_id' => $this->contactID2, 
'receive_date' => '2012-01-01', 'total_amount' => 300));
 }
-foreach ($dataSet['contact_1'] as $address) {
+foreach ($dataSet['earliest_donor'] as $address) {
   $this->callAPISuccess($dataSet['entity'], 'create', 
array_merge(array('contact_id' => $this->contactID), $address));
 }
-foreach ($dataSet['contact_2'] as $address) {
+foreach ($dataSet['most_recent_donor'] as $address) {
   $this->callAPISuccess($dataSet['entity'], 'create', 
array_merge(array('contact_id' => $this->contactID2), $address));
 }
 
@@ -265,10 +265,10 @@
 if ($dataSet['is_major_gifts']) {
   $this->contributionCreate(array('contact_id' => $this->contactID, 
'receive_date' => '2012-01-01', 'total_amount' => 300));
 }
-foreach ($dataSet['contact_1'] as $address) {
+foreach ($dataSet['earliest_donor'] as $address) {
   $this->callAPISuccess($dataSet['entity'], 'create', 
array_merge(array('contact_id' => $this->contactID2), $address));
 }
-foreach ($dataSet['contact_2'] as $address) {
+foreach ($dataSet['most_recent_donor'] as $address) {
   $this->callAPISuccess($dataSet['entity'], 'create', 
array_merge(array('contact_id' => $this->contactID), $address));
 }
 
@@ -704,9 +704,12 @@
   /**
* Test that we don't see a city named after a country as the same as a 
country.
*
+   * UPDATE - this is now merged, keeping most recent donor - ie. 1 since
+   * that is the only one with a donation.
+   *
* Bug T176699
*/
-  public function 
testBatchMergeResolvableConflictCityLooksCountryishWithCounty() {
+  public function 
testBatchMergeUnResolvableConflictCityLooksCountryishWithCounty() {
 $this->callAPISuccess('Address', 'create', array(
   'country_id' => 'US',
   'contact_id' => $this->contactID2,
@@ -722,17 +725,26 @@
 $this->contributionCreate(array('contact_id' => $this->contactID, 
'receive_date' => '2010-01-01', 'total_amount' => 500));
 
 $result = $this->callAPISuccess('Job', 'process_batch_merge', array('mode' 
=> 'safe'));
-$this->assertEquals(1, count($result['values']['skipped']));
-$this->assertEquals(0, count($result['values']['merged']));
+$this->assertEquals(0, count($result['values']['skipped']));
+$this->assertEquals(1, count($result['values']['merged']));
+
+$address = $this->callAPISuccessGetSingle('Address', array('contact_id' => 
$this->contactID));
+$this->assertEquals('First on the left after you cross the border', 
$address['street_address']);
+$this->assertEquals('MX', 
CRM_Core_PseudoConstant::countryIsoCode($address['country_id']));
+$this->assertTrue(!isset($address['city']));
+
   }
 
   /**
* Test that we don't see a city named after a country as the same as a 
country
* when it has no country.
*
+   * UPDATE - this is now merged, keeping most recent donor - ie. 1 since
+   * that is the only one with a donation.
+   *
* Bug T176699
*/
-  public function 
testBatchMergeResolvableConflictCityLooksCountryishNoCountry() {
+  public function 
testBatchMergeUnResolvableConflictCityLooksCountryishNoCountry() {
 $this->callAPISuccess('Address', 'create', array(
   'contact_id' => $this->contactID2,
   'city' => 'Mexico',
@@ -747,8 +759,13 @@
 $this->contributionCreate(array('contact_id' => $this->contactID, 
'receive_date' => '2010-01-01', 'total_amount' => 500));
 
 $result = $this->callAPISuccess(

[MediaWiki-commits] [Gerrit] wikimedia...crm[deployment]: Apply drupal formatting to file prior to editing

2017-11-29 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/394219 )

Change subject: Apply drupal formatting to file prior to editing
..

Apply drupal formatting to file prior to editing

Change-Id: I1d22b440bf5e4dc4b66fc2cd7ef91a9c38905c6c
---
M sites/all/modules/offline2civicrm/ChecksFile.php
1 file changed, 499 insertions(+), 468 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/19/394219/1

diff --git a/sites/all/modules/offline2civicrm/ChecksFile.php 
b/sites/all/modules/offline2civicrm/ChecksFile.php
index 618d960..74fa25c 100644
--- a/sites/all/modules/offline2civicrm/ChecksFile.php
+++ b/sites/all/modules/offline2civicrm/ChecksFile.php
@@ -5,52 +5,60 @@
 /**
  * CSV batch format for manually-keyed donation checks
  *
- * FIXME: This currently includes stuff specific to Wikimedia Foundation 
fundraising.
+ * FIXME: This currently includes stuff specific to Wikimedia Foundation
+ * fundraising.
  */
 abstract class ChecksFile {
-protected $numSkippedRows = 0;
-protected $messages = array();
-protected $file_uri = '';
-protected $error_file_uri = '';
-protected $skipped_file_uri = '';
-protected $ignored_file_uri = '';
-protected $all_missed_file_uri = '';
 
-/**
- * @var resource
- */
-protected $ignoredFileResource = NULL;
+  protected $numSkippedRows = 0;
 
-/**
- * @var resource
- */
-protected $skippedFileResource = NULL;
+  protected $messages = array();
 
-/**
- * @var resource
- */
-protected $errorFileResource = NULL;
+  protected $file_uri = '';
 
-/**
- * @var resource
- */
-protected $allMissedFileResource = NULL;
+  protected $error_file_uri = '';
 
-/**
- * @param string $file_uri path to the file
- */
-function __construct( $file_uri ) {
-$this->file_uri = $file_uri;
-global $user;
-$suffix = $user->uid . '.csv';
-$this->error_file_uri = str_replace('.csv', '_errors.' . $suffix, 
$file_uri);
-$this->skipped_file_uri = str_replace('.csv', '_skipped.' . $suffix, 
$file_uri);
-$this->ignored_file_uri = str_replace('.csv', '_ignored.' . $suffix, 
$file_uri);
-$this->all_missed_file_uri = str_replace('.csv', '_all_missed.' . 
$suffix, $file_uri);
-wmf_common_set_smashpig_message_source(
-'direct', 'Offline importer: ' . get_class( $this )
-);
-}
+  protected $skipped_file_uri = '';
+
+  protected $ignored_file_uri = '';
+
+  protected $all_missed_file_uri = '';
+
+  /**
+   * @var resource
+   */
+  protected $ignoredFileResource = NULL;
+
+  /**
+   * @var resource
+   */
+  protected $skippedFileResource = NULL;
+
+  /**
+   * @var resource
+   */
+  protected $errorFileResource = NULL;
+
+  /**
+   * @var resource
+   */
+  protected $allMissedFileResource = NULL;
+
+  /**
+   * @param string $file_uri path to the file
+   */
+  function __construct($file_uri) {
+$this->file_uri = $file_uri;
+global $user;
+$suffix = $user->uid . '.csv';
+$this->error_file_uri = str_replace('.csv', '_errors.' . $suffix, 
$file_uri);
+$this->skipped_file_uri = str_replace('.csv', '_skipped.' . $suffix, 
$file_uri);
+$this->ignored_file_uri = str_replace('.csv', '_ignored.' . $suffix, 
$file_uri);
+$this->all_missed_file_uri = str_replace('.csv', '_all_missed.' . $suffix, 
$file_uri);
+wmf_common_set_smashpig_message_source(
+  'direct', 'Offline importer: ' . get_class($this)
+);
+  }
 
   /**
* Getter for messages array.
@@ -69,456 +77,470 @@
*
* @throws \Exception
*/
-function import() {
-ChecksImportLog::record( "Beginning import of checks file 
{$this->file_uri}..." );
-//TODO: $db->begin();
+  function import() {
+ChecksImportLog::record("Beginning import of checks file 
{$this->file_uri}...");
+//TODO: $db->begin();
 
-ini_set( 'auto_detect_line_endings', true );
-if( ( $file = fopen( $this->file_uri, 'r' )) === FALSE ){
-throw new WmfException( 'FILE_NOT_FOUND', 'Import checks: Could 
not open file for reading: ' . $this->file_uri );
-}
+ini_set('auto_detect_line_endings', TRUE);
+if (($file = fopen($this->file_uri, 'r')) === FALSE) {
+  throw new WmfException('FILE_NOT_FOUND', 'Import checks: Could not open 
file for reading: ' . $this->file_uri);
+}
 
-if ( $this->numSkippedRows ) {
-foreach ( range( 1, $this->numSkippedRows ) as $i ) {
-fgets( $file );
-}
-}
-
-$headers = _load_headers( fgetcsv( $file, 0, ',', '"', '\\') );
-
-$this->validateColumns( $headers );
-
-$num_errors = 0;
-$num_ignored = 0;
-$num_successful = 0;
-$num_duplicates = 0;
-$this->row_index = -1 + $this->numSkippedRows;
-$error_streak_start = 0;
- 

[MediaWiki-commits] [Gerrit] wikimedia...crm[deployment]: Fix checks for existing contributions on Benevity imports to...

2017-11-29 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/394221 )

Change subject: Fix checks for existing contributions on Benevity imports to 
check donor AND matching contributions.
..

Fix checks for existing contributions on Benevity imports to check donor AND 
matching contributions.

Currently donor contributions that have already been imported are marked as 
duplicates but where the matching
contribution has been imported that is not picked up as a duplicate and results 
in an error.

The impact on users is that a string of errors will result in the import 
aborting. On the other hand, a string
of duplicates will be ignored, allowing a mostly imported csv to be 
re-attempted.

Bug: T181548
Change-Id: Iff464153e40c9f751c63e21b0236d552f1e1ceb9
---
M sites/all/modules/offline2civicrm/BenevityFile.php
M sites/all/modules/offline2civicrm/ChecksFile.php
2 files changed, 54 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/21/394221/1

diff --git a/sites/all/modules/offline2civicrm/BenevityFile.php 
b/sites/all/modules/offline2civicrm/BenevityFile.php
index 9c65520..683c8c7 100644
--- a/sites/all/modules/offline2civicrm/BenevityFile.php
+++ b/sites/all/modules/offline2civicrm/BenevityFile.php
@@ -411,4 +411,45 @@
 return FALSE;
   }
 
+  /**
+   * Check for any existing contributions for the given transaction.
+   *
+   * If either the donor transaction of the matching gift transaction have 
already
+   * been imported return (1) imported transaction.
+   *
+   * If both the matching and donor transactions have been imported previously 
it
+   * is OK to return only one
+   *
+   * If it appears there has been a previous partial import
+   *
+   * @param $msg
+   *
+   * @return array|bool
+   *
+   * @throws \WmfException
+   */
+  protected function checkForExistingContributions($msg) {
+$donorTransactionNeedsProcessing = (!empty($msg['gross']) && $msg['gross'] 
!== "0.00");
+$matchingTransactionNeedsProcessing = (!empty($msg['matching_amount']) && 
$msg['matching_amount'] !== "0.00");
+
+$main = $matched = FALSE;
+if ($donorTransactionNeedsProcessing) {
+  $main = wmf_civicrm_get_contributions_from_gateway_id($msg['gateway'], 
$msg['gateway_txn_id']);
+}
+
+if ($matchingTransactionNeedsProcessing) {
+  $matched = 
wmf_civicrm_get_contributions_from_gateway_id($msg['gateway'], 
$msg['gateway_txn_id'] . '_matched');
+}
+
+if ($matchingTransactionNeedsProcessing && 
$donorTransactionNeedsProcessing) {
+  // Both transactions need processing. If one finds a match and the other 
doesn't we have a potential error scenario
+  // and should throw an exception.
+  $duplicates = ($main ? 1 : 0) + ($matched ? 1 : 0);
+  if ($duplicates === 1) {
+throw new WmfException('INVALID_MESSAGE', 'row has already been 
partially imported');
+  }
+}
+return $main ? $main : $matched;
+  }
+
 }
diff --git a/sites/all/modules/offline2civicrm/ChecksFile.php 
b/sites/all/modules/offline2civicrm/ChecksFile.php
index 4d6601a..f5f0ae0 100644
--- a/sites/all/modules/offline2civicrm/ChecksFile.php
+++ b/sites/all/modules/offline2civicrm/ChecksFile.php
@@ -131,9 +131,10 @@
   throw new IgnoredRowException('IMPORT_CONTRIB', 'Error limit 
reached');
 }
 $msg = $this->parseRow($data);
+$existing = $this->checkForExistingContributions($msg);
 
 // check to see if we have already processed this check
-if ($existing = 
wmf_civicrm_get_contributions_from_gateway_id($msg['gateway'], 
$msg['gateway_txn_id'])) {
+if ($existing) {
   $skipped = $this->handleDuplicate($existing);
   if ($skipped) {
 if ($num_duplicates === 0) {
@@ -662,4 +663,15 @@
 }
   }
 
+  /**
+   * Check for any existing contributions for the given transaction.
+   *
+   * @param $msg
+   *
+   * @return array|bool
+   */
+  protected function checkForExistingContributions($msg) {
+return  wmf_civicrm_get_contributions_from_gateway_id($msg['gateway'], 
$msg['gateway_txn_id']);
+  }
+
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iff464153e40c9f751c63e21b0236d552f1e1ceb9
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: deployment
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[deployment]: Comment block tidy ups

2017-11-29 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/394220 )

Change subject: Comment block tidy ups
..

Comment block tidy ups

Change-Id: I74cee89622b2dd7588534de5791dd1110538277a
---
M sites/all/modules/offline2civicrm/ChecksFile.php
1 file changed, 13 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/20/394220/1

diff --git a/sites/all/modules/offline2civicrm/ChecksFile.php 
b/sites/all/modules/offline2civicrm/ChecksFile.php
index 74fa25c..4d6601a 100644
--- a/sites/all/modules/offline2civicrm/ChecksFile.php
+++ b/sites/all/modules/offline2civicrm/ChecksFile.php
@@ -24,6 +24,8 @@
 
   protected $all_missed_file_uri = '';
 
+  protected $row_index;
+
   /**
* @var resource
*/
@@ -221,9 +223,11 @@
   /**
* Read a row and transform into normalized queue message form
*
-   * @param array $row native format for this upload file, usually a dict
+   * @param $data
*
* @return array queue message format
+   *
+   * @throws \EmptyRowException
*/
   protected function parseRow($data) {
 $msg = array();
@@ -264,6 +268,10 @@
   /**
* Do any final transformation on a normalized and default-laden queue
* message.  Overrides are specific to each upload source.
+   *
+   * @param array $msg
+   *
+   * @throws \WmfException
*/
   protected function mungeMessage(&$msg) {
 if (isset($msg['raw_contribution_type'])) {
@@ -562,6 +570,7 @@
*
* @param int $totalRows
* @param int $num_successful
+   * @param int $num_errors
* @param int $num_ignored
* @param int $num_duplicates
*/
@@ -608,8 +617,9 @@
   /**
* Set a message relating to this output.
*
-   * @param $uri
-   * @param $type
+   * @param string $uri
+   * @param string $type
+   * @param int $count
*/
   public function setMessage($uri, $type, $count) {
 $row = ($count > 1) ? 'rows' : 'row';

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I74cee89622b2dd7588534de5791dd1110538277a
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: deployment
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Fix checks for existing contributions on Benevity imports to...

2017-11-28 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/393987 )

Change subject: Fix checks for existing contributions on Benevity imports to 
check donor AND matching contributions.
..

Fix checks for existing contributions on Benevity imports to check donor AND 
matching contributions.

Currently donor contributions that have already been imported are marked as 
duplicates but where the matching
contribution has been imported that is not picked up as a duplicate and results 
in an error.

The impact on users is that a string of errors will result in the import 
aborting. On the other hand, a string
of duplicates will be ignored, allowing a mostly imported csv to be 
re-attempted.

Bug: T181548
Change-Id: Iff464153e40c9f751c63e21b0236d552f1e1ceb9
---
M sites/all/modules/offline2civicrm/BenevityFile.php
M sites/all/modules/offline2civicrm/ChecksFile.php
M sites/all/modules/offline2civicrm/tests/BenevityTest.php
3 files changed, 121 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/87/393987/1

diff --git a/sites/all/modules/offline2civicrm/BenevityFile.php 
b/sites/all/modules/offline2civicrm/BenevityFile.php
index 9c65520..e4fb714 100644
--- a/sites/all/modules/offline2civicrm/BenevityFile.php
+++ b/sites/all/modules/offline2civicrm/BenevityFile.php
@@ -411,4 +411,45 @@
 return FALSE;
   }
 
+  /**
+   * Check for any existing contributions for the given transaction.
+   *
+   * If either the donor transaction of the matching gift transaction have 
already
+   * been imported return (1) imported transaction.
+   *
+   * If both the matching and donor transactions have been imported previously 
it
+   * is OK to return only one
+   *
+   * If it appears there has been a previous partial import
+   *
+   * @param $msg
+   *
+   * @return array|bool
+   *
+   * @throws \WmfException
+   */
+  protected function checkForExistingMatchingContributions($msg) {
+$donorTransactionNeedsProcessing = (!empty($msg['gross']) && $msg['gross'] 
!== "0.00");
+$matchingTransactionNeedsProcessing = (!empty($msg['matching_amount']) && 
$msg['matching_amount'] !== "0.00");
+
+$main = $matched = FALSE;
+if ($donorTransactionNeedsProcessing) {
+  $main = wmf_civicrm_get_contributions_from_gateway_id($msg['gateway'], 
$msg['gateway_txn_id']);
+}
+
+if ($matchingTransactionNeedsProcessing) {
+  $matched = 
wmf_civicrm_get_contributions_from_gateway_id($msg['gateway'], 
$msg['gateway_txn_id'] . '_matched');
+}
+
+if ($matchingTransactionNeedsProcessing && 
$donorTransactionNeedsProcessing) {
+  // Both transactions need processing. If one finds a match and the other 
doesn't we have a potential error scenario
+  // and should throw an exception.
+  $duplicates = ($main ? 1 : 0) + ($matched ? 1 : 0);
+  if ($duplicates === 1) {
+throw new WmfException('INVALID_MESSAGE', 'row has already been 
partially imported');
+  }
+}
+return $main ? $main : $matched;
+  }
+
 }
diff --git a/sites/all/modules/offline2civicrm/ChecksFile.php 
b/sites/all/modules/offline2civicrm/ChecksFile.php
index 4d6601a..3136f1c 100644
--- a/sites/all/modules/offline2civicrm/ChecksFile.php
+++ b/sites/all/modules/offline2civicrm/ChecksFile.php
@@ -131,9 +131,10 @@
   throw new IgnoredRowException('IMPORT_CONTRIB', 'Error limit 
reached');
 }
 $msg = $this->parseRow($data);
+$existing = $this->checkForExistingMatchingContributions($msg);
 
 // check to see if we have already processed this check
-if ($existing = 
wmf_civicrm_get_contributions_from_gateway_id($msg['gateway'], 
$msg['gateway_txn_id'])) {
+if ($existing) {
   $skipped = $this->handleDuplicate($existing);
   if ($skipped) {
 if ($num_duplicates === 0) {
@@ -662,4 +663,15 @@
 }
   }
 
+  /**
+   * Check for any existing contributions for the given transaction.
+   *
+   * @param $msg
+   *
+   * @return array|bool
+   */
+  protected function checkForExistingMatchingContributions($msg) {
+return  wmf_civicrm_get_contributions_from_gateway_id($msg['gateway'], 
$msg['gateway_txn_id']);
+  }
+
 }
diff --git a/sites/all/modules/offline2civicrm/tests/BenevityTest.php 
b/sites/all/modules/offline2civicrm/tests/BenevityTest.php
index 647e757..8502c6f 100644
--- a/sites/all/modules/offline2civicrm/tests/BenevityTest.php
+++ b/sites/all/modules/offline2civicrm/tests/BenevityTest.php
@@ -698,6 +698,73 @@
   }
 
   /**
+   * Import the same file twice, checking all are seen as duplicates on round 
2.
+   *
+   * We check this by making sure none are reported as errors.
+   */
+  function testDuplicateDetection() {
+$this->createAllOrgs();
+
+$importer = new BenevityFile(__DIR__ . "/data/benevity.csv");
+$importer->import();
+
+$messages = $this->importBenevityFile();
+

[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Put repetitive line of code in their own functions

2017-11-28 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/393986 )

Change subject: Put repetitive line of code in their own functions
..

Put repetitive line of code in their own functions

Change-Id: I490615746b5ecae0ec25b263ab47640381ed0240
---
M sites/all/modules/offline2civicrm/tests/BenevityTest.php
1 file changed, 48 insertions(+), 61 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/86/393986/1

diff --git a/sites/all/modules/offline2civicrm/tests/BenevityTest.php 
b/sites/all/modules/offline2civicrm/tests/BenevityTest.php
index 110bd0d..647e757 100644
--- a/sites/all/modules/offline2civicrm/tests/BenevityTest.php
+++ b/sites/all/modules/offline2civicrm/tests/BenevityTest.php
@@ -66,9 +66,7 @@
   'organization_name' => 'Donald Duck Inc',
   'contact_type' => 'Organization',
 ));
-$importer = new BenevityFile(__DIR__ . "/data/benevity.csv");
-$importer->import();
-$messages = $importer->getMessages();
+$messages = $this->importBenevityFile();
 $this->assertEquals('0 out of 4 rows were imported.', $messages['Result']);
   }
 
@@ -76,9 +74,7 @@
* Test that all imports fail if the organization does not pre-exist.
*/
   function testImportFailNoOrganizationContactExists() {
-$importer = new BenevityFile(__DIR__ . "/data/benevity.csv");
-$importer->import();
-$messages = $importer->getMessages();
+$messages = $this->importBenevityFile();
 $this->assertEquals('0 out of 4 rows were imported.', $messages['Result']);
   }
 
@@ -90,9 +86,7 @@
   'organization_name' => 'Donald Duck Inc',
   'contact_type' => 'Organization',
 ));
-$importer = new BenevityFile(__DIR__ . "/data/benevity.csv");
-$importer->import();
-$messages = $importer->getMessages();
+$messages = $this->importBenevityFile();
 $this->assertEquals('1 out of 4 rows were imported.', $messages['Result']);
   }
 
@@ -111,9 +105,7 @@
   'contact_type' => 'Individual',
   'email' => 'min...@mouse.org',
 ));
-$importer = new BenevityFile(__DIR__ . "/data/benevity.csv");
-$importer->import();
-$messages = $importer->getMessages();
+$messages = $this->importBenevityFile();
 $this->assertEquals('1 out of 4 rows were imported.', $messages['Result']);
 $contributions = $this->callAPISuccess('Contribution', 'get', 
array('contact_id' => $minnie['id']));
 $this->assertEquals(1, $contributions['count']);
@@ -137,9 +129,7 @@
   'organization_name' => 'Mickey Mouse Inc',
   'contact_type' => 'Organization',
 ));
-$importer = new BenevityFile(__DIR__ . "/data/benevity.csv");
-$importer->import();
-$messages = $importer->getMessages();
+$messages = $this->importBenevityFile();
 $this->assertEquals('1 out of 4 rows were imported.', $messages['Result']);
 $contribution = $this->callAPISuccessGetSingle('Contribution', 
array('trxn_id' => 'BENEVITY TRXN-SQUEAK'));
 $this->assertEquals('Benevity', $contribution['financial_type']);
@@ -251,9 +241,7 @@
   'email' => 'min...@mouse.org',
   'employer_id' => $organization['id'],
 ));
-$importer = new BenevityFile(__DIR__ . "/data/benevity.csv");
-$importer->import();
-$messages = $importer->getMessages();
+$messages = $this->importBenevityFile();
 $this->assertEquals('1 out of 4 rows were imported.', $messages['Result']);
 $contributions = $this->callAPISuccess('Contribution', 'get', 
array('contact_id' => $minnie['id']));
 $this->assertEquals(0, $contributions['count']);
@@ -287,9 +275,7 @@
   'contact_type' => 'Individual',
   'employer_id' => $organization['id'],
 ));
-$importer = new BenevityFile(__DIR__ . "/data/benevity.csv");
-$importer->import();
-$messages = $importer->getMessages();
+$messages = $this->importBenevityFile();
 $this->assertEquals('1 out of 4 rows were imported.', $messages['Result']);
 $contributions = $this->callAPISuccess('Contribution', 'get', 
array('contact_id' => $minnie['id']));
 $this->assertEquals(0, $contributions['count']);
@@ -368,9 +354,7 @@
   'email' => 'min...@mouse.org',
   'employer_id' => $organization['id'],
 ));
-$importer = new BenevityFile(__DIR__ . "/data/benevity.csv");
-$importer->import();
-$messages = $importer->getMessages();
+$messages = $this->importBenevityFile();
 $this->assertEquals('1 out of 4 rows were imported.', $messages['Result']);
 $contributions = $this->callAPISuccess('Contribution', 'get', 
array('contact_id' => $minnie['id']));
 $this->assertEquals(0, $contributions['count']);
@@ -413,9 +397,7 @@
   'soft_credit_to' => $betterMinnie['id'],
   'contact_id' => $organization['id'],
 ));
-$importer = new BenevityFile(__DIR__ . "/data/benevity.csv");
-$importer->import();
-$messages = $importer->getMessages();
+   

[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Comment block tidy ups

2017-11-28 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/393978 )

Change subject: Comment block tidy ups
..

Comment block tidy ups

Change-Id: I74cee89622b2dd7588534de5791dd1110538277a
---
M sites/all/modules/offline2civicrm/ChecksFile.php
1 file changed, 13 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/78/393978/1

diff --git a/sites/all/modules/offline2civicrm/ChecksFile.php 
b/sites/all/modules/offline2civicrm/ChecksFile.php
index 74fa25c..4d6601a 100644
--- a/sites/all/modules/offline2civicrm/ChecksFile.php
+++ b/sites/all/modules/offline2civicrm/ChecksFile.php
@@ -24,6 +24,8 @@
 
   protected $all_missed_file_uri = '';
 
+  protected $row_index;
+
   /**
* @var resource
*/
@@ -221,9 +223,11 @@
   /**
* Read a row and transform into normalized queue message form
*
-   * @param array $row native format for this upload file, usually a dict
+   * @param $data
*
* @return array queue message format
+   *
+   * @throws \EmptyRowException
*/
   protected function parseRow($data) {
 $msg = array();
@@ -264,6 +268,10 @@
   /**
* Do any final transformation on a normalized and default-laden queue
* message.  Overrides are specific to each upload source.
+   *
+   * @param array $msg
+   *
+   * @throws \WmfException
*/
   protected function mungeMessage(&$msg) {
 if (isset($msg['raw_contribution_type'])) {
@@ -562,6 +570,7 @@
*
* @param int $totalRows
* @param int $num_successful
+   * @param int $num_errors
* @param int $num_ignored
* @param int $num_duplicates
*/
@@ -608,8 +617,9 @@
   /**
* Set a message relating to this output.
*
-   * @param $uri
-   * @param $type
+   * @param string $uri
+   * @param string $type
+   * @param int $count
*/
   public function setMessage($uri, $type, $count) {
 $row = ($count > 1) ? 'rows' : 'row';

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I74cee89622b2dd7588534de5791dd1110538277a
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Apply drupal formatting to file prior to editing

2017-11-28 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/393977 )

Change subject: Apply drupal formatting to file prior to editing
..

Apply drupal formatting to file prior to editing

Change-Id: I1d22b440bf5e4dc4b66fc2cd7ef91a9c38905c6c
---
M sites/all/modules/offline2civicrm/ChecksFile.php
1 file changed, 499 insertions(+), 468 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/77/393977/1

diff --git a/sites/all/modules/offline2civicrm/ChecksFile.php 
b/sites/all/modules/offline2civicrm/ChecksFile.php
index 618d960..74fa25c 100644
--- a/sites/all/modules/offline2civicrm/ChecksFile.php
+++ b/sites/all/modules/offline2civicrm/ChecksFile.php
@@ -5,52 +5,60 @@
 /**
  * CSV batch format for manually-keyed donation checks
  *
- * FIXME: This currently includes stuff specific to Wikimedia Foundation 
fundraising.
+ * FIXME: This currently includes stuff specific to Wikimedia Foundation
+ * fundraising.
  */
 abstract class ChecksFile {
-protected $numSkippedRows = 0;
-protected $messages = array();
-protected $file_uri = '';
-protected $error_file_uri = '';
-protected $skipped_file_uri = '';
-protected $ignored_file_uri = '';
-protected $all_missed_file_uri = '';
 
-/**
- * @var resource
- */
-protected $ignoredFileResource = NULL;
+  protected $numSkippedRows = 0;
 
-/**
- * @var resource
- */
-protected $skippedFileResource = NULL;
+  protected $messages = array();
 
-/**
- * @var resource
- */
-protected $errorFileResource = NULL;
+  protected $file_uri = '';
 
-/**
- * @var resource
- */
-protected $allMissedFileResource = NULL;
+  protected $error_file_uri = '';
 
-/**
- * @param string $file_uri path to the file
- */
-function __construct( $file_uri ) {
-$this->file_uri = $file_uri;
-global $user;
-$suffix = $user->uid . '.csv';
-$this->error_file_uri = str_replace('.csv', '_errors.' . $suffix, 
$file_uri);
-$this->skipped_file_uri = str_replace('.csv', '_skipped.' . $suffix, 
$file_uri);
-$this->ignored_file_uri = str_replace('.csv', '_ignored.' . $suffix, 
$file_uri);
-$this->all_missed_file_uri = str_replace('.csv', '_all_missed.' . 
$suffix, $file_uri);
-wmf_common_set_smashpig_message_source(
-'direct', 'Offline importer: ' . get_class( $this )
-);
-}
+  protected $skipped_file_uri = '';
+
+  protected $ignored_file_uri = '';
+
+  protected $all_missed_file_uri = '';
+
+  /**
+   * @var resource
+   */
+  protected $ignoredFileResource = NULL;
+
+  /**
+   * @var resource
+   */
+  protected $skippedFileResource = NULL;
+
+  /**
+   * @var resource
+   */
+  protected $errorFileResource = NULL;
+
+  /**
+   * @var resource
+   */
+  protected $allMissedFileResource = NULL;
+
+  /**
+   * @param string $file_uri path to the file
+   */
+  function __construct($file_uri) {
+$this->file_uri = $file_uri;
+global $user;
+$suffix = $user->uid . '.csv';
+$this->error_file_uri = str_replace('.csv', '_errors.' . $suffix, 
$file_uri);
+$this->skipped_file_uri = str_replace('.csv', '_skipped.' . $suffix, 
$file_uri);
+$this->ignored_file_uri = str_replace('.csv', '_ignored.' . $suffix, 
$file_uri);
+$this->all_missed_file_uri = str_replace('.csv', '_all_missed.' . $suffix, 
$file_uri);
+wmf_common_set_smashpig_message_source(
+  'direct', 'Offline importer: ' . get_class($this)
+);
+  }
 
   /**
* Getter for messages array.
@@ -69,456 +77,470 @@
*
* @throws \Exception
*/
-function import() {
-ChecksImportLog::record( "Beginning import of checks file 
{$this->file_uri}..." );
-//TODO: $db->begin();
+  function import() {
+ChecksImportLog::record("Beginning import of checks file 
{$this->file_uri}...");
+//TODO: $db->begin();
 
-ini_set( 'auto_detect_line_endings', true );
-if( ( $file = fopen( $this->file_uri, 'r' )) === FALSE ){
-throw new WmfException( 'FILE_NOT_FOUND', 'Import checks: Could 
not open file for reading: ' . $this->file_uri );
-}
+ini_set('auto_detect_line_endings', TRUE);
+if (($file = fopen($this->file_uri, 'r')) === FALSE) {
+  throw new WmfException('FILE_NOT_FOUND', 'Import checks: Could not open 
file for reading: ' . $this->file_uri);
+}
 
-if ( $this->numSkippedRows ) {
-foreach ( range( 1, $this->numSkippedRows ) as $i ) {
-fgets( $file );
-}
-}
-
-$headers = _load_headers( fgetcsv( $file, 0, ',', '"', '\\') );
-
-$this->validateColumns( $headers );
-
-$num_errors = 0;
-$num_ignored = 0;
-$num_successful = 0;
-$num_duplicates = 0;
-$this->row_index = -1 + $this->numSkippedRows;
-$error_streak_start = 0;
- 

[MediaWiki-commits] [Gerrit] wikimedia...civicrm[master]: CRM-21489 resurrect deadlock re-tries

2017-11-27 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/393705 )

Change subject: CRM-21489 resurrect deadlock re-tries
..

CRM-21489 resurrect deadlock re-tries

It turns out the code to retry 3 times in event of a deadlock is broken.

More detail on the JIRA ticket

Change-Id: Ic83168ff45a89092e7fcf688c6feb7d09deee608
---
M packages/DB/DataObject.php
1 file changed, 13 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm/civicrm 
refs/changes/05/393705/1

diff --git a/packages/DB/DataObject.php b/packages/DB/DataObject.php
index 0d74ece..37a1961 100644
--- a/packages/DB/DataObject.php
+++ b/packages/DB/DataObject.php
@@ -2436,14 +2436,21 @@
 $t= explode(' ',microtime());
 $_DB_DATAOBJECT['QUERYENDTIME'] = $time = $t[0]+$t[1];
 
-
+$maxTries = is_defined('CIVICRM_DEADLOCK_RETRIES') ? 
CIVICRM_DEADLOCK_RETRIES : 3;
 for ($tries = 0;$tries < 3;$tries++) {
-
 if ($_DB_driver == 'DB') {
-if ($tries) {
-  CRM_Core_Error::debug_log_message('Attempt: ' . $tries + 1 . 
' at query : ' . $string);
+try {
+  $result = $DB->query($string);
 }
-$result = $DB->query($string);
+catch (PEAR_Exception $e) {
+  // If we have caught a deadlock - let it go around the loop 
until our tries limit is hit.
+  // else rethrow the exception.
+  if (!stristr($e->getCause()->getUserInfo(), 
'nativecode=1205') || ($tries + 1) === $maxTries) {
+throw $e;
+  }
+  CRM_Core_Error::debug_log_message('Retrying after deadlock 
hit on attempt ' . $tries + 1 . ' at query : ' . $string);
+  continue;
+}
 
 } else {
 switch (strtolower(substr(trim($string),0,6))) {
@@ -2460,7 +2467,7 @@
 }
 }
 
-// see if we got a failure.. - try again a few times..
+// See CRM-21489 for why I believe this is never hit.
 if (!is_a($result,'PEAR_Error')) {
 break;
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic83168ff45a89092e7fcf688c6feb7d09deee608
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm/civicrm
Gerrit-Branch: master
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: [WIP] add stripe import

2017-11-20 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/392566 )

Change subject: [WIP] add stripe import
..

[WIP] add stripe import

Bug: T172423

Change-Id: I63a85f352caec1d695724a9b1dd1129f9a29781c
---
A sites/all/modules/offline2civicrm/StripeFile.php
M sites/all/modules/offline2civicrm/offline2civicrm.info
M sites/all/modules/offline2civicrm/offline2civicrm.module
A sites/all/modules/offline2civicrm/tests/StripeFileTest.php
A sites/all/modules/offline2civicrm/tests/data/stripe.csv
5 files changed, 124 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/66/392566/1

diff --git a/sites/all/modules/offline2civicrm/StripeFile.php 
b/sites/all/modules/offline2civicrm/StripeFile.php
new file mode 100644
index 000..bcf6cac
--- /dev/null
+++ b/sites/all/modules/offline2civicrm/StripeFile.php
@@ -0,0 +1,85 @@
+ 'gateway_txn_id',
+  // utm_source
+  // utm_campaign
+  // utm_medium
+  'Card Address Line1' => 'street_address',
+  'Card Address Line2' => 'supplemental_address_1',
+  'Card Address City' => 'city',
+  'Converted Amount' => 'gross',
+  'Created (UTC)' => 'date',
+  'Customer Email' => 'email',
+  // use wmf_civicrm_janky_split_name in munge message (move up)
+  'Card Name' => 'full_name',
+  'Card Address State' => 'state_province',
+  'Card Address Zip' => 'postal_code',
+  'Card Address Country' => 'country',
+
+
+  //id,
+  //Description,
+  //Amount ,,
+  //Amount Refunded,
+  //Currency,
+  //Converted Amount,
+  //Converted Amount Refunded,Fee,
+  //Tax,
+  //Converted Currency,
+  //Mode,
+  //Status,
+  //Statement Descriptor,
+  //Customer ID,
+  //Customer Description,,
+  //Captured,Card ID,
+  //Card Last4,
+  //Card Brand,
+  //Card Funding,
+  //Card Exp Month,
+  //Card Exp Year,
+  //Card Issue Country,
+  //Card Fingerprint,
+  //Card CVC Status,
+  //Card AVS Zip Status,
+  //Card AVS Line1 Status,
+  //Card Tokenization Method,
+  //Disputed Amount,
+  //Dispute Status,
+  //Dispute Reason,
+  //Dispute Date (UTC),
+  //Dispute Evidence Due (UTC)
+  //Invoice ID,
+  //Payment Source Type,
+  //Destination,
+  //Transfer,
+  //Transfer Group,
+  //event_id (metadata),
+  //event_name (metadata),
+  //order_number (metadata)
+);
+  }
+
+  protected function getDefaultValues() {
+return parent::getDefaultValues() + array(
+'gateway' => 'stripe',
+'currency' => 'USD',
+'no_thank_you' => 'stripe',
+// @todo - should this be 'Stripe'
+'payment_instrument' => 'Credit Card',
+  );
+  }
+
+}
diff --git a/sites/all/modules/offline2civicrm/offline2civicrm.info 
b/sites/all/modules/offline2civicrm/offline2civicrm.info
index 4462913..058cd03 100644
--- a/sites/all/modules/offline2civicrm/offline2civicrm.info
+++ b/sites/all/modules/offline2civicrm/offline2civicrm.info
@@ -22,6 +22,7 @@
 files[] = PayPalChecksFile.php
 files[] = RefundFile.php
 files[] = SquareFile.php
+files[] = StripeFile.php
 files[] = TrilogyFile.php
 files[] = WmfImportFile.php
 files[] = WmfOrgImportFile.php
diff --git a/sites/all/modules/offline2civicrm/offline2civicrm.module 
b/sites/all/modules/offline2civicrm/offline2civicrm.module
index 71cb137..ed491c3 100644
--- a/sites/all/modules/offline2civicrm/offline2civicrm.module
+++ b/sites/all/modules/offline2civicrm/offline2civicrm.module
@@ -115,6 +115,7 @@
   'jpmorgan' => t('JP Morgan'),
   'paypal' => t('PayPal EFT'),
   'square' => t('Square'),
+  'stripe' => t('Stripe'),
   'trilogy' => t('Trilogy'),
 ),
   );
@@ -194,6 +195,11 @@
 case 'square':
   $importer = new SquareFile($file->uri);
   break;
+
+case 'stripe':
+  $importer = new StripeFile($file->uri);
+  break;
+
 case 'trilogy':
   $importer = new TrilogyFile($file->uri);
   break;
diff --git a/sites/all/modules/offline2civicrm/tests/StripeFileTest.php 
b/sites/all/modules/offline2civicrm/tests/StripeFileTest.php
new file mode 100644
index 000..6102101
--- /dev/null
+++ b/sites/all/modules/offline2civicrm/tests/StripeFileTest.php
@@ -0,0 +1,29 @@
+gateway = 'stripe';
+  }
+
+  /**
+   * Test basic import.
+   */
+  function testImport() {
+civicrm_initialize();
+
+$importer = new StripeFile(__DIR__ . "/data/stripe.csv");
+$importer->import();
+$firstGateWayID = 'ch_1Al1231231231231231231123';
+$contribution = 
wmf_civicrm_get_contributions_from_gateway_id($this->gateway, $firstGateWayID);
+$this->assertEquals(1, count($contribution));
+$this->assertEquals('STRIPE CH_1AL1231231231231231231123', 
$contribution[0]['trxn_id']);
+$this->assertEquals('500', $contributi

[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Apply drupal formatting to offline2civicrm.module

2017-11-20 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/392565 )

Change subject: Apply drupal formatting to offline2civicrm.module
..

Apply drupal formatting to offline2civicrm.module

Re-formatted using drupal rules in IDE

Change-Id: If7940b90edb13ab46df2cebf336c99ab8289f556
---
M sites/all/modules/offline2civicrm/offline2civicrm.module
1 file changed, 90 insertions(+), 90 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/65/392565/1

diff --git a/sites/all/modules/offline2civicrm/offline2civicrm.module 
b/sites/all/modules/offline2civicrm/offline2civicrm.module
index 18ff9fa..71cb137 100644
--- a/sites/all/modules/offline2civicrm/offline2civicrm.module
+++ b/sites/all/modules/offline2civicrm/offline2civicrm.module
@@ -70,59 +70,59 @@
 }
 
 function offline2civicrm_import_checks_form() {
-  $dir = drupal_get_path( 'module', 'offline2civicrm' );
-  drupal_add_js( $dir . '/upload_form.js' );
+  $dir = drupal_get_path('module', 'offline2civicrm');
+  drupal_add_js($dir . '/upload_form.js');
 
   $log_events = ChecksImportLog::recentEvents();
-  $headers = array( 'Time', 'Who', 'Done' );
+  $headers = array('Time', 'Who', 'Done');
   $rows = array();
-  foreach ( $log_events as $event ) {
+  foreach ($log_events as $event) {
 $rows[] = array(
   $event->time,
   $event->who,
   $event->done,
 );
   }
-  $log_html = theme_table( array(
-'header' => $headers,
-'rows' => $rows,
-'empty' => "No events yet.",
-'attributes' => array(),
-'caption' => t( 'Latest import events' ),
-'colgroups' => array(),
-'sticky' => true,
-  ) ).theme('pager');
+  $log_html = theme_table(array(
+  'header' => $headers,
+  'rows' => $rows,
+  'empty' => "No events yet.",
+  'attributes' => array(),
+  'caption' => t('Latest import events'),
+  'colgroups' => array(),
+  'sticky' => TRUE,
+)) . theme('pager');
 
   $form['import_upload_file'] = array(
-'#title' => t( 'Upload checks file' ),
+'#title' => t('Upload checks file'),
 '#type' => 'file',
   );
   $form['import_upload_submit'] = array(
 '#type' => 'submit',
-'#value' => t( 'Upload' ),
+'#value' => t('Upload'),
   );
   $form['import_upload_format'] = array(
-'#title' => t( 'File format' ),
+'#title' => t('File format'),
 '#type' => 'radios',
 '#default_value' => 'generic_ind',
 '#options' => array(
-'benevity' => t('Benevity'),
-'engage' => t( 'Engage' ),
-'coinbase' => t( 'Coinbase Merchant Orders' ),
-'foreign_checks' => t( 'Foreign Checks' ),
-'generic_ind' => t( 'Generic Individuals' ),
-'generic_org' => t( 'Generic Organizations' ),
-'jpmorgan' => t( 'JP Morgan' ),
-'paypal' => t( 'PayPal EFT' ),
-'square' => t( 'Square' ),
-'trilogy' => t( 'Trilogy' ),
+  'benevity' => t('Benevity'),
+  'engage' => t('Engage'),
+  'coinbase' => t('Coinbase Merchant Orders'),
+  'foreign_checks' => t('Foreign Checks'),
+  'generic_ind' => t('Generic Individuals'),
+  'generic_org' => t('Generic Organizations'),
+  'jpmorgan' => t('JP Morgan'),
+  'paypal' => t('PayPal EFT'),
+  'square' => t('Square'),
+  'trilogy' => t('Trilogy'),
 ),
   );
   $form['log'] = array(
 '#markup' => $log_html,
   );
 
-  $form['#attributes'] = array( 'enctype' => "multipart/form-data" );
+  $form['#attributes'] = array('enctype' => "multipart/form-data");
 
   return $form;
 }
@@ -133,88 +133,88 @@
  * @param $file_name
  */
 function offline2civicrm_download_csv($file_name) {
-global $user;
-if (!preg_match ('/\.' . $user->uid . '$/', $file_name)) {
-  return drupal_access_denied();
-}
-$fileURI = 'temporary://' . $file_name . '.csv';
-if ($file_name && file_exists($fileURI)) {
-  file_transfer($fileURI, array(
-'Content-Type' => 'text/csv',
-'Content-Disposition' => 'attachment; filename="' . $file_name . 
'.csv"',
-  ));
-}
-else {
-  return drupal_access_denied();
-}
+  global $user;
+  if (!preg_match('/\.' . $user->uid . '$/', $file_name)) {
+return drupal_access_denied();
+  }
+  $fileURI = 'temporary://' . $file_name . '.csv';
+  if ($file_name && file_exists($fileURI)) {
+file_transfer($fileURI, array(
+  'Content-Type' => 'text/csv',
+  'Content-Disposition' => 'attachment; filename="' . $file_name . '.csv"',
+));
+  }
+  else {
+return drupal_access_denied();
+  }
 }
 
-function offline2civicrm_import_checks_form_submit( $form, $form_state ) {
-  wmf_common_create_smashpig_context( 'offline2civicrm' );
-  if ( !empty( $form_state['values']['import_upload_submit'] ) ) {
+function offline2civicrm_import_checks_form_submit($form, $form_state) {
+  wmf_common_create_smashpig_context('offline2civicrm');
+  if (!empty($form_stat

[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Move basic declaration of epochtime to parent.

2017-11-20 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/392555 )

Change subject: Move basic declaration of epochtime to parent.
..

Move basic declaration of epochtime to parent.

Several classes are declaring this var & setting it to the same thing. Let's put
a basic declaration in the parent & override when needed.

(towards) Bug: T172423

Change-Id: I3da4f44ea84f6248877d8d6fd710ea4dcfbd6e62
---
M sites/all/modules/offline2civicrm/tests/BenevityTest.php
M sites/all/modules/offline2civicrm/tests/CoinBaseTest.php
M sites/all/modules/offline2civicrm/tests/JpMorganFileTest.php
M sites/all/modules/offline2civicrm/tests/includes/BaseChecksFileTest.php
4 files changed, 7 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/55/392555/1

diff --git a/sites/all/modules/offline2civicrm/tests/BenevityTest.php 
b/sites/all/modules/offline2civicrm/tests/BenevityTest.php
index 8e1ff01..110bd0d 100644
--- a/sites/all/modules/offline2civicrm/tests/BenevityTest.php
+++ b/sites/all/modules/offline2civicrm/tests/BenevityTest.php
@@ -11,12 +11,9 @@
  */
 class BenevityTest extends BaseChecksFileTest {
 
-  protected $epochtime;
-
   function setUp() {
 parent::setUp();
 
-$this->epochtime = wmf_common_date_parse_string('2016-09-15');
 $this->setExchangeRates($this->epochtime, array('USD' => 1, 'BTC' => 3));
 $this->gateway = 'benevity';
 civicrm_initialize();
diff --git a/sites/all/modules/offline2civicrm/tests/CoinBaseTest.php 
b/sites/all/modules/offline2civicrm/tests/CoinBaseTest.php
index 0c71bbf..e21930b 100644
--- a/sites/all/modules/offline2civicrm/tests/CoinBaseTest.php
+++ b/sites/all/modules/offline2civicrm/tests/CoinBaseTest.php
@@ -6,12 +6,8 @@
  */
 class CoinBaseTest extends BaseChecksFileTest {
 
-  protected $epochtime;
-
   function setUp() {
 parent::setUp();
-
-$this->epochtime = wmf_common_date_parse_string('2016-09-15');
 $this->setExchangeRates($this->epochtime, array('USD' => 1, 'BTC' => 3));
 $this->gateway = 'coinbase';
   }
diff --git a/sites/all/modules/offline2civicrm/tests/JpMorganFileTest.php 
b/sites/all/modules/offline2civicrm/tests/JpMorganFileTest.php
index 411075c..cd9d0f3 100644
--- a/sites/all/modules/offline2civicrm/tests/JpMorganFileTest.php
+++ b/sites/all/modules/offline2civicrm/tests/JpMorganFileTest.php
@@ -6,8 +6,6 @@
  */
 class JpMorganFileTest extends BaseChecksFileTest {
 
-  protected $epochtime;
-
   protected $strtime;
 
   function setUp() {
diff --git 
a/sites/all/modules/offline2civicrm/tests/includes/BaseChecksFileTest.php 
b/sites/all/modules/offline2civicrm/tests/includes/BaseChecksFileTest.php
index 3060584..d69e203 100644
--- a/sites/all/modules/offline2civicrm/tests/includes/BaseChecksFileTest.php
+++ b/sites/all/modules/offline2civicrm/tests/includes/BaseChecksFileTest.php
@@ -19,6 +19,13 @@
*/
   protected $trxn_id;
 
+  protected $epochtime;
+
+  function setUp() {
+parent::setUp();
+$this->epochtime = wmf_common_date_parse_string('2016-09-15');
+  }
+
   /**
* Test and remove some dynamic fields, to simplify test fixtures.
*/

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3da4f44ea84f6248877d8d6fd710ea4dcfbd6e62
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Align whitespace to drupal std.

2017-11-20 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/392553 )

Change subject: Align whitespace to drupal std.
..

Align whitespace to drupal std.

I simply ran phpstorm code formatter over the offline2civicrm/tests dir with 
code
formatting set to drupal standards & then eyeballed the changes as I committed 
them
to see that nothing weird was happening. I thought that doing the files around
the one I was about to start work on made sense

Change-Id: Ic13a06b65f85fb007c9938dccf838cf59eb2ea61
---
M sites/all/modules/offline2civicrm/tests/BenevityTest.php
M sites/all/modules/offline2civicrm/tests/ChecksFileTest.php
M sites/all/modules/offline2civicrm/tests/CoinBaseTest.php
M sites/all/modules/offline2civicrm/tests/ContributionConversionTest.php
M sites/all/modules/offline2civicrm/tests/EngageChecksFileTest.php
M sites/all/modules/offline2civicrm/tests/ForeignChecksFileTest.php
M sites/all/modules/offline2civicrm/tests/JpMorganFileTest.php
M sites/all/modules/offline2civicrm/tests/PayPalChecksFileTest.php
M sites/all/modules/offline2civicrm/tests/SquareFileTest.php
M sites/all/modules/offline2civicrm/tests/WmfImportTest.php
M sites/all/modules/offline2civicrm/tests/includes/BaseChecksFileTest.php
M sites/all/modules/offline2civicrm/tests/includes/ChecksFileProbe.php
M sites/all/modules/offline2civicrm/tests/includes/EngageChecksFileProbe.php
M sites/all/modules/offline2civicrm/tests/includes/ForeignChecksFileProbe.php
M sites/all/modules/offline2civicrm/tests/includes/JpMorganFileProbe.php
M sites/all/modules/offline2civicrm/tests/includes/PayPalChecksFileProbe.php
M sites/all/modules/offline2civicrm/tests/includes/SquareFileProbe.php
17 files changed, 973 insertions(+), 774 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/53/392553/1

diff --git a/sites/all/modules/offline2civicrm/tests/BenevityTest.php 
b/sites/all/modules/offline2civicrm/tests/BenevityTest.php
index 78487a5..4d87605 100644
--- a/sites/all/modules/offline2civicrm/tests/BenevityTest.php
+++ b/sites/all/modules/offline2civicrm/tests/BenevityTest.php
@@ -59,9 +59,15 @@
* Test that all imports fail if the organization has multiple matches.
*/
   function testImportFailOrganizationContactAmbiguous() {
-$this->callAPISuccess('Contact', 'create', array('organization_name' => 
'Donald Duck Inc', 'contact_type' => 'Organization'));
-$this->callAPISuccess('Contact', 'create', array('organization_name' => 
'Donald Duck Inc', 'contact_type' => 'Organization'));
-$importer = new BenevityFile( __DIR__ . "/data/benevity.csv" );
+$this->callAPISuccess('Contact', 'create', array(
+  'organization_name' => 'Donald Duck Inc',
+  'contact_type' => 'Organization'
+));
+$this->callAPISuccess('Contact', 'create', array(
+  'organization_name' => 'Donald Duck Inc',
+  'contact_type' => 'Organization'
+));
+$importer = new BenevityFile(__DIR__ . "/data/benevity.csv");
 $importer->import();
 $messages = $importer->getMessages();
 $this->assertEquals('0 out of 4 rows were imported.', $messages['Result']);
@@ -71,7 +77,7 @@
* Test that all imports fail if the organization does not pre-exist.
*/
   function testImportFailNoOrganizationContactExists() {
-$importer = new BenevityFile( __DIR__ . "/data/benevity.csv" );
+$importer = new BenevityFile(__DIR__ . "/data/benevity.csv");
 $importer->import();
 $messages = $importer->getMessages();
 $this->assertEquals('0 out of 4 rows were imported.', $messages['Result']);
@@ -81,8 +87,11 @@
* Test that import passes for the contact if a single match is found.
*/
   function testImportSucceedOrganizationSingleContactExists() {
-$this->callAPISuccess('Contact', 'create', array('organization_name' => 
'Donald Duck Inc', 'contact_type' => 'Organization'));
-$importer = new BenevityFile( __DIR__ . "/data/benevity.csv" );
+$this->callAPISuccess('Contact', 'create', array(
+  'organization_name' => 'Donald Duck Inc',
+  'contact_type' => 'Organization'
+));
+$importer = new BenevityFile(__DIR__ . "/data/benevity.csv");
 $importer->import();
 $messages = $importer->getMessages();
 $this->assertEquals('1 out of 4 rows were imported.', $messages['Result']);
@@ -92,17 +101,26 @@
* Test that import passes for the Individual contact if a single match is 
found.
*/
   function testImportSucceedIndividualSingleContactExists() {
-$thaMouseMeister = $this->callAPISuccess('Contact', 'create', 
array('organization_name' => 'Mickey Mouse Inc', 'contact_type' => 
'Organization'));
-$minnie = $this->callAPISuccess('Contact', 'create', array(
-  'first_name' => 'Minnie', 'last_name' => 'Mouse', 'contact_type' => 
'Individual', 'email' => 'min...@mouse.org',
+$thaMouseMeister = $this->callAPISuccess('Contact', 'create', array(
+  'organizati

[MediaWiki-commits] [Gerrit] wikimedia...crm[deployment]: Merge branch 'master' of https://gerrit.wikimedia.org/r/wiki...

2017-11-20 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/392530 )

Change subject: Merge branch 'master' of 
https://gerrit.wikimedia.org/r/wikimedia/fundraising/crm into deployment
..

Merge branch 'master' of 
https://gerrit.wikimedia.org/r/wikimedia/fundraising/crm into deployment

3cbf0818a75e21dd0eb5029c1ad8c0c721aa111c Add extended reports extension to add 
Address History tab option.
7292e063a2f0274415ac7066550b985a42022674 Enable extended report

Change-Id: I38db002a3b2ca5cfb30b9a6fb1338da03cce26be
---
0 files changed, 0 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/30/392530/1


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I38db002a3b2ca5cfb30b9a6fb1338da03cce26be
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: deployment
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Enable extended report

2017-11-20 Thread Eileen (Code Review)
Eileen has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/391479 )

Change subject: Enable extended report
..


Enable extended report

This extension gives us the Address History tab.

Bug: T142549
Change-Id: I114c8ff324484c618be5be50f929ea15f6596a3c
---
M sites/all/modules/wmf_civicrm/wmf_civicrm.install
1 file changed, 40 insertions(+), 0 deletions(-)

Approvals:
  Ejegg: Looks good to me, approved
  Eileen: Verified



diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.install 
b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
index b57666f..79c0b23 100644
--- a/sites/all/modules/wmf_civicrm/wmf_civicrm.install
+++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
@@ -3330,3 +3330,43 @@
   civicrm_api3('extension', 'refresh', array());
   civicrm_api3('extension', 'install',  array('key' => 
'org.wikimedia.dedupetools'));
 }
+
+/**
+ * Enable extended report.
+ *
+ * This extension gives us the Address History tab.
+ *
+ * Bug: T142549
+ */
+function wmf_civicrm_update_7580() {
+  civicrm_initialize();
+  civicrm_api3('extension', 'refresh', array());
+  civicrm_api3('extension', 'install',  array('key' => 
'nz.co.fuzion.extendedreport'));
+}
+
+/**
+ * Add report for Address History tab.
+ *
+ * Bug: T142549
+ */
+function wmf_civicrm_update_7585() {
+  civicrm_initialize();
+  civicrm_api3('ReportInstance', 'create', array(
+'title' => ts('Address History'),
+'report_id' => 'contact/addresshistory',
+'description' => 'ContactAddress History',
+'permission' => 'access CiviReport',
+'form_values' => serialize(array(
+  'fields' => array(
+'address_display_address' => 1,
+'log_date' => 1,
+'address_location_type_id' => 1,
+'address_is_primary' => 1,
+'log_conn_id' => 1,
+'log_user_id' => 1,
+'log_action' => 1,
+  ),
+  'contact_dashboard_tab' => array('contact_dashboard_tab' => '1'),
+)),
+  ));
+}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I114c8ff324484c618be5be50f929ea15f6596a3c
Gerrit-PatchSet: 6
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Eileen 
Gerrit-Reviewer: Eileen 
Gerrit-Reviewer: Ejegg 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Add extended reports extension to add Address History tab op...

2017-11-20 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/392488 )

Change subject: Add extended reports extension to add Address History tab 
option.
..

Add extended reports extension to add Address History tab option.

Bug: T142549

Change-Id: I78776543fee257aab0a742e6e8dbfbea71afa226
---
A 
sites/default/civicrm/extensions/nz.co.fuzion.extendedreport/CRM/Extendedreport/Form/Report/ActivityEditable.mgd.php
A 
sites/default/civicrm/extensions/nz.co.fuzion.extendedreport/CRM/Extendedreport/Form/Report/ActivityEditable.php
A 
sites/default/civicrm/extensions/nz.co.fuzion.extendedreport/CRM/Extendedreport/Form/Report/ActivityExtended.mgd.php
A 
sites/default/civicrm/extensions/nz.co.fuzion.extendedreport/CRM/Extendedreport/Form/Report/ActivityExtended.php
A 
sites/default/civicrm/extensions/nz.co.fuzion.extendedreport/CRM/Extendedreport/Form/Report/ActivityPivot.mgd.php
A 
sites/default/civicrm/extensions/nz.co.fuzion.extendedreport/CRM/Extendedreport/Form/Report/ActivityPivot.php
A 
sites/default/civicrm/extensions/nz.co.fuzion.extendedreport/CRM/Extendedreport/Form/Report/Campaign/CampaignProgressReport.mgd.php
A 
sites/default/civicrm/extensions/nz.co.fuzion.extendedreport/CRM/Extendedreport/Form/Report/Campaign/CampaignProgressReport.php
A 
sites/default/civicrm/extensions/nz.co.fuzion.extendedreport/CRM/Extendedreport/Form/Report/Case/ActivityPivot.mgd.php
A 
sites/default/civicrm/extensions/nz.co.fuzion.extendedreport/CRM/Extendedreport/Form/Report/Case/ActivityPivot.php
A 
sites/default/civicrm/extensions/nz.co.fuzion.extendedreport/CRM/Extendedreport/Form/Report/Case/CasePivot.mgd.php
A 
sites/default/civicrm/extensions/nz.co.fuzion.extendedreport/CRM/Extendedreport/Form/Report/Case/CasePivot.php
A 
sites/default/civicrm/extensions/nz.co.fuzion.extendedreport/CRM/Extendedreport/Form/Report/Case/CaseWithActivityPivot.mgd.php
A 
sites/default/civicrm/extensions/nz.co.fuzion.extendedreport/CRM/Extendedreport/Form/Report/Case/CaseWithActivityPivot.php
A 
sites/default/civicrm/extensions/nz.co.fuzion.extendedreport/CRM/Extendedreport/Form/Report/Contact/AddressHistory.mgd.php
A 
sites/default/civicrm/extensions/nz.co.fuzion.extendedreport/CRM/Extendedreport/Form/Report/Contact/AddressHistory.php
A 
sites/default/civicrm/extensions/nz.co.fuzion.extendedreport/CRM/Extendedreport/Form/Report/Contact/Basiccontact.mgd.php
A 
sites/default/civicrm/extensions/nz.co.fuzion.extendedreport/CRM/Extendedreport/Form/Report/Contact/Basiccontact.php
A 
sites/default/civicrm/extensions/nz.co.fuzion.extendedreport/CRM/Extendedreport/Form/Report/Contact/Extendedcontact.mgd.php
A 
sites/default/civicrm/extensions/nz.co.fuzion.extendedreport/CRM/Extendedreport/Form/Report/Contact/Extendedcontact.php
A 
sites/default/civicrm/extensions/nz.co.fuzion.extendedreport/CRM/Extendedreport/Form/Report/Contribute/BookkeepingExtended.mgd.php
A 
sites/default/civicrm/extensions/nz.co.fuzion.extendedreport/CRM/Extendedreport/Form/Report/Contribute/BookkeepingExtended.php
A 
sites/default/civicrm/extensions/nz.co.fuzion.extendedreport/CRM/Extendedreport/Form/Report/Contribute/ContributionPivot.mgd.php
A 
sites/default/civicrm/extensions/nz.co.fuzion.extendedreport/CRM/Extendedreport/Form/Report/Contribute/ContributionPivot.php
A 
sites/default/civicrm/extensions/nz.co.fuzion.extendedreport/CRM/Extendedreport/Form/Report/Contribute/DetailExtended.mgd.php
A 
sites/default/civicrm/extensions/nz.co.fuzion.extendedreport/CRM/Extendedreport/Form/Report/Contribute/DetailExtended.php
A 
sites/default/civicrm/extensions/nz.co.fuzion.extendedreport/CRM/Extendedreport/Form/Report/Contribute/LoggingSummary.mgd.php
A 
sites/default/civicrm/extensions/nz.co.fuzion.extendedreport/CRM/Extendedreport/Form/Report/Contribute/LoggingSummary.php
A 
sites/default/civicrm/extensions/nz.co.fuzion.extendedreport/CRM/Extendedreport/Form/Report/Contribute/Overview.mgd.php
A 
sites/default/civicrm/extensions/nz.co.fuzion.extendedreport/CRM/Extendedreport/Form/Report/Contribute/Overview.php
A 
sites/default/civicrm/extensions/nz.co.fuzion.extendedreport/CRM/Extendedreport/Form/Report/Event/Editableevents.mgd.php
A 
sites/default/civicrm/extensions/nz.co.fuzion.extendedreport/CRM/Extendedreport/Form/Report/Event/Editableevents.php
A 
sites/default/civicrm/extensions/nz.co.fuzion.extendedreport/CRM/Extendedreport/Form/Report/Event/EventOverview.mgd.php
A 
sites/default/civicrm/extensions/nz.co.fuzion.extendedreport/CRM/Extendedreport/Form/Report/Event/EventOverview.php
A 
sites/default/civicrm/extensions/nz.co.fuzion.extendedreport/CRM/Extendedreport/Form/Report/Event/EventPivot.mgd.php
A 
sites/default/civicrm/extensions/nz.co.fuzion.extendedreport/CRM/Extendedreport/Form/Report/Event/EventPivot.php
A 
sites/default/civicrm/extensions/nz.co.fuzion.extendedreport/CRM/Extendedreport/Form/Report/Event/ParticipantExtended.mgd.php
A 
sites/default/civicrm/extensions/nz.co.fuzion.exten

[MediaWiki-commits] [Gerrit] wikimedia...crm[deployment]: Merge branch 'master' of https://gerrit.wikimedia.org/r/wiki...

2017-11-15 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/391743 )

Change subject: Merge branch 'master' of 
https://gerrit.wikimedia.org/r/wikimedia/fundraising/crm into deployment
..

Merge branch 'master' of 
https://gerrit.wikimedia.org/r/wikimedia/fundraising/crm into deployment

+ e9b6c803daf1606ddfebe598674492e11995c89c Add dedupetools extension.
+ 705f64cf2abb3802c94c014d2b3ada92c7bea3b1 Tidy up dedupe rules & install 
dedupetools.

Change-Id: I83c715acf1bcc60022d37324833da520eaf941df
---
0 files changed, 0 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/43/391743/1


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I83c715acf1bcc60022d37324833da520eaf941df
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: deployment
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Enable extended report

2017-11-14 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/391479 )

Change subject: Enable extended report
..

Enable extended report

This extension gives us the Address History tab.

Bug: T142549
Change-Id: I114c8ff324484c618be5be50f929ea15f6596a3c
---
M sites/all/modules/wmf_civicrm/wmf_civicrm.install
1 file changed, 13 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/79/391479/1

diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.install 
b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
index c30711e..e3b1bf5 100644
--- a/sites/all/modules/wmf_civicrm/wmf_civicrm.install
+++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
@@ -3320,3 +3320,16 @@
   civicrm_api3('extension', 'refresh', array());
   civicrm_api3('extension', 'install',  array('key' => 
'org.wikimedia.dedupetools'));
 }
+
+/**
+ * Enable extended report.
+ *
+ * This extension gives us the Address History tab.
+ *
+ * Bug: T142549
+ */
+function wmf_civicrm_update_7580() {
+  civicrm_initialize();
+  civicrm_api3('extension', 'refresh', array());
+  civicrm_api3('extension', 'install',  array('key' => 
'nz.co.fuzion.extendedreport'));
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I114c8ff324484c618be5be50f929ea15f6596a3c
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Add extended reports extension to add Address History tab op...

2017-11-14 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/391352 )

Change subject: Add extended reports extension to add Address History tab 
option.
..

Add extended reports extension to add Address History tab option.

T142549

Change-Id: I54f76847d935d3e5e253d11a6bd6f74081520e2d
---
A sites/default/civicrm/extensions/nz.co.fuzion.extendedreport
1 file changed, 1 insertion(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/52/391352/1

diff --git a/sites/default/civicrm/extensions/nz.co.fuzion.extendedreport 
b/sites/default/civicrm/extensions/nz.co.fuzion.extendedreport
new file mode 16
index 000..7d6c6d5
--- /dev/null
+++ b/sites/default/civicrm/extensions/nz.co.fuzion.extendedreport
@@ -0,0 +1 @@
+Subproject commit 7d6c6d580bd219c13b736438b8a4f55155e31c87

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I54f76847d935d3e5e253d11a6bd6f74081520e2d
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Add dedupetools extension.

2017-11-06 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/389650 )

Change subject: Add dedupetools extension.
..

Add dedupetools extension.

This extension contains the code I used to analyse our duplicates. Today I have
added a hook (dedupetools_civicrm_links) to add links to the drop down on the
contact action page to link directly to dedupe search results.

My thinking is to move all our dedupe related custom code to
this extension (& out of wmf_civicrm) over time

Bug: T177999
Change-Id: I0a8e2d6bdc38a4951d9b843a382a17a583c0ed30
---
A sites/default/civicrm/extensions/org.wikimedia.dedupetools/.editorconfig
A 
sites/default/civicrm/extensions/org.wikimedia.dedupetools/CRM/Dedupetools/BAO/MergeConflict.php
A 
sites/default/civicrm/extensions/org.wikimedia.dedupetools/CRM/Dedupetools/Form/Report/MergeConflict.mgd.php
A 
sites/default/civicrm/extensions/org.wikimedia.dedupetools/CRM/Dedupetools/Form/Report/MergeConflict.php
A 
sites/default/civicrm/extensions/org.wikimedia.dedupetools/CRM/Dedupetools/Upgrader.php
A 
sites/default/civicrm/extensions/org.wikimedia.dedupetools/CRM/Dedupetools/Upgrader/Base.php
A sites/default/civicrm/extensions/org.wikimedia.dedupetools/LICENSE.txt
A 
sites/default/civicrm/extensions/org.wikimedia.dedupetools/api/v3/MergeConflict.php
A 
sites/default/civicrm/extensions/org.wikimedia.dedupetools/dedupetools.civix.php
A sites/default/civicrm/extensions/org.wikimedia.dedupetools/dedupetools.php
A sites/default/civicrm/extensions/org.wikimedia.dedupetools/info.xml
A sites/default/civicrm/extensions/org.wikimedia.dedupetools/sql/install.sql
A 
sites/default/civicrm/extensions/org.wikimedia.dedupetools/templates/CRM/Dedupetools/Form/Report/MergeConflict.tpl
A 
sites/default/civicrm/extensions/org.wikimedia.dedupetools/xml/Schema/CRM/Dedupetools/MergeConflict.entityType.php
A 
sites/default/civicrm/extensions/org.wikimedia.dedupetools/xml/Schema/CRM/Dedupetools/MergeConflict.xml
15 files changed, 2,532 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/50/389650/1

diff --git 
a/sites/default/civicrm/extensions/org.wikimedia.dedupetools/.editorconfig 
b/sites/default/civicrm/extensions/org.wikimedia.dedupetools/.editorconfig
new file mode 100644
index 000..ccc6a28
--- /dev/null
+++ b/sites/default/civicrm/extensions/org.wikimedia.dedupetools/.editorconfig
@@ -0,0 +1,14 @@
+# Drupal editor configuration normalization
+# @see http://editorconfig.org/
+
+# This is the top-most .editorconfig file; do not search in parent directories.
+root = true
+
+# All files.
+[*]
+end_of_line = LF
+indent_style = space
+indent_size = 2
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
diff --git 
a/sites/default/civicrm/extensions/org.wikimedia.dedupetools/CRM/Dedupetools/BAO/MergeConflict.php
 
b/sites/default/civicrm/extensions/org.wikimedia.dedupetools/CRM/Dedupetools/BAO/MergeConflict.php
new file mode 100644
index 000..3e8a574
--- /dev/null
+++ 
b/sites/default/civicrm/extensions/org.wikimedia.dedupetools/CRM/Dedupetools/BAO/MergeConflict.php
@@ -0,0 +1,25 @@
+copyValues($params);
+$instance->save();
+CRM_Utils_Hook::post($hook, $entityName, $instance->id, $instance);
+
+return $instance;
+  } */
+
+}
diff --git 
a/sites/default/civicrm/extensions/org.wikimedia.dedupetools/CRM/Dedupetools/Form/Report/MergeConflict.mgd.php
 
b/sites/default/civicrm/extensions/org.wikimedia.dedupetools/CRM/Dedupetools/Form/Report/MergeConflict.mgd.php
new file mode 100644
index 000..556d6f5
--- /dev/null
+++ 
b/sites/default/civicrm/extensions/org.wikimedia.dedupetools/CRM/Dedupetools/Form/Report/MergeConflict.mgd.php
@@ -0,0 +1,21 @@
+http://wiki.civicrm.org/confluence/display/CRMDOC42/Hook+Reference
+return array (
+  0 => 
+  array (
+'name' => 'CRM_Dedupetools_Form_Report_MergeConflict',
+'entity' => 'ReportTemplate',
+'params' => 
+array (
+  'version' => 3,
+  'label' => 'MergeConflict',
+  'description' => 'MergeConflict (org.wikimedia.dedupetools)',
+  'class_name' => 'CRM_Dedupetools_Form_Report_MergeConflict',
+  'report_url' => 'org.wikimedia.dedupetools/mergeconflict',
+  'component' => '',
+),
+  ),
+);
diff --git 
a/sites/default/civicrm/extensions/org.wikimedia.dedupetools/CRM/Dedupetools/Form/Report/MergeConflict.php
 
b/sites/default/civicrm/extensions/org.wikimedia.dedupetools/CRM/Dedupetools/Form/Report/MergeConflict.php
new file mode 100644
index 000..d03d505
--- /dev/null
+++ 
b/sites/default/civicrm/extensions/org.wikimedia.dedupetools/CRM/Dedupetools/Form/Report/MergeConflict.php
@@ -0,0 +1,181 @@
+summaryOverlayProfileId = 
CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', 'summary_overlay', 'id', 
'name');
+
+$this->_columns = array(
+  'civicrm_merge_conflict' => array(
+'fields' => array(
+  'contact_1' => ar

[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Tidy up dedupe rules & install dedupetools.

2017-11-06 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/389651 )

Change subject: Tidy up dedupe rules & install dedupetools.
..

Tidy up dedupe rules & install dedupetools.

My thinking is to move our merge hooks etc into this extension. It contains the 
code
I used for analysing the dupes & now the code for extra links to dedupe

Bug: T177999
Change-Id: Iaa444cc7d232b0f74a19372a8d434f0adf34e4c0
---
M sites/all/modules/wmf_civicrm/wmf_civicrm.install
1 file changed, 39 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/51/389651/1

diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.install 
b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
index 5cb22e5..efbb9d1 100644
--- a/sites/all/modules/wmf_civicrm/wmf_civicrm.install
+++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
@@ -3228,4 +3228,43 @@
   $dao->update();
 }
   }
+
+  /**
+   * Tidy up our dedupe rules.
+   */
+  function wmf_civicrm_update_7560() {
+ CRM_Core_DAO::executeQuery("UPDATE civicrm_dedupe_rule_group SET name = 
'IndividualSupervised' WHERE name = 'Kaldari Rule-9'");
+ // This didn't cascade right in single query so 2 deletes.
+ CRM_Core_DAO::executeQuery("DELETE r FROM civicrm_dedupe_rule_group rg 
LEFT JOIN civicrm_dedupe_rule r ON r.dedupe_rule_group_id = rg.id WHERE name = 
'IndividualSupervised2_14'");
+CRM_Core_DAO::executeQuery("DELETE FROM civicrm_dedupe_rule_group WHERE 
name = 'IndividualSupervised2_14'");
+
+ $generalRules = CRM_Core_DAO::singleValueQuery(
+   "SELECT count(*) FROM civicrm_dedupe_rule_group WHERE used = 'General' 
AND is_reserved = 1 AND contact_type = 'Individual'"
+ );
+ if ($generalRules === 1) {
+   // We are probably on someone's dev environment. Goal here is to remove 
duff data from prod not mess with people (much).
+   return;
+ }
+CRM_Core_DAO::executeQuery("
+  DELETE r FROM civicrm_dedupe_rule_group rg
+  LEFT JOIN civicrm_dedupe_rule r ON r.dedupe_rule_group_id = rg.id
+  WHERE used = 'General' AND is_reserved = 1 AND contact_type = 
'Individual' AND rg.id IN(10,11)");
+CRM_Core_DAO::executeQuery("
+  DELETE FROM civicrm_dedupe_rule_group
+  WHERE used = 'General' AND is_reserved = 1 AND contact_type = 
'Individual' AND id IN(10,11)");
+
+  }
+
+  /**
+   * Enable dedupe tools.
+   *
+   * This extension is intended to be where our custom dedupe code gets 
transferred to.
+   *
+   * Bug: T177999
+   */
+  function wmf_civicrm_update_7565() {
+civicrm_initialize();
+civicrm_api3('extension', 'refresh', array());
+civicrm_api3('extension', 'install',  array('key' => 
'org.wikimedia.dedupetools'));
+  }
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaa444cc7d232b0f74a19372a8d434f0adf34e4c0
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[deployment]: Merge branch 'master' of https://gerrit.wikimedia.org/r/wiki...

2017-11-01 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/387876 )

Change subject: Merge branch 'master' of 
https://gerrit.wikimedia.org/r/wikimedia/fundraising/crm into deployment
..

Merge branch 'master' of 
https://gerrit.wikimedia.org/r/wikimedia/fundraising/crm into deployment

d37b628 Submodule update
f0ea364 Hack proximity search to support entering lat& long directly
a0959b3 CiviCRM submodule commit
0edfb9d CRM-21371 - An api error when calling drush cvapi should be treated 
as a drush error
47f6d10 Backport of formatting cleanup.
20ccb2a Remove a trailing space
98efead Fix for overwriting of start_time.
126683d Fix thrown exception in Omnimail.
9841cf7 Rename job_suffix to job_identifier.

Change-Id: Ie750fc07c9e8456a62972860142fc68401cf894d
---
0 files changed, 0 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/76/387876/1


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie750fc07c9e8456a62972860142fc68401cf894d
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: deployment
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Submodule update

2017-11-01 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/387874 )

Change subject: Submodule update
..

Submodule update

f0ea364 Hack proximity search to support entering lat& long directly

Change-Id: I2c1d963a3be8e3fc6444bc0631d0ca842ca9fdbc
---
M civicrm
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/74/387874/1

diff --git a/civicrm b/civicrm
index 0edfb9d..f0ea364 16
--- a/civicrm
+++ b/civicrm
@@ -1 +1 @@
-Subproject commit 0edfb9dffeb3dc5be994f08d945b55e1cfdbc495
+Subproject commit f0ea3643e3d34f77bbd4f3a11a1134fe1602fa2a

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2c1d963a3be8e3fc6444bc0631d0ca842ca9fdbc
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: CiviCRM submodule commit

2017-11-01 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/387868 )

Change subject: CiviCRM submodule commit
..

CiviCRM submodule commit

0edfb9d CRM-21371 - An api error when calling drush cvapi should be treated as 
a drush error
47f6d10 Backport of formatting cleanup.

Change-Id: I1c161dbd8cb6952a21530f030cb51118ef4fbbf1
---
M civicrm
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/68/387868/1

diff --git a/civicrm b/civicrm
index 98f3ea1..0edfb9d 16
--- a/civicrm
+++ b/civicrm
@@ -1 +1 @@
-Subproject commit 98f3ea1602c49fa72c767ab3d1a6654623523a74
+Subproject commit 0edfb9dffeb3dc5be994f08d945b55e1cfdbc495

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1c161dbd8cb6952a21530f030cb51118ef4fbbf1
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...civicrm[master]: Hack proximity search to support entering lat& long directly

2017-10-31 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/387770 )

Change subject: Hack proximity search to support entering lat& long directly
..

Hack proximity search to support entering lat& long directly

If we push this out I suggest we treat it as short-term until early next year & 
let it lapse when we
upgrade, possibly keeping the ticket open or opening another to figure out a 
more appropriate fix that
does not require a core hack

Bug: T179344
Change-Id: Ia3d29b8a8a048bdea27300cf4b75ce8b171923da
---
M CRM/Contact/Form/Search/Custom/Proximity.php
M templates/CRM/Contact/Form/Search/Custom/Proximity.tpl
2 files changed, 8 insertions(+), 53 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm/civicrm 
refs/changes/70/387770/1

diff --git a/CRM/Contact/Form/Search/Custom/Proximity.php 
b/CRM/Contact/Form/Search/Custom/Proximity.php
index 8375ade..d0f7a91 100644
--- a/CRM/Contact/Form/Search/Custom/Proximity.php
+++ b/CRM/Contact/Form/Search/Custom/Proximity.php
@@ -54,27 +54,8 @@
 unset($this->_formValues['operator']);
 
 if (!empty($this->_formValues)) {
-  // add the country and state
-  if (!empty($this->_formValues['country_id'])) {
-$this->_formValues['country'] = 
CRM_Core_PseudoConstant::country($this->_formValues['country_id']);
-  }
-
-  if (!empty($this->_formValues['state_province_id'])) {
-$this->_formValues['state_province'] = 
CRM_Core_PseudoConstant::stateProvince($this->_formValues['state_province_id']);
-  }
-
-  // use the address to get the latitude and longitude
-  CRM_Utils_Geocode_Google::format($this->_formValues);
-
-  if (!is_numeric(CRM_Utils_Array::value('geo_code_1', 
$this->_formValues)) ||
-!is_numeric(CRM_Utils_Array::value('geo_code_2', $this->_formValues)) 
||
-!isset($this->_formValues['distance'])
-  ) {
-CRM_Core_Error::fatal(ts('Could not geocode input'));
-  }
-
-  $this->_latitude = $this->_formValues['geo_code_1'];
-  $this->_longitude = $this->_formValues['geo_code_2'];
+  $this->_latitude = $this->_formValues['geocode_1'];
+  $this->_longitude = $this->_formValues['geocode_2'];
 
   if ($this->_formValues['prox_distance_unit'] == "miles") {
 $conversionFactor = 1609.344;
@@ -111,29 +92,9 @@
 $proxUnits = array('km' => ts('km'), 'miles' => ts('miles'));
 $form->add('select', 'prox_distance_unit', ts('Units'), $proxUnits, TRUE);
 
-$form->add('text',
-  'street_address',
-  ts('Street Address')
-);
+$form->add('text', 'geocode_1', ts('Latitude'), NULL, TRUE);
 
-$form->add('text',
-  'city',
-  ts('City')
-);
-
-$form->add('text',
-  'postal_code',
-  ts('Postal Code')
-);
-
-$defaults = array();
-if ($countryDefault) {
-  $defaults['country_id'] = $countryDefault;
-}
-$form->addChainSelect('state_province_id');
-
-$country = array('' => ts('- select -')) + 
CRM_Core_PseudoConstant::country();
-$form->add('select', 'country_id', ts('Country'), $country, TRUE, 
array('class' => 'crm-select2'));
+$form->add('text', 'geocode_2', ts('Longitude'), NULL, TRUE);
 
 $group = array('' => ts('- any group -')) + 
CRM_Core_PseudoConstant::nestedGroup();
 $form->addElement('select', 'group', ts('Group'), $group, array('class' => 
'crm-select2 huge'));
@@ -153,11 +114,8 @@
 $form->assign('elements', array(
   'distance',
   'prox_distance_unit',
-  'street_address',
-  'city',
-  'postal_code',
-  'country_id',
-  'state_province_id',
+  'geocode_1',
+  'geocode_2',
   'group',
   'tag',
 ));
diff --git a/templates/CRM/Contact/Form/Search/Custom/Proximity.tpl 
b/templates/CRM/Contact/Form/Search/Custom/Proximity.tpl
index 2382577..533a60c 100644
--- a/templates/CRM/Contact/Form/Search/Custom/Proximity.tpl
+++ b/templates/CRM/Contact/Form/Search/Custom/Proximity.tpl
@@ -36,11 +36,8 @@
 
{$form.distance.label}{$form.distance.html|crmAddClass:four}
 {$form.prox_distance_unit.html}
FROM...
-   {$form.street_address.label}{$form.street_address.html}
-   {$form.city.label}{$form.city.html}
-   {$form.postal_code.label}{$form.postal_code.html}
-   {$form.country_id.label}{$form.country_id.html}
-   {$form.state_province_id.label}{$form.state_province_id.html}
+   {$form.geocode_1.label}{$form.geocode_1.html}
+   {$form.geocode_2.label}{$form.geocode_2.html}
AND ...
{$form.group.label}{$form.group.html}
{$form.tag.label}{$form.tag.html}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia3d29b8a8a048bdea27300cf4b75ce8b171923da
Gerrit-PatchSet: 1
Gerrit-Project:

[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Remove a trailing space

2017-10-31 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/387764 )

Change subject: Remove a trailing space
..

Remove a trailing space

Change-Id: Idf7aea647142cf7f259b63270287be129f60509e
---
M 
sites/default/civicrm/extensions/org.wikimedia.omnimail/CRM/Omnimail/Omnirecipients.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/64/387764/1

diff --git 
a/sites/default/civicrm/extensions/org.wikimedia.omnimail/CRM/Omnimail/Omnirecipients.php
 
b/sites/default/civicrm/extensions/org.wikimedia.omnimail/CRM/Omnimail/Omnirecipients.php
index 4a0d91a..5e3fda0 100644
--- 
a/sites/default/civicrm/extensions/org.wikimedia.omnimail/CRM/Omnimail/Omnirecipients.php
+++ 
b/sites/default/civicrm/extensions/org.wikimedia.omnimail/CRM/Omnimail/Omnirecipients.php
@@ -13,7 +13,7 @@
 class CRM_Omnimail_Omnirecipients extends CRM_Omnimail_Omnimail{
 
   /**
-   * @var 
+   * @var
*/
   protected $request;
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idf7aea647142cf7f259b63270287be129f60509e
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Make tests more readable by using dates

2017-10-31 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/387765 )

Change subject: Make tests more readable by using dates
..

Make tests more readable by using dates

Bug: T179357

Change-Id: I462802f847d3ce9477aff9fd8e76ced38b450d74
---
M 
sites/default/civicrm/extensions/org.wikimedia.omnimail/tests/phpunit/OmnigroupmemberLoadTest.php
M 
sites/default/civicrm/extensions/org.wikimedia.omnimail/tests/phpunit/OmnimailBaseTestClass.php
M 
sites/default/civicrm/extensions/org.wikimedia.omnimail/tests/phpunit/OmnirecipientLoadTest.php
3 files changed, 44 insertions(+), 24 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/65/387765/1

diff --git 
a/sites/default/civicrm/extensions/org.wikimedia.omnimail/tests/phpunit/OmnigroupmemberLoadTest.php
 
b/sites/default/civicrm/extensions/org.wikimedia.omnimail/tests/phpunit/OmnigroupmemberLoadTest.php
index 237df9b..814e231 100644
--- 
a/sites/default/civicrm/extensions/org.wikimedia.omnimail/tests/phpunit/OmnigroupmemberLoadTest.php
+++ 
b/sites/default/civicrm/extensions/org.wikimedia.omnimail/tests/phpunit/OmnigroupmemberLoadTest.php
@@ -97,14 +97,14 @@
 $this->cleanupGroup($group);
 
 $this->assertEquals(array(
-  'last_timestamp' => '1487890800',
+  'last_timestamp' => '2017-02-23 11:00:00',
   'offset' => 2,
   'retrieval_parameters' => array(
 'jobId' => '101719657',
 'filePath' => '/download/20170509_noCID - All - Jul 5 2017 06-27-45 
AM.csv',
   ),
-  'progress_end_timestamp' => '1488495600',
-), $this->getJobSettings());
+  'progress_end_timestamp' => '2017-03-02 11:00:00',
+), $this->getUtcDateFormattedJobSettings());
 
   }
 
@@ -132,14 +132,14 @@
 $this->assertEquals(0, $groupMembers['count']);
 
 $this->assertEquals(array(
-  'last_timestamp' => '1487890800',
+  'last_timestamp' => '2017-02-23 11:00:00',
   'retrieval_parameters' => array(
 'jobId' => '101719657',
 'filePath' => '/download/20170509_noCID - All - Jul 5 2017 06-27-45 
AM.csv',
   ),
-  'progress_end_timestamp' => '1488495600',
+  'progress_end_timestamp' => '2017-03-02 11:00:00',
   'offset' => 0,
-), $this->getJobSettings());
+), $this->getUtcDateFormattedJobSettings());
 $this->cleanupGroup($group);
   }
 
@@ -176,14 +176,14 @@
 $this->assertEquals(0, $groupMembers['count']);
 
 $this->assertEquals(array(
-  'last_timestamp' => '1487890800',
+  'last_timestamp' => '2017-02-23 11:00:00',
   'retrieval_parameters' => array(
 'jobId' => '101719657',
 'filePath' => '/download/20170509_noCID - All - Jul 5 2017 06-27-45 
AM.csv',
   ),
-  'progress_end_timestamp' => '1488495600',
+  'progress_end_timestamp' => '2017-03-02 11:00:00',
   'offset' => 0,
-), $this->getJobSettings(array('mail_provider' => 'Silverpop', 
'job_identifier' => '_woot')));
+), $this->getUtcDateFormattedJobSettings(array('mail_provider' => 
'Silverpop', 'job_identifier' => '_woot')));
 $this->cleanupGroup($group);
   }
 
@@ -218,8 +218,8 @@
 $this->assertEquals(3, $groupMembers['count']);
 
 $this->assertEquals(array(
-  'last_timestamp' => '1488495600',
-), $this->getJobSettings(array('mail_provider' => 'Silverpop')));
+  'last_timestamp' => '2017-03-02 11:00:00',
+), $this->getUtcDateFormattedJobSettings(array('mail_provider' => 
'Silverpop')));
 $this->cleanupGroup($group);
   }
 
diff --git 
a/sites/default/civicrm/extensions/org.wikimedia.omnimail/tests/phpunit/OmnimailBaseTestClass.php
 
b/sites/default/civicrm/extensions/org.wikimedia.omnimail/tests/phpunit/OmnimailBaseTestClass.php
index 6e814e8..6830f14 100644
--- 
a/sites/default/civicrm/extensions/org.wikimedia.omnimail/tests/phpunit/OmnimailBaseTestClass.php
+++ 
b/sites/default/civicrm/extensions/org.wikimedia.omnimail/tests/phpunit/OmnimailBaseTestClass.php
@@ -82,7 +82,7 @@
   protected function createSetting($values) {
 foreach (array('last_timestamp', 'progress_end_timestamp') as $dateField) {
   if (!empty($values[$dateField])) {
-$values[$dateField] = date('YmdHis', $values[$dateField]);
+$values[$dateField] = gmdate('YmdHis', $values[$dateField]);
   }
 }
 try {
@@ -92,4 +92,23 @@
   $this->fail(print_r($values, 1), $e->getMessage() . 
$e->getTraceAsString() . print_r($e->getExtraParams(), TRUE));
 }
   }
+
+  /**
+   * Get job settings with dates rendered to UTC string.
+   *
+   * @param array $params
+   *
+   * @return array
+   */
+  public function getUtcDateFormattedJobSettings($params = 
array('mail_provider' => 'Silverpop')) {
+ $settings = $this->getJobSettings($params);
+ $dateFields = array('last_timestamp', 'progress_end_timestamp');
+ foreach ($dateFields as $dateField) {
+   if (!empty($settings[$dateField])) {
+ $setting

[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Fix for overwriting of start_time.

2017-10-31 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/387748 )

Change subject: Fix for overwriting of start_time.
..

Fix for overwriting of start_time.

On investigation I found the timezone was not problematic but the start time
was being overwritten.

Bug: T179357
Change-Id: I8ef3814c5b1a983116e57db7c62b18bf9b874eb7
---
M 
sites/default/civicrm/extensions/org.wikimedia.omnimail/CRM/Omnimail/Omnimail.php
1 file changed, 14 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/48/387748/1

diff --git 
a/sites/default/civicrm/extensions/org.wikimedia.omnimail/CRM/Omnimail/Omnimail.php
 
b/sites/default/civicrm/extensions/org.wikimedia.omnimail/CRM/Omnimail/Omnimail.php
index 9c023bb..67e57d7 100644
--- 
a/sites/default/civicrm/extensions/org.wikimedia.omnimail/CRM/Omnimail/Omnimail.php
+++ 
b/sites/default/civicrm/extensions/org.wikimedia.omnimail/CRM/Omnimail/Omnimail.php
@@ -27,6 +27,11 @@
   public $endTimeStamp;
 
   /**
+   * @var string
+   */
+  public $startTimeStamp;
+
+  /**
* @var int
*/
   protected $offset;
@@ -99,13 +104,16 @@
* @return string
*/
   public function getStartTimestamp($params) {
-if (isset($params['start_date'])) {
-  return strtotime($params['start_date']);
+if (!$this->startTimeStamp) {
+  if (isset($params['start_date'])) {
+$this->startTimeStamp = strtotime($params['start_date']);
+  }
+  if (!empty($this->jobSettings['last_timestamp'])) {
+$this->startTimeStamp = $this->jobSettings['last_timestamp'];
+  }
+  $this->startTimeStamp = strtotime('450 days ago');
 }
-if (!empty($this->jobSettings['last_timestamp'])) {
-  return $this->jobSettings['last_timestamp'];
-}
-return strtotime('450 days ago');
+return $this->startTimeStamp;
   }
 
   /**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8ef3814c5b1a983116e57db7c62b18bf9b874eb7
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Fix thrown exception in Omnimail.

2017-10-30 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/387515 )

Change subject: Fix thrown exception in Omnimail.
..

Fix thrown exception in Omnimail.

The CiviCRM_API3_Exception is what the wrapper throws. The API_Exception is 
correct for api functions.

Bug: T175394
Change-Id: I253e16fab64da220e029213dd712ca27131994ab
---
M 
sites/default/civicrm/extensions/org.wikimedia.omnimail/CRM/Omnimail/Omnirecipients.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/15/387515/1

diff --git 
a/sites/default/civicrm/extensions/org.wikimedia.omnimail/CRM/Omnimail/Omnirecipients.php
 
b/sites/default/civicrm/extensions/org.wikimedia.omnimail/CRM/Omnimail/Omnirecipients.php
index 32b5e4f..4a0d91a 100644
--- 
a/sites/default/civicrm/extensions/org.wikimedia.omnimail/CRM/Omnimail/Omnirecipients.php
+++ 
b/sites/default/civicrm/extensions/org.wikimedia.omnimail/CRM/Omnimail/Omnirecipients.php
@@ -47,7 +47,7 @@
 }
 elseif ($startTimestamp) {
   if ($this->endTimeStamp < $startTimestamp) {
-throw new CiviCRM_API3_Exception(ts("End timestamp: " . date('Y-m-d 
H:i:s', $this->endTimeStamp) . " is before " . "Start timestamp: " . 
date('Y-m-d H:i:s', $startTimestamp)));
+throw new API_Exception(ts("End timestamp: " . date('Y-m-d H:i:s', 
$this->endTimeStamp) . " is before " . "Start timestamp: " . date('Y-m-d 
H:i:s', $startTimestamp)));
   }
   $request->setStartTimeStamp($startTimestamp);
   $request->setEndTimeStamp($this->endTimeStamp);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I253e16fab64da220e029213dd712ca27131994ab
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Rename job_suffix to job_identifier.

2017-10-30 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/387512 )

Change subject: Rename job_suffix to job_identifier.
..

Rename job_suffix to job_identifier.

I didn't rename originally to reduce changes but have already made a mistake 
assuming the wrong
key so updating. Job is currently disabled, and no other jobs use it.

Bug: T175394
Change-Id: If22421bcb161610192416c92da0433aea053a0c4
---
M 
sites/default/civicrm/extensions/org.wikimedia.omnimail/CRM/Omnimail/Omnimail.php
M 
sites/default/civicrm/extensions/org.wikimedia.omnimail/api/v3/Omnigroupmember/Load.php
M 
sites/default/civicrm/extensions/org.wikimedia.omnimail/api/v3/Omnirecipient/Load.php
M 
sites/default/civicrm/extensions/org.wikimedia.omnimail/tests/phpunit/OmnigroupmemberLoadTest.php
M 
sites/default/civicrm/extensions/org.wikimedia.omnimail/tests/phpunit/OmnirecipientLoadTest.php
5 files changed, 14 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/12/387512/1

diff --git 
a/sites/default/civicrm/extensions/org.wikimedia.omnimail/CRM/Omnimail/Omnimail.php
 
b/sites/default/civicrm/extensions/org.wikimedia.omnimail/CRM/Omnimail/Omnimail.php
index b4bed7c..9c023bb 100644
--- 
a/sites/default/civicrm/extensions/org.wikimedia.omnimail/CRM/Omnimail/Omnimail.php
+++ 
b/sites/default/civicrm/extensions/org.wikimedia.omnimail/CRM/Omnimail/Omnimail.php
@@ -49,7 +49,7 @@
   /**
* @var string
*/
-  protected $job_suffix;
+  protected $job_identifier;
 
   /**
* @var string
@@ -63,7 +63,7 @@
* @throws \API_Exception
*/
   public function __construct($params) {
-$this->job_suffix = !empty($params['job_suffix']) ? $params['job_suffix'] 
: NULL;
+$this->job_identifier = !empty($params['job_identifier']) ? 
$params['job_identifier'] : NULL;
 $this->mail_provider = $params['mail_provider'];
 $this->settings = CRM_Omnimail_Helper::getSettings();
 $this->setJobSettings($params);
@@ -172,14 +172,14 @@
 $this->jobSettings = array(
   'mailing_provider' => $params['mail_provider'],
   'job' => 'omnimail_' . $this->job . '_load',
-  'job_identifier' => $this->job_suffix ? : NULL,
+  'job_identifier' => $this->job_identifier ? : NULL,
 );
 $savedSettings = civicrm_api3('OmnimailJobProgress', 'get', 
$this->jobSettings);
 
 if ($savedSettings['count']) {
   foreach ($savedSettings['values'] as $savedSetting) {
 // filter for job_identifier since NULL will not have been respected.
-if (CRM_Utils_Array::value('job_identifier', $savedSetting) === 
$this->job_suffix) {
+if (CRM_Utils_Array::value('job_identifier', $savedSetting) === 
$this->job_identifier) {
   foreach (array('last_timestamp', 'progress_end_timestamp') as 
$dateField) {
 if (isset($savedSetting[$dateField])) {
   $savedSetting[$dateField] = strtotime($savedSetting[$dateField]);
diff --git 
a/sites/default/civicrm/extensions/org.wikimedia.omnimail/api/v3/Omnigroupmember/Load.php
 
b/sites/default/civicrm/extensions/org.wikimedia.omnimail/api/v3/Omnigroupmember/Load.php
index 2030fef..63dfd5f 100644
--- 
a/sites/default/civicrm/extensions/org.wikimedia.omnimail/api/v3/Omnigroupmember/Load.php
+++ 
b/sites/default/civicrm/extensions/org.wikimedia.omnimail/api/v3/Omnigroupmember/Load.php
@@ -227,9 +227,9 @@
 'type' => CRM_Utils_Type::T_INT,
 'api.default' => 60,
   );
-  $params['job_suffix'] = array(
-'title' => ts('A suffix string to add to job-specific settings.'),
-'description' => ts('The suffix allows for multiple settings to be stored 
for one job. For example if wishing to run an up-top-date job and a catch-up 
job'),
+  $params['job_identifier'] = array(
+'title' => ts('An identifier string to add to job-specific settings.'),
+'description' => ts('The identifier allows for multiple settings to be 
stored for one job. For example if wishing to run an up-top-date job and a 
catch-up job'),
 'type' => CRM_Utils_Type::T_STRING,
 'api.default' => '',
   );
diff --git 
a/sites/default/civicrm/extensions/org.wikimedia.omnimail/api/v3/Omnirecipient/Load.php
 
b/sites/default/civicrm/extensions/org.wikimedia.omnimail/api/v3/Omnirecipient/Load.php
index 8a181aa..aeb25a8 100644
--- 
a/sites/default/civicrm/extensions/org.wikimedia.omnimail/api/v3/Omnirecipient/Load.php
+++ 
b/sites/default/civicrm/extensions/org.wikimedia.omnimail/api/v3/Omnirecipient/Load.php
@@ -192,9 +192,9 @@
 'type' => CRM_Utils_Type::T_INT,
 'api.default' => 300,
   );
-  $params['job_suffix'] = array(
-'title' => ts('A suffix string to add to job-specific settings.'),
-'description' => ts('The suffix allows for multiple settings to be stored 
for one job. For example if wishing to run an up-top-date job and a catch-up 
job'),
+  $params['job_identifier'] = array(
+'title' => ts('A string to id

[MediaWiki-commits] [Gerrit] wikimedia...civicrm[master]: CRM-21371 - An api error when calling drush cvapi should be ...

2017-10-30 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/387508 )

Change subject: CRM-21371 - An api error when calling drush cvapi should be 
treated as a drush error
..

CRM-21371 - An api error when calling drush cvapi should be treated as a drush 
error

Also defines a used var and removes legacy svn id refs

Bug : T179358

Change-Id: I61709f40b35525986974c1b0fccd7b310091413e
---
M drupal/drush/civicrm.drush.inc
1 file changed, 7 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm/civicrm 
refs/changes/08/387508/1

diff --git a/drupal/drush/civicrm.drush.inc b/drupal/drush/civicrm.drush.inc
index 72c4c49..94d31fa 100644
--- a/drupal/drush/civicrm.drush.inc
+++ b/drupal/drush/civicrm.drush.inc
@@ -29,12 +29,7 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2017
- * $Id$
- *
  */
-
-// $Id: example.drush.inc,v 1.5 2009/09/30 13:15:54 weitzman Exp $
-
 
 /**
  * @file
@@ -1521,7 +1516,8 @@
   array_shift($args);
 
   // Parse $params
-  switch (drush_get_option('in', 'args')) {
+  $format = drush_get_option('in', 'args');
+  switch ($format) {
 case 'args':
   $params = $DEFAULTS;
   foreach ($args as $arg) {
@@ -1553,8 +1549,12 @@
   );
 
   $result = civicrm_api($entity, $action, $params);
+  if (!empty($result['is_error'])) {
+drush_set_error('CIVICRM api error', $result['error_message']);
+  }
 
-  switch (drush_get_option('out', 'pretty')) {
+  $format = drush_get_option('out', 'pretty');
+  switch ($format) {
 case 'pretty':
   drush_print_r($result);
   break;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I61709f40b35525986974c1b0fccd7b310091413e
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm/civicrm
Gerrit-Branch: master
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...civicrm[master]: Backport of formatting cleanup.

2017-10-30 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/387507 )

Change subject: Backport of formatting cleanup.
..

Backport of formatting cleanup.

commit 1624d3f637840248994c1480707c0979298ff4df
Author: Seamus Lee 
Date:   Sun Aug 27 12:03:46 2017 +1000

Lint civicrm.drush.inc

Backported this from https://github.com/civicrm/civicrm-drupal/pull/473
to keep the following commit cleaner

Change-Id: Ia9792ce1c4902a77a8535a1a3251fa8a6d3b
---
M drupal/drush/civicrm.drush.inc
1 file changed, 102 insertions(+), 121 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm/civicrm 
refs/changes/07/387507/1

diff --git a/drupal/drush/civicrm.drush.inc b/drupal/drush/civicrm.drush.inc
index c9a73ca..72c4c49 100644
--- a/drupal/drush/civicrm.drush.inc
+++ b/drupal/drush/civicrm.drush.inc
@@ -23,7 +23,7 @@
  | GNU Affero General Public License or the licensing of CiviCRM, |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing|
  ++
-*/
+ */
 
 /**
  *
@@ -49,7 +49,7 @@
  */
 
 /**
- * Implementation of hook_drush_command().
+ * Implements hook_drush_command().
  *
  * In this hook, you specify which commands your
  * drush module makes available, what it does and
@@ -60,8 +60,6 @@
  *
  * @See drush_parse_command() for a list of recognized keys.
  *
- * @return
- *   An associative array describing your command(s).
  */
 function civicrm_drush_command() {
   $items = array();
@@ -69,8 +67,7 @@
   // the key in the $items array is the name of the command.
   $items['civicrm-api'] = array(
 'description' => 'CLI access to CiviCRM APIs. It can return pretty-printor 
json formatted data.',
-'examples' =>
-array(
+'examples' => array(
   'drush civicrm-api contact.create first_name=John last_name=Doe 
contact_type=Individual' => 'Create a new contact named John Doe',
   'drush civicrm-api contact.create id=1 --out=json' => 'Find/display a 
contact in JSON format',
 ),
@@ -82,8 +79,7 @@
   );
   $items['civicrm-install'] = array(
 'description' => "Install a new instance of CiviCRM.",
-'options' =>
-array(
+'options' => array(
   'dbuser' => 'MySQL username for your Drupal/CiviCRM database.',
   'dbpass' => 'MySQL password for your Drupal/CiviCRM database.',
   'dbhost' => 'MySQL host for your Drupal/CiviCRM database. Defaults to 
localhost.',
@@ -145,10 +141,8 @@
   );
   $items['civicrm-update-cfg'] = array(
 'description' => "Update config_backend to correct config settings, 
especially when the CiviCRM site has been cloned / migrated.",
-'examples' =>
-array(
-  'drush -l http://example.com/civicrm civicrm-update-cfg' =>
-  'Update config_backend to correct config settings for civicrm 
installation on example.com site.',
+'examples' => array(
+  'drush -l http://example.com/civicrm civicrm-update-cfg' => 'Update 
config_backend to correct config settings for civicrm installation on 
example.com site.',
 ),
 'aliases' => array('cvupcfg'),
   );
@@ -157,45 +151,32 @@
   );
   $items['civicrm-upgrade'] = array(
 'description' => "Replace CiviCRM codebase with new specified tarfile and 
upgrade database by executing the CiviCRM upgrade process - 
civicrm/upgrade?reset=1.",
-'examples' =>
-array(
-  'drush civicrm-upgrade --tarfile=~/tarballs/civicrm-4.1.2-drupal.tar.gz' 
=>
-  'Replace old CiviCRM codebase with new v4.1.2 and run upgrade process.',
+'examples' => array(
+  'drush civicrm-upgrade --tarfile=~/tarballs/civicrm-4.1.2-drupal.tar.gz' 
=> 'Replace old CiviCRM codebase with new v4.1.2 and run upgrade process.',
 ),
-'options' =>
-array(
-  'tarfile' =>
-  'Path of new CiviCRM tarfile, with which current CiviCRM codebase is to 
be replaced.',
-  'backup-dir' =>
-  'Specify a directory to backup current CiviCRM codebase and database 
into, defaults to a backup directory above your Drupal root.',
+'options' => array(
+  'tarfile' => 'Path of new CiviCRM tarfile, with which current CiviCRM 
codebase is to be replaced.',
+  'backup-dir' => 'Specify a directory to backup current CiviCRM codebase 
and database into, defaults to a backup directory above your Drupal root.',
 ),
 'aliases' => array('cvup'),
   );
   $items['civicrm-restore'] = array(
 'description' => 'Restore CiviCRM codebase and database back from the 
specified backup directory.',
-'examples' =>
-array(
-  'drush civicrm-restore --restore-dir=../backup/modules/20100309200249' =>
-  'Replace current civicrm codebase with the $restore-dir/civicrm 
codebase, and reload the database with $restore-dir/civicrm.sql file',
+'examples' => array(
+  'drush civicrm-restore --restore-dir=../backup/modules/20100309200249' 
=> 'Replace current civicrm 

[MediaWiki-commits] [Gerrit] wikimedia...crm[deployment]: Merge branch 'master' of https://gerrit.wikimedia.org/r/wiki...

2017-10-30 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/387365 )

Change subject: Merge branch 'master' of 
https://gerrit.wikimedia.org/r/wikimedia/fundraising/crm into deployment
..

Merge branch 'master' of 
https://gerrit.wikimedia.org/r/wikimedia/fundraising/crm into deployment

9497022 Update CiviCRM submodule
98f3ea1 Revert "CRM-21302 honestly we do all this for nothing, really?"
c0e414d CRM-21302 honestly we do all this for nothing, really?
27c5e47 CRM-21303 fix:dedupe conflicts screen, not all rows visible
53307b2 CRM-21291 remove obsolete code from dedupe.
867f4ca CRM-21304 quash form reload message when refreshing
a25dc24 CRM-21294 Fix js error on dedupe find screen.

37ab362 Fix contacts with multiple primary addresses
2113e55 Always delete 'worse' address
3a4c195 Add link directly to contribution
2b3019f Revert "Log a stack trace for all dedupe queries"
c5de980 blacklist polyfill-php54, update donation-interface
9e1f196 Drush command to delete extraneous log_setting entries.
c08d2c3 Upgrader for switching omnimail job
24d3012 Switch over to new table & entity to track omnimail job progress
c94b61c Switch Omnimail job progress tracking to it's own table.
3419165 Test consolidation in prep for switching away from setting
438e79b Update CiviCRM submodule
   5f31c22 CRM-21324 - Support 'null' on date fields in the api

Change-Id: I49384e78db1cabd5c07299c13beeaf4ee7c5a93c
---
D sites/all/modules/wmf_civicrm/tests/phpunit/MergeTest.php
1 file changed, 0 insertions(+), 1,876 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/65/387365/1

diff --git a/sites/all/modules/wmf_civicrm/tests/phpunit/MergeTest.php 
b/sites/all/modules/wmf_civicrm/tests/phpunit/MergeTest.php
deleted file mode 100644
index d0ac11b..000
--- a/sites/all/modules/wmf_civicrm/tests/phpunit/MergeTest.php
+++ /dev/null
@@ -1,1876 +0,0 @@
-<<< HEAD   (25c7a3 More debugging for orphan rectifier)
-===
-imitateAdminUser();
-$this->doDuckHunt();
-// Run through the merge first to make sure there aren't pre-existing 
contacts in the DB
-// that will ruin the tests.
-$this->callAPISuccess('Job', 'process_batch_merge', array('mode' => 
'safe'));
-
-$this->contactID = 
$this->breedDuck(array(wmf_civicrm_get_custom_field_name('do_not_solicit') => 
0));
-$this->contactID2 = 
$this->breedDuck(array(wmf_civicrm_get_custom_field_name('do_not_solicit') => 
1));
-  }
-
-  public function tearDown() {
-$this->callAPISuccess('Contribution', 'get', array(
-  'contact_id' => array('IN' => array($this->contactID, 
$this->contactID2)),
-  'api.Contribution.delete' => 1,
-));
-$this->callAPISuccess('Contact', 'delete', array('id' => 
$this->contactID));
-$this->callAPISuccess('Contact', 'delete', array('id' => 
$this->contactID2));
-parent::tearDown();
-  }
-
-  /**
-   * Test that the merge hook causes our custom fields to not be treated as 
conflicts.
-   *
-   * We also need to check the custom data fields afterwards.
-   */
-  public function testMergeHook() {
-$this->callAPISuccess('Contribution', 'create', array(
-  'contact_id' => $this->contactID,
-  'financial_type_id' => 'Cash',
-  'total_amount' => 10,
-  'currency' => 'USD',
-  // Should cause 'is_2014 to be true.
-  'receive_date' => '2014-08-04',
-  wmf_civicrm_get_custom_field_name('original_currency') => 'NZD',
-  wmf_civicrm_get_custom_field_name('original_amount') => 8,
-));
-$this->callAPISuccess('Contribution', 'create', array(
-  'contact_id' => $this->contactID2,
-  'financial_type_id' => 'Cash',
-  'total_amount' => 5,
-  'currency' => 'USD',
-  // Should cause 'is_2012_donor to be true.
-  'receive_date' => '2013-01-04',
-));
-$this->callAPISuccess('Contribution', 'create', array(
-  'contact_id' => $this->contactID2,
-  'financial_type_id' => 'Cash',
-  'total_amount' => 9,
-  'currency' => 'NZD',
-  // Should cause 'is_2015_donor to be true.
-  'receive_date' => '2016-04-04',
-));
-$contact = $this->callAPISuccess('Contact', 'get', array(
-  'id' => $this->contactID,
-  'sequential' => 1,
-  'return' => 
array(wmf_civicrm_get_custom_field_name('lifetime_usd_total'), 
wmf_civicrm_get_custom_field_name('do_not_solicit')),
-));
-$this->assertEquals(10, 
$contact['values'][0][wmf_civicrm_get_custom_field_name('lifetime_usd_total')]);
-$result = $this->callAPISuccess('Job', 'process_batch_merge', array(
-  'criteria' => array('contact' => array('id' => array('IN' => 
array($this->contactID, $this->contactID2,
-));
-$this->assertEquals(1, count($result['values']['merged']));
-$contact = $this->callAPISuccess('Contact', 'get', array(
-  'id' => $this->contactID,
-  'sequential' => 1,
-  'return' => arra

[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Update CiviCRM submodule

2017-10-30 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/387360 )

Change subject: Update CiviCRM submodule
..

Update CiviCRM submodule

98f3ea1 Revert "CRM-21302 honestly we do all this for nothing, really?"
c0e414d CRM-21302 honestly we do all this for nothing, really?
27c5e47 CRM-21303 fix:dedupe conflicts screen, not all rows visible
53307b2 CRM-21291 remove obsolete code from dedupe.
867f4ca CRM-21304 quash form reload message when refreshing
a25dc24 CRM-21294 Fix js error on dedupe find screen.

Change-Id: I8dfbd948e272c33129f1b305df427e98a08b482c
---
M civicrm
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/60/387360/1

diff --git a/civicrm b/civicrm
index 5f31c22..98f3ea1 16
--- a/civicrm
+++ b/civicrm
@@ -1 +1 @@
-Subproject commit 5f31c22abe00eda2d46d17e6a00c575596628eba
+Subproject commit 98f3ea1602c49fa72c767ab3d1a6654623523a74

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8dfbd948e272c33129f1b305df427e98a08b482c
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...civicrm[master]: Revert "CRM-21302 honestly we do all this for nothing, really?"

2017-10-19 Thread Eileen (Code Review)
Hello Mepps, jenkins-bot, Ejegg,

I'd like you to do a code review.  Please visit

https://gerrit.wikimedia.org/r/385298

to review the following change.


Change subject: Revert "CRM-21302 honestly we do all this for nothing, really?"
..

Revert "CRM-21302 honestly we do all this for nothing, really?"

This reverts commit c0e414d28764b354b2839fe0e2b6d479c7428a39.

Reverting as with further digging I understand why this didn't work for John K 
& need to think more

Change-Id: Ia6f7ca680c5b1a565bd914e730161978c68d7299
---
M CRM/Contact/Page/DedupeFind.php
1 file changed, 28 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm/civicrm 
refs/changes/98/385298/1

diff --git a/CRM/Contact/Page/DedupeFind.php b/CRM/Contact/Page/DedupeFind.php
index 2e394bc..db1d263 100644
--- a/CRM/Contact/Page/DedupeFind.php
+++ b/CRM/Contact/Page/DedupeFind.php
@@ -155,18 +155,36 @@
 CRM_Dedupe_Merger::resetMergeStats($cacheKeyString);
   }
 
-  $urlQry['action'] = 'update';
-  if ($this->_cid) {
-// @todo passing cid to this form doesn't really seem to be valid - 
legacy cruft?
-$urlQry['cid'] = $this->_cid;
-
CRM_Core_Session::singleton()->pushUserContext(CRM_Utils_System::url('civicrm/contact/deduperules',
-  $urlQry
-));
+  $this->_mainContacts = CRM_Dedupe_Merger::getDuplicatePairs($rgid, $gid, 
!$isConflictMode, 0, $isSelected, '', $isConflictMode, $criteria, TRUE, $limit);
+
+  if (empty($this->_mainContacts)) {
+if ($isConflictMode) {
+  // if the current screen was intended to list only selected 
contacts, move back to full dupe list
+  $urlQry['action'] = 'update';
+  unset($urlQry['snippet']);
+  
CRM_Utils_System::redirect(CRM_Utils_System::url(CRM_Utils_System::currentPath(),
 $urlQry));
+}
+$ruleGroupName = civicrm_api3('RuleGroup', 'getvalue', array('id' => 
$rgid, 'return' => 'name'));
+CRM_Core_Session::singleton()->setStatus(ts('No possible duplicates 
were found using %1 rule.', array(1 => $ruleGroupName)), ts('None Found'), 
'info');
+$url = CRM_Utils_System::url('civicrm/contact/deduperules', 'reset=1');
+if ($context == 'search') {
+  $url = CRM_Core_Session::singleton()->readUserContext();
+}
+CRM_Utils_System::redirect($url);
   }
   else {
-
CRM_Core_Session::singleton()->pushUserContext(CRM_Utils_System::url('civicrm/contact/dedupefind',
-  $urlQry
-));
+$urlQry['action'] = 'update';
+if ($this->_cid) {
+  $urlQry['cid'] = $this->_cid;
+  
CRM_Core_Session::singleton()->pushUserContext(CRM_Utils_System::url('civicrm/contact/deduperules',
+$urlQry
+  ));
+}
+else {
+  
CRM_Core_Session::singleton()->pushUserContext(CRM_Utils_System::url('civicrm/contact/dedupefind',
+$urlQry
+  ));
+}
   }
 
   $this->assign('action', $this->action);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia6f7ca680c5b1a565bd914e730161978c68d7299
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm/civicrm
Gerrit-Branch: master
Gerrit-Owner: Eileen 
Gerrit-Reviewer: Ejegg 
Gerrit-Reviewer: Mepps 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] wikimedia...civicrm[master]: CRM-21303 fix:dedupe conflicts screen, not all rows visible

2017-10-18 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/385129 )

Change subject: CRM-21303 fix:dedupe conflicts screen, not all rows visible
..

CRM-21303 fix:dedupe conflicts screen, not all rows visible

https://github.com/civicrm/civicrm-core/pull/11121

Bug: T177873
Change-Id: Ib24aa8835599f8ae3032e41fc18fe29f82d56536
---
M templates/CRM/Contact/Page/DedupeFind.tpl
1 file changed, 2 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm/civicrm 
refs/changes/29/385129/1

diff --git a/templates/CRM/Contact/Page/DedupeFind.tpl 
b/templates/CRM/Contact/Page/DedupeFind.tpl
index 446773e..9aa33ba 100644
--- a/templates/CRM/Contact/Page/DedupeFind.tpl
+++ b/templates/CRM/Contact/Page/DedupeFind.tpl
@@ -166,6 +166,8 @@
 "url": {/literal}'{$sourceUrl}'{literal}
   },
   "retrieve": true,
+  "processing": true,
+  "serverSide": true,
   rowCallback: function (row, data) {
 // Set the checked state of the checkbox in the table
 $('input.crm-dedupe-select', row).prop('checked', data.is_selected == 
1);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib24aa8835599f8ae3032e41fc18fe29f82d56536
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm/civicrm
Gerrit-Branch: master
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...civicrm[master]: CRM-21291 remove obsolete code from dedupe.

2017-10-18 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/385128 )

Change subject: CRM-21291 remove obsolete code from dedupe.
..

CRM-21291 remove obsolete code from dedupe.

As confirmed by Jamie this code is no longer in use

Merged upstream
https://github.com/civicrm/civicrm-core/pull/6

Bug: T177873
Change-Id: Iccc254cbaa9eab322a3b08008eb0d39cb5ea62d1
---
M templates/CRM/Contact/Page/DedupeFind.tpl
1 file changed, 1 insertion(+), 17 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm/civicrm 
refs/changes/28/385128/1

diff --git a/templates/CRM/Contact/Page/DedupeFind.tpl 
b/templates/CRM/Contact/Page/DedupeFind.tpl
index a31aa71..446773e 100644
--- a/templates/CRM/Contact/Page/DedupeFind.tpl
+++ b/templates/CRM/Contact/Page/DedupeFind.tpl
@@ -116,22 +116,6 @@
 
 
   
-  {if $cid}
-
-  {ts 
1=$main_contacts[$cid]}Merge %1 with{/ts}
-  {foreach from=$dupe_contacts[$cid] item=dupe_name key=dupe_id}
-{if $dupe_name}
-  {capture assign=link}{$dupe_name}{/capture}
-  {capture assign=merge}{ts}merge{/ts}{/capture}
-  
-  {$link}
-  {$merge}
-  {ts}not a duplicate{/ts}
-  
-{/if}
-  {/foreach}
-
-  {/if}
 
 
 {if $context eq 'search'}
@@ -190,7 +174,7 @@
 }
 // for action column at the last, set nowrap
 $('td:last', row).attr('nowrap','nowrap');
-// for conflcts column
+// for conflicts column
 var col = CRM.$('table#dupePairs thead 
th.crm-contact-conflicts').index();
 $('td:eq(' + col + ')', row).attr('nowrap','nowrap');
   }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iccc254cbaa9eab322a3b08008eb0d39cb5ea62d1
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm/civicrm
Gerrit-Branch: master
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...civicrm[master]: CRM-21302 honestly we do all this for nothing, really?

2017-10-18 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/385130 )

Change subject: CRM-21302 honestly we do all this for nothing, really?
..

CRM-21302 honestly we do all this for nothing, really?

https://github.com/civicrm/civicrm-core/pull/11120
(not yet reviewed upstream)

Bug:T177873
Change-Id: I657dd2758426fb9b328077e33727287c83d10602
---
M CRM/Contact/Page/DedupeFind.php
1 file changed, 10 insertions(+), 28 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm/civicrm 
refs/changes/30/385130/1

diff --git a/CRM/Contact/Page/DedupeFind.php b/CRM/Contact/Page/DedupeFind.php
index db1d263..2e394bc 100644
--- a/CRM/Contact/Page/DedupeFind.php
+++ b/CRM/Contact/Page/DedupeFind.php
@@ -155,36 +155,18 @@
 CRM_Dedupe_Merger::resetMergeStats($cacheKeyString);
   }
 
-  $this->_mainContacts = CRM_Dedupe_Merger::getDuplicatePairs($rgid, $gid, 
!$isConflictMode, 0, $isSelected, '', $isConflictMode, $criteria, TRUE, $limit);
-
-  if (empty($this->_mainContacts)) {
-if ($isConflictMode) {
-  // if the current screen was intended to list only selected 
contacts, move back to full dupe list
-  $urlQry['action'] = 'update';
-  unset($urlQry['snippet']);
-  
CRM_Utils_System::redirect(CRM_Utils_System::url(CRM_Utils_System::currentPath(),
 $urlQry));
-}
-$ruleGroupName = civicrm_api3('RuleGroup', 'getvalue', array('id' => 
$rgid, 'return' => 'name'));
-CRM_Core_Session::singleton()->setStatus(ts('No possible duplicates 
were found using %1 rule.', array(1 => $ruleGroupName)), ts('None Found'), 
'info');
-$url = CRM_Utils_System::url('civicrm/contact/deduperules', 'reset=1');
-if ($context == 'search') {
-  $url = CRM_Core_Session::singleton()->readUserContext();
-}
-CRM_Utils_System::redirect($url);
+  $urlQry['action'] = 'update';
+  if ($this->_cid) {
+// @todo passing cid to this form doesn't really seem to be valid - 
legacy cruft?
+$urlQry['cid'] = $this->_cid;
+
CRM_Core_Session::singleton()->pushUserContext(CRM_Utils_System::url('civicrm/contact/deduperules',
+  $urlQry
+));
   }
   else {
-$urlQry['action'] = 'update';
-if ($this->_cid) {
-  $urlQry['cid'] = $this->_cid;
-  
CRM_Core_Session::singleton()->pushUserContext(CRM_Utils_System::url('civicrm/contact/deduperules',
-$urlQry
-  ));
-}
-else {
-  
CRM_Core_Session::singleton()->pushUserContext(CRM_Utils_System::url('civicrm/contact/dedupefind',
-$urlQry
-  ));
-}
+
CRM_Core_Session::singleton()->pushUserContext(CRM_Utils_System::url('civicrm/contact/dedupefind',
+  $urlQry
+));
   }
 
   $this->assign('action', $this->action);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I657dd2758426fb9b328077e33727287c83d10602
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm/civicrm
Gerrit-Branch: master
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...civicrm[master]: CRM-21304 quash form reload message when refreshing

2017-10-18 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/385124 )

Change subject: CRM-21304 quash form reload message when refreshing
..

CRM-21304 quash form reload message when refreshing

https://github.com/civicrm/civicrm-core/pull/11122

Bug:T177873
Change-Id: Ib3cbb754b77720687fcb47f53e02bf798f751dfb
---
M templates/CRM/Contact/Page/DedupeFind.tpl
1 file changed, 1 insertion(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm/civicrm 
refs/changes/24/385124/1

diff --git a/templates/CRM/Contact/Page/DedupeFind.tpl 
b/templates/CRM/Contact/Page/DedupeFind.tpl
index df90aa0..a31aa71 100644
--- a/templates/CRM/Contact/Page/DedupeFind.tpl
+++ b/templates/CRM/Contact/Page/DedupeFind.tpl
@@ -176,6 +176,7 @@
 {literal}
 

[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Drush command to delete extraneous log_setting entries.

2017-10-18 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/385114 )

Change subject: Drush command to delete extraneous log_setting entries.
..

Drush command to delete extraneous log_setting entries.

This might still not be nuanced enough - but I'll try it out. There could be a
lot of rows with a single log_conn_id

Bug: T177451
Change-Id: I3a38dc725e18d8829ffcf174ec34a61847843f00
---
A sites/all/modules/wmf_civicrm/scripts/civicrm_cleanup_logs.drush.inc
M sites/all/modules/wmf_civicrm/scripts/civicrm_merge.drush.inc
M sites/all/modules/wmf_civicrm/scripts/civicrm_repair_blank_addresses.drush.inc
A sites/all/modules/wmf_civicrm/scripts/drush_threshholds.php
4 files changed, 98 insertions(+), 34 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/14/385114/1

diff --git 
a/sites/all/modules/wmf_civicrm/scripts/civicrm_cleanup_logs.drush.inc 
b/sites/all/modules/wmf_civicrm/scripts/civicrm_cleanup_logs.drush.inc
new file mode 100644
index 000..4f912dc
--- /dev/null
+++ b/sites/all/modules/wmf_civicrm/scripts/civicrm_cleanup_logs.drush.inc
@@ -0,0 +1,65 @@
+ 'Clean up log bloat in civicrm settings table',
+'options' => array(
+  'batch' => "Batch size",
+  'threshold' => 'Threshold for aborting.',
+  'threshold_period' => 'Number of minutes in the threshold period',
+),
+  );
+
+  return $items;
+}
+
+/**
+ * Implementation of hook_drush_help().
+ */
+function civicrm_cleanup_logs_drush_help($section) {
+  switch ( $section ) {
+  case 'drush:civicrm-cleanup-logs':
+return dt('Cleanup data in log table (specifically settings)');
+  }
+}
+
+/**
+ * Cleanup the log_civicrm_setting table.
+ *
+ * This got bloated by the omnimail job.
+ *
+ * @throws \CiviCRM_API3_Exception
+ */
+function drush_civicrm_cleanup_logs() {
+  module_invoke('civicrm', 'initialize');
+
+  require_once 'drush_threshholds.php';
+  $threshold = (int) drush_get_option('threshold');
+  if ($threshold) {
+$thresholdNumberOfMinutes = (int) drush_get_option('threshold_period', 5);
+if (_drush_civicrm_queue_is_backed_up($threshold, 
$thresholdNumberOfMinutes)) {
+  return;
+}
+  }
+
+  $batch_size = (integer) drush_get_option('batch', 1000);
+  while ($batch_size > 0) {
+
+$logConnID = CRM_Core_DAO::singleValueQuery("
+SELECT log_conn_id FROM log_civicrm_setting WHERE name IN 
('omnimail_omnirecipient_load', 'omnimail_omnigroupmembers_load')
+LIMIT 1
+  ");
+
+if (empty($logConnID)) {
+  watchdog('civicrm_cleanup_log', 'No more cruft to process');
+  return;
+}
+CRM_Core_DAO::executeQuery("DELETE FROM log_civicrm_setting WHERE 
log_conn_id = '{$logConnID}'");
+$batch_size--;
+  }
+  watchdog('civicrm_cleanup_logs', 'Cleaned omnimail cruft but not finished.');
+}
diff --git a/sites/all/modules/wmf_civicrm/scripts/civicrm_merge.drush.inc 
b/sites/all/modules/wmf_civicrm/scripts/civicrm_merge.drush.inc
index 2f2c7a7..cdd0e0e 100644
--- a/sites/all/modules/wmf_civicrm/scripts/civicrm_merge.drush.inc
+++ b/sites/all/modules/wmf_civicrm/scripts/civicrm_merge.drush.inc
@@ -36,6 +36,7 @@
  * @throws \CiviCRM_API3_Exception
  */
 function drush_civicrm_merge() {
+  require_once 'drush_threshholds.php';
   module_invoke('civicrm', 'initialize');
 
   $threshold = (int) drush_get_option('threshold');
@@ -85,35 +86,4 @@
   watchdog('civicrm_merge', 'Deduped contact range: %start to %end', 
array('%start' => $start, '%end' => $end), WATCHDOG_INFO);
   drush_print("Processed id range $start to " . $end . '
   Merged ' . count($result['values']['merged']) . ". Skipped " . 
count($result['values']['skipped']));
-}
-
-/**
- * Check if the queue is backed up.
- *
- * @todo think about using a hook structure here so different modules can 
interact
- * (and to keep it generic for others to use).
- *
- * @param int $threshold
- *   Contribution threshold - abort if more in the period.
- * @param int $numberOfMinutes
- *   Number of minutes in threshold period.
- *
- * @return int|bool
- *   Number of contributions of FALSE if not more than the threshold.
- */
-function _drush_civicrm_queue_is_backed_up($threshold, $numberOfMinutes = 5) {
-$countOfContributionsInTimeFrame = CRM_Core_DAO::singleValueQuery('
-  SELECT count(*) FROM civicrm_contact WHERE created_date > 
DATE_SUB(NOW(), INTERVAL %1 MINUTE);
-',
-array(1 => array($numberOfMinutes, 'Integer'))
-  );
-  if ($countOfContributionsInTimeFrame > $threshold) {
-drush_print(
-  "Early return as queue is backed up. $countOfContributionsInTimeFrame 
contributions in the last $numberOfMinutes"
-  . " minutes is greater than the threshold of $threshold"
-);
-return TRUE;
-  }
-  return FALSE;
-
 }
diff --git 
a/sites/all/modules/wmf_civicrm/scripts/civicrm_repair_blank_addresses.drush.inc
 
b/sites/all/modules/wmf_civicrm/scripts/civicrm_repair_blank_addresses.drush.i

[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Upgrader for switching omnimail job

2017-10-18 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/385034 )

Change subject: Upgrader for switching omnimail job
..

Upgrader for switching omnimail job

Bug: T177451
Change-Id: I9f7cf6fa71fb1735998b538502cec4f922304047
---
M 
sites/default/civicrm/extensions/org.wikimedia.omnimail/CRM/Omnimail/Upgrader.php
1 file changed, 37 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/34/385034/1

diff --git 
a/sites/default/civicrm/extensions/org.wikimedia.omnimail/CRM/Omnimail/Upgrader.php
 
b/sites/default/civicrm/extensions/org.wikimedia.omnimail/CRM/Omnimail/Upgrader.php
index 76c8f16..4bcb3a2 100644
--- 
a/sites/default/civicrm/extensions/org.wikimedia.omnimail/CRM/Omnimail/Upgrader.php
+++ 
b/sites/default/civicrm/extensions/org.wikimedia.omnimail/CRM/Omnimail/Upgrader.php
@@ -53,19 +53,49 @@
   public function disable() {
 CRM_Core_DAO::executeQuery('UPDATE foo SET is_active = 0 WHERE bar = 
"whiz"');
   }
+   */
 
   /**
-   * Example: Run a couple simple queries.
+   * Convert setting tracking to table.
*
* @return TRUE on success
* @throws Exception
-   *
-  public function upgrade_4200() {
-$this->ctx->log->info('Applying update 4200');
-CRM_Core_DAO::executeQuery('UPDATE foo SET bar = "whiz"');
-CRM_Core_DAO::executeQuery('DELETE FROM bang WHERE willy = wonka(2)');
+   */
+  public function upgrade_1000() {
+$this->ctx->log->info('Applying update 1000');
+CRM_Core_DAO::executeQuery('
+  CREATE TABLE civicrm_omnimail_job_progress (
+   `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+   `mailing_provider` VARCHAR(32) NOT NULL,
+   `job` VARCHAR(32) NULL,
+   `job_identifier` VARCHAR(32) NULL,
+   `last_timestamp` timestamp NULL,
+   `progress_end_timestamp` timestamp NULL,
+   `retrieval_parameters` VARCHAR(255) NULL,
+   `offset` INT(10) unsigned,
+ PRIMARY KEY (`id`)
+  ) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_unicode_ci');
+
+foreach (array('omnimail_omnigroupmembers_load', 
'omnimail_omnirecipient_load') as $job) {
+  $settings = civicrm_api3('Setting', 'get', array('return' => $job));
+  foreach ($settings['values'][CRM_Core_Config::domainId()][$job] as 
$mailingProvider => $setting) {
+$mailingProviderParts = explode('_', $mailingProvider);
+$jobIdentifier = isset($mailingProviderParts[1]) ? "'" . 
$mailingProviderParts[1] . "'" : 'NULL';
+$progressEndTimestamp = isset($setting['progress_end_date']) ? 
'FROM_UNIXTIME(' . $setting['progress_end_date'] . ')' : 'NULL';
+$retrievalParameters = isset($setting['retrieval_parameters']) ? "'" . 
json_encode($setting['retrieval_parameters']) . "'" : 'NULL';
+$offset = isset($setting['offset']) ? $setting['offset'] : 0;
+CRM_Core_DAO::executeQuery(
+  "INSERT INTO civicrm_omnimail_job_progress
+(`mailing_provider`, `job`, `job_identifier`, `last_timestamp`, 
`progress_end_timestamp`, `retrieval_parameters`, `offset`)
+values ('{$mailingProviderParts[0]}', '{$job}', $jobIdentifier, 
FROM_UNIXTIME( {$setting['last_timestamp']} ), $progressEndTimestamp, 
$retrievalParameters, $offset)
+ "
+);
+  }
+}
+
 return TRUE;
-  } // */
+  }
+   /*
 
 
   /**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9f7cf6fa71fb1735998b538502cec4f922304047
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Update CiviCRM submodule

2017-10-18 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/385031 )

Change subject: Update CiviCRM submodule
..

Update CiviCRM submodule

5f31c22 CRM-21324 - Support 'null' on date fields in the api

Change-Id: Ida82b6340da1fafa07a2265a7691775cb30fda64
---
M civicrm
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/31/385031/1

diff --git a/civicrm b/civicrm
index 22ffe27..5f31c22 16
--- a/civicrm
+++ b/civicrm
@@ -1 +1 @@
-Subproject commit 22ffe27bb9c2fae326fef1873d78bdfd0af96ecb
+Subproject commit 5f31c22abe00eda2d46d17e6a00c575596628eba

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ida82b6340da1fafa07a2265a7691775cb30fda64
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Switch to using a table to track omnimail job progress

2017-10-18 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/384953 )

Change subject: Switch to using a table to track omnimail job progress
..

Switch to using a table to track omnimail job progress

Bug: T177451
Change-Id: I17c7ac20bbc22919b1f767fea3a5ea7a55a08c9b
---
M 
sites/default/civicrm/extensions/org.wikimedia.omnimail/CRM/Omnimail/Omnimail.php
M 
sites/default/civicrm/extensions/org.wikimedia.omnimail/api/v3/Omnigroupmember/Load.php
M 
sites/default/civicrm/extensions/org.wikimedia.omnimail/api/v3/Omnirecipient/Load.php
M 
sites/default/civicrm/extensions/org.wikimedia.omnimail/tests/phpunit/OmnigroupmemberLoadTest.php
M 
sites/default/civicrm/extensions/org.wikimedia.omnimail/tests/phpunit/OmnimailBaseTestClass.php
M 
sites/default/civicrm/extensions/org.wikimedia.omnimail/tests/phpunit/OmnirecipientLoadTest.php
6 files changed, 75 insertions(+), 59 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/53/384953/1

diff --git 
a/sites/default/civicrm/extensions/org.wikimedia.omnimail/CRM/Omnimail/Omnimail.php
 
b/sites/default/civicrm/extensions/org.wikimedia.omnimail/CRM/Omnimail/Omnimail.php
index a6a5174..b4bed7c 100644
--- 
a/sites/default/civicrm/extensions/org.wikimedia.omnimail/CRM/Omnimail/Omnimail.php
+++ 
b/sites/default/civicrm/extensions/org.wikimedia.omnimail/CRM/Omnimail/Omnimail.php
@@ -63,7 +63,7 @@
* @throws \API_Exception
*/
   public function __construct($params) {
-$this->job_suffix = !empty($params['job_suffix']) ? $params['job_suffix'] 
: '';
+$this->job_suffix = !empty($params['job_suffix']) ? $params['job_suffix'] 
: NULL;
 $this->mail_provider = $params['mail_provider'];
 $this->settings = CRM_Omnimail_Helper::getSettings();
 $this->setJobSettings($params);
@@ -163,10 +163,35 @@
   }
 
   /**
-   * @param $params
+   * Setter for job settings.
+   *
+   * @param array $params
+   *   Api input parameters.
*/
   protected function setJobSettings($params) {
-$this->jobSettings = CRM_Utils_Array::value($params['mail_provider'] . 
$this->job_suffix, $this->settings['omnimail_' . $this->job . '_load'], 
array());
+$this->jobSettings = array(
+  'mailing_provider' => $params['mail_provider'],
+  'job' => 'omnimail_' . $this->job . '_load',
+  'job_identifier' => $this->job_suffix ? : NULL,
+);
+$savedSettings = civicrm_api3('OmnimailJobProgress', 'get', 
$this->jobSettings);
+
+if ($savedSettings['count']) {
+  foreach ($savedSettings['values'] as $savedSetting) {
+// filter for job_identifier since NULL will not have been respected.
+if (CRM_Utils_Array::value('job_identifier', $savedSetting) === 
$this->job_suffix) {
+  foreach (array('last_timestamp', 'progress_end_timestamp') as 
$dateField) {
+if (isset($savedSetting[$dateField])) {
+  $savedSetting[$dateField] = strtotime($savedSetting[$dateField]);
+}
+  }
+  if (isset($savedSetting['retrieval_parameters'])) {
+$savedSetting['retrieval_parameters'] = 
json_decode($savedSetting['retrieval_parameters'], TRUE);
+  }
+  $this->jobSettings = $savedSetting;
+}
+  }
+}
   }
 
   /**
@@ -175,12 +200,13 @@
* @param array $setting
*/
   function saveJobSetting($setting) {
-$key = 'omnimail_' . $this->job . '_load';
-civicrm_api3('Setting', 'create', array(
-  $key => array_merge($this->settings[$key], array(
-$this->mail_provider . $this->job_suffix => $setting,
-  ))
-));
+$this->jobSettings = $setting = array_merge($this->jobSettings, $setting);
+foreach (array('last_timestamp', 'progress_end_timestamp') as $dateField) {
+  if (isset($setting[$dateField]) && $setting[$dateField] !== 'null') {
+$setting[$dateField] = date('Y-m-d H:i:s', $setting[$dateField]);
+  }
+}
+civicrm_api3('OmnimailJobProgress', 'create', $setting);
   }
 
-}
\ No newline at end of file
+}
diff --git 
a/sites/default/civicrm/extensions/org.wikimedia.omnimail/api/v3/Omnigroupmember/Load.php
 
b/sites/default/civicrm/extensions/org.wikimedia.omnimail/api/v3/Omnigroupmember/Load.php
index e0e8b7f..2030fef 100644
--- 
a/sites/default/civicrm/extensions/org.wikimedia.omnimail/api/v3/Omnigroupmember/Load.php
+++ 
b/sites/default/civicrm/extensions/org.wikimedia.omnimail/api/v3/Omnigroupmember/Load.php
@@ -28,9 +28,8 @@
   }
   catch (CRM_Omnimail_IncompleteDownloadException $e) {
 $job->saveJobSetting(array(
-  'last_timestamp' => $jobSettings['last_timestamp'],
   'retrieval_parameters' => $e->getRetrievalParameters(),
-  'progress_end_date' => $e->getEndTimestamp(),
+  'progress_end_timestamp' => $e->getEndTimestamp(),
   'offset' => 0,
 ));
 return civicrm_api3_create_success(1);
@@ -48,7 +47,7 @@
   $job->saveJobSetting(array(
 'las

[MediaWiki-commits] [Gerrit] wikimedia...civicrm[master]: CRM-21324 - Support 'null' on date fields in the api

2017-10-18 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/384940 )

Change subject: CRM-21324 - Support 'null' on date fields in the api
..

CRM-21324 - Support 'null' on date fields in the api

https://github.com/civicrm/civicrm-core/pull/11152

Bug: T177451

Change-Id: Ib110e7d27a5886e6e8da3dc3abc70e38c3f5b682
---
M api/v3/utils.php
1 file changed, 6 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm/civicrm 
refs/changes/40/384940/1

diff --git a/api/v3/utils.php b/api/v3/utils.php
index 9f42886..aba7c3b 100644
--- a/api/v3/utils.php
+++ b/api/v3/utils.php
@@ -1683,6 +1683,12 @@
   if (strpos($op, 'NULL') !== FALSE || strpos($op, 'EMPTY') !== FALSE) {
 return;
   }
+
+  if ($fieldValue === 'null' && empty($fieldInfo['api.required'])) {
+// This is the wierd & wonderful way PEAR sets null.
+return;
+  }
+
   //should we check first to prevent it from being copied if they have passed 
in sql friendly format?
   if (!empty($params[$fieldInfo['name']])) {
 $fieldValue = _civicrm_api3_getValidDate($fieldValue, $fieldInfo['name'], 
$fieldInfo['type']);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib110e7d27a5886e6e8da3dc3abc70e38c3f5b682
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm/civicrm
Gerrit-Branch: master
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Test consolidation in prep for switching away from setting

2017-10-18 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/384936 )

Change subject: Test consolidation in prep for switching away from setting
..

Test consolidation in prep for switching away from setting

Bug: T177451
Change-Id: Ic3e03c5616cd80a7b97d4af43b00b2747a3938c3
---
M 
sites/default/civicrm/extensions/org.wikimedia.omnimail/tests/phpunit/OmnigroupmemberGetTest.php
M 
sites/default/civicrm/extensions/org.wikimedia.omnimail/tests/phpunit/OmnigroupmemberLoadTest.php
M 
sites/default/civicrm/extensions/org.wikimedia.omnimail/tests/phpunit/OmnimailBaseTestClass.php
M 
sites/default/civicrm/extensions/org.wikimedia.omnimail/tests/phpunit/OmnirecipientLoadTest.php
4 files changed, 85 insertions(+), 63 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/36/384936/1

diff --git 
a/sites/default/civicrm/extensions/org.wikimedia.omnimail/tests/phpunit/OmnigroupmemberGetTest.php
 
b/sites/default/civicrm/extensions/org.wikimedia.omnimail/tests/phpunit/OmnigroupmemberGetTest.php
index 0509181..5a6bca9 100644
--- 
a/sites/default/civicrm/extensions/org.wikimedia.omnimail/tests/phpunit/OmnigroupmemberGetTest.php
+++ 
b/sites/default/civicrm/extensions/org.wikimedia.omnimail/tests/phpunit/OmnigroupmemberGetTest.php
@@ -69,7 +69,7 @@
 );
 copy(__DIR__ . '/Responses/20170509_noCID - All - Jul 5 2017 06-27-45 
AM.csv', sys_get_temp_dir() . '/20170509_noCID - All - Jul 5 2017 06-27-45 
AM.csv');
 fopen(sys_get_temp_dir() . '/20170509_noCID - All - Jul 5 2017 06-27-45 
AM.csv.complete', 'c');
-$this->createSetting('omnimail_omnigroupmembers_load', array('Silverpop' 
=> array('last_timestamp' => '1487890800')));
+$this->createSetting(array('job' => 'omnimail_omnigroupmembers_load', 
'mailing_provider' => 'Silverpop', 'last_timestamp' => '1487890800'));
 
 $client = $this->getMockRequest($responses);
 return $client;
diff --git 
a/sites/default/civicrm/extensions/org.wikimedia.omnimail/tests/phpunit/OmnigroupmemberLoadTest.php
 
b/sites/default/civicrm/extensions/org.wikimedia.omnimail/tests/phpunit/OmnigroupmemberLoadTest.php
index a2a9876..7460245 100644
--- 
a/sites/default/civicrm/extensions/org.wikimedia.omnimail/tests/phpunit/OmnigroupmemberLoadTest.php
+++ 
b/sites/default/civicrm/extensions/org.wikimedia.omnimail/tests/phpunit/OmnigroupmemberLoadTest.php
@@ -112,10 +112,10 @@
* Test when download does not complete in time.
*/
   public function testOmnigroupmemberLoadIncomplete() {
-civicrm_api3('Setting', 'create', array(
-  'omnimail_omnigroupmembers_load' => array(
-'Silverpop' => array('last_timestamp' => '1487890800'),
-  ),
+$this->createSetting(array(
+  'job' => 'omnimail_omnigroupmembers_load',
+  'mailing_provider' => 'Silverpop',
+  'last_timestamp' => '1487890800',
 ));
 $responses = array(
   file_get_contents(__DIR__ . '/Responses/ExportListResponse.txt'),
@@ -147,10 +147,11 @@
* Test when download does not complete in time.
*/
   public function testOmnigroupmemberLoadIncompleteUseSuffix() {
-civicrm_api3('Setting', 'create', array(
-  'omnimail_omnigroupmembers_load' => array(
-'Silverpop' . '_woot' => array('last_timestamp' => '1487890800'),
-  ),
+$this->createSetting(array(
+  'job' => 'omnimail_omnigroupmembers_load',
+  'mailing_provider' => 'Silverpop',
+  'job_identifier' => '_woot',
+  'last_timestamp' => '1487890800',
 ));
 $responses = array(
   file_get_contents(__DIR__ . '/Responses/ExportListResponse.txt'),
@@ -192,17 +193,15 @@
   public function testCompleteIncomplete() {
 $client = $this->setupSuccessfulDownloadClient();
 $group = civicrm_api3('Group', 'create', array('name' => 'Omnimailers3', 
'title' => 'Omni3'));
-civicrm_api3('setting', 'create', array(
-  'omnimail_omnigroupmembers_load' => array(
-'Silverpop' => array(
-  'last_timestamp' => '1487890800',
-  'retrieval_parameters' => array(
-'jobId' => '101719657',
-'filePath' => '/download/20170509_noCID - All - Jul 5 2017 
06-27-45 AM.csv',
-  ),
-  'progress_end_date' => '148815',
-),
+$this->createSetting(array(
+  'job' => 'omnimail_omnigroupmembers_load',
+  'mailing_provider' => 'Silverpop',
+  'last_timestamp' => '1487890800',
+  'retrieval_parameters' => array(
+'jobId' => '101719657',
+'filePath' => '/download/20170509_noCID - All - Jul 5 2017 06-27-45 
AM.csv',
   ),
+  'progress_end_date' => '148815',
 ));
 
 civicrm_api3('Omnigroupmember', 'load', array(
@@ -238,7 +237,7 @@
 copy(__DIR__ . '/Responses/20170509_noCID - All - Jul 5 2017 06-27-45 
AM.csv', sys_get_temp_dir() . '/20170509_noCID - All - Jul 5 2017 06-27-45 
AM.csv');
 fopen(sys_get_temp_dir() . '/20170509_noCID - All - Ju

[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: WIP Switch Omnimail job progress tracking to it's own table.

2017-10-17 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/384906 )

Change subject: WIP Switch Omnimail job progress tracking to it's own table.
..

WIP Switch Omnimail job progress tracking to it's own table.

Turns out we have logging enabled on the civicrm_settings table which makes it 
really inapproprite

We could have stopped logging on that table but it feels like we might someday 
want to do forensics on a setting

Bug: T177451
Change-Id: I7f795f38c34e6d992dd42bd989479fac25225294
---
A 
sites/default/civicrm/extensions/org.wikimedia.omnimail/CRM/Omnimail/BAO/OmnimailJobProgress.php
A 
sites/default/civicrm/extensions/org.wikimedia.omnimail/CRM/Omnimail/DAO/OmnimailJobProgress.php
M 
sites/default/civicrm/extensions/org.wikimedia.omnimail/CRM/Omnimail/Omnimail.php
M 
sites/default/civicrm/extensions/org.wikimedia.omnimail/CRM/Omnimail/Upgrader.php
M 
sites/default/civicrm/extensions/org.wikimedia.omnimail/api/v3/Omnigroupmember/Load.php
A 
sites/default/civicrm/extensions/org.wikimedia.omnimail/api/v3/OmnimailJobProgress.php
M sites/default/civicrm/extensions/org.wikimedia.omnimail/omnimail.php
M 
sites/default/civicrm/extensions/org.wikimedia.omnimail/sql/omnimail_install.sql
M 
sites/default/civicrm/extensions/org.wikimedia.omnimail/tests/phpunit/OmnigroupmemberLoadTest.php
M 
sites/default/civicrm/extensions/org.wikimedia.omnimail/tests/phpunit/OmnimailBaseTestClass.php
A 
sites/default/civicrm/extensions/org.wikimedia.omnimail/xml/schema/CRM/Omnimail/OmnimailJobProgress.entityType.php
A 
sites/default/civicrm/extensions/org.wikimedia.omnimail/xml/schema/CRM/Omnimail/OmnimailJobProgress.xml
12 files changed, 507 insertions(+), 36 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/06/384906/1

diff --git 
a/sites/default/civicrm/extensions/org.wikimedia.omnimail/CRM/Omnimail/BAO/OmnimailJobProgress.php
 
b/sites/default/civicrm/extensions/org.wikimedia.omnimail/CRM/Omnimail/BAO/OmnimailJobProgress.php
new file mode 100644
index 000..fdc3049
--- /dev/null
+++ 
b/sites/default/civicrm/extensions/org.wikimedia.omnimail/CRM/Omnimail/BAO/OmnimailJobProgress.php
@@ -0,0 +1,25 @@
+copyValues($params);
+* $instance->save();
+* CRM_Utils_Hook::post($hook, $entityName, $instance->id, $instance);
+ *
+* return $instance;
+  * } */
+
+}
diff --git 
a/sites/default/civicrm/extensions/org.wikimedia.omnimail/CRM/Omnimail/DAO/OmnimailJobProgress.php
 
b/sites/default/civicrm/extensions/org.wikimedia.omnimail/CRM/Omnimail/DAO/OmnimailJobProgress.php
new file mode 100644
index 000..3d1063c
--- /dev/null
+++ 
b/sites/default/civicrm/extensions/org.wikimedia.omnimail/CRM/Omnimail/DAO/OmnimailJobProgress.php
@@ -0,0 +1,266 @@
+http://civicrm.org/licensing|
+++
+*/
+/**
+ * @package CRM
+ * @copyright CiviCRM LLC (c) 2004-2017
+ *
+ * Generated from xml/schema/CRM/Omnimail/OmnimailJobProgress.xml
+ * DO NOT EDIT.  Generated by CRM_Core_CodeGen
+ * (GenCodeChecksum:9b5f9397769a4b1c942fcf3181cb8b17)
+ */
+require_once 'CRM/Core/DAO.php';
+require_once 'CRM/Utils/Type.php';
+/**
+ * CRM_Omnimail_DAO_OmnimailJobProgress constructor.
+ */
+class CRM_Omnimail_DAO_OmnimailJobProgress extends CRM_Core_DAO {
+  /**
+   * Static instance to hold the table name.
+   *
+   * @var string
+   */
+  static $_tableName = 'civicrm_omnimail_job_progress';
+  /**
+   * Should CiviCRM log any modifications to this table in the civicrm_log 
table.
+   *
+   * @var boolean
+   */
+  static $_log = false;
+  /**
+   * Unique OmnimailJobProgress ID
+   *
+   * @var int unsigned
+   */
+  public $id;
+  /**
+   * Mailing provider name
+   *
+   * @var string
+   */
+  public $mailing_provider;
+  /**
+   * job name
+   *
+   * @var string
+   */
+  public $job;
+  /**
+   * optional suffix to disambiguate the job
+   *
+   * @var string
+   */
+  public $job_identifier;
+  /**
+   * Mailing provider name
+   *
+   * @var timestamp
+   */
+  public $last_timestamp;
+  /**
+   * End timestamp of current retrieval
+   *
+   * @var timestamp
+   */
+  public $progress_end_timestamp;
+  /**
+   * json copy of any paramters that need to be passed to the provider.
+   *
+   * @var string
+   */
+  public $retrieval_parameters;
+  /**
+   * How many lines have been processed
+   *
+   * @var int unsigned
+   */
+  public $offset;
+  /**
+   * Class constructor.
+   */
+  function __construct() {
+$this->__table = 'civicrm_omnimail_job_progress';
+parent::__construct();
+  }
+  /**
+   * Returns all the column names of this table
+   *
+   * @return array
+   */
+  static function &fields() {
+if (!isset(Civi::$statics[__CLASS__]['fields'])) {
+  Civi::$statics[__CLASS__]['fields'] = array(
+'id' => array(
+  'name' => 'id',
+  'type' => CRM_Utils_Type::T_INT,
+  'description' => 

[MediaWiki-commits] [Gerrit] wikimedia...crm[deployment]: Merge branch 'master' of https://gerrit.wikimedia.org/r/wiki...

2017-10-12 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/383954 )

Change subject: Merge branch 'master' of 
https://gerrit.wikimedia.org/r/wikimedia/fundraising/crm into deployment
..

Merge branch 'master' of 
https://gerrit.wikimedia.org/r/wikimedia/fundraising/crm into deployment

9fa46538dbb848bdf9ebd9f48050ff4ca5e796db Fix Omnimailing.load job to bypass 
creating recipients & to use internal replace, add test.

Change-Id: I8da51794f7c4f1d67046beac039a4de0ea897bb8
---
0 files changed, 0 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/54/383954/1


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8da51794f7c4f1d67046beac039a4de0ea897bb8
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: deployment
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Fix Omnimailing.load job to bypass creating recipients & to ...

2017-10-11 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/383734 )

Change subject: Fix Omnimailing.load job to bypass creating recipients & to use 
internal replace, add test.
..

Fix Omnimailing.load job to bypass creating recipients & to use internal 
replace, add test.

Yes, passing '_skip_evil_bao_auto_recipients_' really is the key to bypassing 
that function :-)

We don't really want all those mailing_job records either since Civi is not 
doing those mailings.

ALso replace not working as I thought & hence internalising the code to do that

Bug: T178020
Change-Id: Ia5a86ea84548fc10483b01bbfdc8931793ea7d1b
---
M 
sites/default/civicrm/extensions/org.wikimedia.omnimail/api/v3/Omnimailing/Load.php
A 
sites/default/civicrm/extensions/org.wikimedia.omnimail/tests/phpunit/OmnimailingLoadTest.php
2 files changed, 174 insertions(+), 57 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/34/383734/1

diff --git 
a/sites/default/civicrm/extensions/org.wikimedia.omnimail/api/v3/Omnimailing/Load.php
 
b/sites/default/civicrm/extensions/org.wikimedia.omnimail/api/v3/Omnimailing/Load.php
index 44550ab..811e4f2 100644
--- 
a/sites/default/civicrm/extensions/org.wikimedia.omnimail/api/v3/Omnimailing/Load.php
+++ 
b/sites/default/civicrm/extensions/org.wikimedia.omnimail/api/v3/Omnimailing/Load.php
@@ -41,69 +41,73 @@
 $getParams['username'] = $params['username'];
 $getParams['password'] = $params['password'];
   }
+  if (isset($params['client'])) {
+$getParams['client'] = $params['client'];
+  }
   $mailings = civicrm_api3('Omnimailing', 'get', $getParams);
 
   foreach ($mailings['values']  as $mailing) {
-$campaign = civicrm_api3('Campaign', 'replace', array(
-  'name' => 'sp' . $mailing['external_identifier'],
-  'values' => array(
-array(
-  'title' => 'sp' . $mailing['external_identifier'],
-  'description' => $mailing['subject'],
-  'campaign_type_id' => 'Email',
-  'start_date' => date('Y-m-d H:i:s', $mailing['start_date']),
-  'status_id' => 'Completed',
-)
-  )
+$campaign = _civicrm_api3_omnimailing_load_api_replace(
+  'Campaign',
+  array('name' => 'sp' . $mailing['external_identifier']),
+  array(
+'title' => 'sp' . $mailing['external_identifier'],
+'description' => $mailing['subject'],
+'campaign_type_id' => 'Email',
+'start_date' => date('Y-m-d H:i:s', $mailing['start_date']),
+'status_id' => 'Completed',
 ));
+
 CRM_Core_PseudoConstant::flush();
-$result = civicrm_api3('Mailing', 'replace', array(
-  'hash' => 'sp' . $mailing['external_identifier'],
-  'debug' => 1,
-  'values' => array(
-array(
-  'body_html' => !empty($mailing['body_html']) ? $mailing['body_html'] 
: '',
-  'body_text' => !empty($mailing['body_text']) ? $mailing['body_text'] 
: '',
-  'name' => !empty($mailing['name']) ? $mailing['name'] : 'sp' . 
$mailing['external_identifier'],
-  'subject' => $mailing['subject'],
-  'created_date' => date('Y-m-d H:i:s', $mailing['scheduled_date']),
-  'hash' => 'sp' . $mailing['external_identifier'],
-  'scheduled_date' => date('Y-m-d H:i:s', $mailing['scheduled_date']),
-  'campaign_id' => $campaign['id'],
-  'is_completed' => 1,
-)
+
+$result =  _civicrm_api3_omnimailing_load_api_replace(
+  'Mailing',
+  array('hash' => 'sp' . $mailing['external_identifier']),
+  array(
+'body_html' => !empty($mailing['body_html']) ? $mailing['body_html'] : 
'',
+'body_text' => !empty($mailing['body_text']) ? $mailing['body_text'] : 
'',
+'name' => !empty($mailing['name']) ? $mailing['name'] : 'sp' . 
$mailing['external_identifier'],
+'subject' => $mailing['subject'],
+'created_date' => date('Y-m-d H:i:s', $mailing['scheduled_date']),
+'hash' => 'sp' . $mailing['external_identifier'],
+'scheduled_date' => date('Y-m-d H:i:s', $mailing['scheduled_date']),
+'campaign_id' => $campaign['id'],
   ),
-));
-$values[] = $result['values'][$result['id']];
-civicrm_api3('MailingStats', 'replace', array(
-  'mailing_id' => $result['id'],
-  'values' => array(
-array(
-  'debug' => 1,
-  'mailing_id' => $result['id'],
-  'mailing_name' => !empty($mailing['name']) ? $mailing['name'] : 'sp' 
. $mailing['external_identifier'],
-  'is_completed' => TRUE,
-  'created_date' => date('Y-m-d H:i:s', $mailing['scheduled_date']),
-  'start' => date('Y-m-d H:i:s', $mailing['start_date']),
-  //'finish' =>
-  'recipients' => $mailing['number_sent'],
-  'delivered' => $mailing['number_sent'] - $mailing['number_bounced'],
-  // 'send_rate'
-  'bounced' => $mail

[MediaWiki-commits] [Gerrit] wikimedia...civicrm[master]: purely for testing purposes - do not merge

2017-10-11 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/383711 )

Change subject: purely for testing purposes - do not merge
..

purely for testing purposes - do not merge

Change-Id: Ie93745c87417c7095b28e0b33ff8279ee0ea3ab4
---
M CRM/Mailing/BAO/Mailing.php
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm/civicrm 
refs/changes/11/383711/1

diff --git a/CRM/Mailing/BAO/Mailing.php b/CRM/Mailing/BAO/Mailing.php
index 788d5f8..6ba4a18 100644
--- a/CRM/Mailing/BAO/Mailing.php
+++ b/CRM/Mailing/BAO/Mailing.php
@@ -127,10 +127,10 @@
 $dedupeEmail = FALSE,
 $mode = NULL) {
 $mailingGroup = new CRM_Mailing_DAO_MailingGroup();
-
+throw new CRM_Core_Exception('naff off');
 $mailing = CRM_Mailing_BAO_Mailing::getTableName();
 $job = CRM_Mailing_BAO_MailingJob::getTableName();
-$mg = CRM_Mailing_DAO_MailingGroup::getTableName();
+$mg = CRM_Mailing_DAO_MailincogGroup::getTableName();
 $eq = CRM_Mailing_Event_DAO_Queue::getTableName();
 
 $email = CRM_Core_DAO_Email::getTableName();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie93745c87417c7095b28e0b33ff8279ee0ea3ab4
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm/civicrm
Gerrit-Branch: master
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...civicrm[master]: CRM-21294 Fix js error on dedupe find screen.

2017-10-10 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/383501 )

Change subject: CRM-21294 Fix js error on dedupe find screen.
..

CRM-21294 Fix js error on dedupe find screen.

This is an error on selecting & unselecting contacts on the merge screen.
A js error was causing selection issues.

Bug: T177873
Change-Id: Iaa24a54647b79c8700473e49e9371e51f5134e10
---
M templates/CRM/Contact/Page/DedupeFind.tpl
1 file changed, 5 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm/civicrm 
refs/changes/01/383501/1

diff --git a/templates/CRM/Contact/Page/DedupeFind.tpl 
b/templates/CRM/Contact/Page/DedupeFind.tpl
index df90aa0..43002b1 100644
--- a/templates/CRM/Contact/Page/DedupeFind.tpl
+++ b/templates/CRM/Contact/Page/DedupeFind.tpl
@@ -189,7 +189,7 @@
 }
 // for action column at the last, set nowrap
 $('td:last', row).attr('nowrap','nowrap');
-// for conflcts column
+// for conflicts column
 var col = CRM.$('table#dupePairs thead 
th.crm-contact-conflicts').index();
 $('td:eq(' + col + ')', row).attr('nowrap','nowrap');
   }
@@ -334,8 +334,10 @@
 else {
   var id = [];
   CRM.$(element).each(function() {
-var sth = CRM.$('input.crm-dedupe-select', this);
-id.push(CRM.$(sth).prop('name').substr(5));
+var pnName = CRM.$('input.crm-dedupe-select', this).prop('name');
+if (pnName !== undefined) {
+  id.push(pnName.substr(5));
+}
   });
   var is_selected = CRM.$('.crm-dedupe-select-all').prop('checked') ? 1 : 
0;
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaa24a54647b79c8700473e49e9371e51f5134e10
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm/civicrm
Gerrit-Branch: master
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...SmashPig[master]: Add .editorconfig

2017-10-10 Thread Eileen (Code Review)
Eileen has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/383301 )

Change subject: Add .editorconfig
..


Add .editorconfig

I couldn't actually find in the MediaWiki standard that it says we should use
tabs instead of spaces, but that is what is happening in this module.

Shame MediaWiki doesn't use psr-2 - would be one less, but like drupal they
probably chose a standard before psr-2 won the standards war.

I was amused to read the page as they advocated various things as 'being more
readable' - when people clearly have differing opinions on that.

Anyway, this isn't working in my IDE as well as I might hope with
the spaces vs tabs, but I'm pretty sure it is right & the magic is in
getting the IDE to work right (or waiting for a release that does).

Bug: T177725
Change-Id: I317c068b28dd2cdede9d854e187fb952ac0fe3e2
---
A .editorconfig
1 file changed, 15 insertions(+), 0 deletions(-)

Approvals:
  Mepps: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 000..9ec2faa
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,15 @@
+# This file is for unifying the coding style for different editors and IDEs
+# editorconfig.org
+
+# WMF-special coding standard
+# https://www.mediawiki.org/wiki/Manual:Coding_conventions/PHP
+
+root = true
+
+[*.php]
+charset = utf-8
+end_of_line = lf
+insert_final_newline = true
+trim_trailing_whitespace = true
+indent_style = tab
+indent_size = 4

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I317c068b28dd2cdede9d854e187fb952ac0fe3e2
Gerrit-PatchSet: 2
Gerrit-Project: wikimedia/fundraising/SmashPig
Gerrit-Branch: master
Gerrit-Owner: Eileen 
Gerrit-Reviewer: Eileen 
Gerrit-Reviewer: Ejegg 
Gerrit-Reviewer: Mepps 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] wikimedia...SmashPig[master]: Add .editorconfig

2017-10-09 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/383301 )

Change subject: Add .editorconfig
..

Add .editorconfig

I couldn't actually find in the MediaWiki standard that it says we should use
tabs instead of spaces, but that is what is happening in this module.

Shame MediaWiki doesn't use psr-2 - would be one less, but like drupal they
probably chose a standard before psr-2 won the standards war.

I was amused to read the page as they advocated various things as 'being more
readable' - when people clearly have differing opinions on that.

Anyway, this isn't working in my IDE as well as I might hope with
the spaces vs tabs, but I'm pretty sure it is right & the magic is in
getting the IDE to work right (or waiting for a release that does).

Bug: T177725
Change-Id: I317c068b28dd2cdede9d854e187fb952ac0fe3e2
---
A .editorconfig
1 file changed, 15 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig 
refs/changes/01/383301/1

diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 000..9ec2faa
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,15 @@
+# This file is for unifying the coding style for different editors and IDEs
+# editorconfig.org
+
+# WMF-special coding standard
+# https://www.mediawiki.org/wiki/Manual:Coding_conventions/PHP
+
+root = true
+
+[*.php]
+charset = utf-8
+end_of_line = lf
+insert_final_newline = true
+trim_trailing_whitespace = true
+indent_style = tab
+indent_size = 4

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I317c068b28dd2cdede9d854e187fb952ac0fe3e2
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/SmashPig
Gerrit-Branch: master
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Add editorconfig to various drupal dirs with drupal whitespa...

2017-10-09 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/383300 )

Change subject: Add editorconfig to various drupal dirs with drupal whitespace 
standard
..

Add editorconfig to various drupal dirs with drupal whitespace standard

Bug: T177725
Change-Id: I2ea0ac49a03791135df199320508b43bd38ae0cc
---
A sites/.editorconfig
A sites/all/modules/.editorconfig
A sites/default/civicrm/extensions/org.wikimedia.datachecks/.editorconfig
A sites/default/civicrm/extensions/org.wikimedia.omnimail/.editorconfig
A sites/default/civicrm/extensions/org.wikimedia.rip/.editorconfig
A sites/default/civicrm/extensions/org.wikimedia.unsubscribeemail/.editorconfig
6 files changed, 84 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/00/383300/1

diff --git a/sites/.editorconfig b/sites/.editorconfig
new file mode 100644
index 000..ccc6a28
--- /dev/null
+++ b/sites/.editorconfig
@@ -0,0 +1,14 @@
+# Drupal editor configuration normalization
+# @see http://editorconfig.org/
+
+# This is the top-most .editorconfig file; do not search in parent directories.
+root = true
+
+# All files.
+[*]
+end_of_line = LF
+indent_style = space
+indent_size = 2
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
diff --git a/sites/all/modules/.editorconfig b/sites/all/modules/.editorconfig
new file mode 100644
index 000..ccc6a28
--- /dev/null
+++ b/sites/all/modules/.editorconfig
@@ -0,0 +1,14 @@
+# Drupal editor configuration normalization
+# @see http://editorconfig.org/
+
+# This is the top-most .editorconfig file; do not search in parent directories.
+root = true
+
+# All files.
+[*]
+end_of_line = LF
+indent_style = space
+indent_size = 2
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
diff --git 
a/sites/default/civicrm/extensions/org.wikimedia.datachecks/.editorconfig 
b/sites/default/civicrm/extensions/org.wikimedia.datachecks/.editorconfig
new file mode 100644
index 000..ccc6a28
--- /dev/null
+++ b/sites/default/civicrm/extensions/org.wikimedia.datachecks/.editorconfig
@@ -0,0 +1,14 @@
+# Drupal editor configuration normalization
+# @see http://editorconfig.org/
+
+# This is the top-most .editorconfig file; do not search in parent directories.
+root = true
+
+# All files.
+[*]
+end_of_line = LF
+indent_style = space
+indent_size = 2
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
diff --git 
a/sites/default/civicrm/extensions/org.wikimedia.omnimail/.editorconfig 
b/sites/default/civicrm/extensions/org.wikimedia.omnimail/.editorconfig
new file mode 100644
index 000..ccc6a28
--- /dev/null
+++ b/sites/default/civicrm/extensions/org.wikimedia.omnimail/.editorconfig
@@ -0,0 +1,14 @@
+# Drupal editor configuration normalization
+# @see http://editorconfig.org/
+
+# This is the top-most .editorconfig file; do not search in parent directories.
+root = true
+
+# All files.
+[*]
+end_of_line = LF
+indent_style = space
+indent_size = 2
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
diff --git a/sites/default/civicrm/extensions/org.wikimedia.rip/.editorconfig 
b/sites/default/civicrm/extensions/org.wikimedia.rip/.editorconfig
new file mode 100644
index 000..ccc6a28
--- /dev/null
+++ b/sites/default/civicrm/extensions/org.wikimedia.rip/.editorconfig
@@ -0,0 +1,14 @@
+# Drupal editor configuration normalization
+# @see http://editorconfig.org/
+
+# This is the top-most .editorconfig file; do not search in parent directories.
+root = true
+
+# All files.
+[*]
+end_of_line = LF
+indent_style = space
+indent_size = 2
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
diff --git 
a/sites/default/civicrm/extensions/org.wikimedia.unsubscribeemail/.editorconfig 
b/sites/default/civicrm/extensions/org.wikimedia.unsubscribeemail/.editorconfig
new file mode 100644
index 000..ccc6a28
--- /dev/null
+++ 
b/sites/default/civicrm/extensions/org.wikimedia.unsubscribeemail/.editorconfig
@@ -0,0 +1,14 @@
+# Drupal editor configuration normalization
+# @see http://editorconfig.org/
+
+# This is the top-most .editorconfig file; do not search in parent directories.
+root = true
+
+# All files.
+[*]
+end_of_line = LF
+indent_style = space
+indent_size = 2
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2ea0ac49a03791135df199320508b43bd38ae0cc
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Eileen 

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


[MediaWiki-commits] [Gerrit] wikimedia...crm[deployment]: Merge branch 'master' of https://gerrit.wikimedia.org/r/wiki...

2017-10-09 Thread Eileen (Code Review)
Eileen has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/383296 )

Change subject: Merge branch 'master' of 
https://gerrit.wikimedia.org/r/wikimedia/fundraising/crm into deployment
..


Merge branch 'master' of 
https://gerrit.wikimedia.org/r/wikimedia/fundraising/crm into deployment

+ 3fdd4449ae46f4bc6c8586e888c7c700f395c84d The big group clean up.
+ bc006f63575a42223710cecfc9f494ad07c03ae8 Last change introduced an error when 
no address conflict exits

Change-Id: Ie0a05f08d5a3b4b7e2d69baecba45a5f95e12cc6
---
D sites/all/modules/wmf_civicrm/tests/phpunit/MergeTest.php
1 file changed, 0 insertions(+), 1,795 deletions(-)

Approvals:
  jenkins-bot: Verified
  Eileen: Looks good to me, approved



diff --git a/sites/all/modules/wmf_civicrm/tests/phpunit/MergeTest.php 
b/sites/all/modules/wmf_civicrm/tests/phpunit/MergeTest.php
deleted file mode 100644
index 14c3bc3..000
--- a/sites/all/modules/wmf_civicrm/tests/phpunit/MergeTest.php
+++ /dev/null
@@ -1,1795 +0,0 @@
-<<< HEAD   (00da4b Merge branch 'master' of 
https://gerrit.wikimedia.org/r/wiki)
-===
-imitateAdminUser();
-$this->doDuckHunt();
-// Run through the merge first to make sure there aren't pre-existing 
contacts in the DB
-// that will ruin the tests.
-$this->callAPISuccess('Job', 'process_batch_merge', array('mode' => 
'safe'));
-
-$this->contactID = 
$this->breedDuck(array(wmf_civicrm_get_custom_field_name('do_not_solicit') => 
0));
-$this->contactID2 = 
$this->breedDuck(array(wmf_civicrm_get_custom_field_name('do_not_solicit') => 
1));
-  }
-
-  public function tearDown() {
-$this->callAPISuccess('Contribution', 'get', array(
-  'contact_id' => array('IN' => array($this->contactID, 
$this->contactID2)),
-  'api.Contribution.delete' => 1,
-));
-$this->callAPISuccess('Contact', 'delete', array('id' => 
$this->contactID));
-$this->callAPISuccess('Contact', 'delete', array('id' => 
$this->contactID2));
-parent::tearDown();
-  }
-
-  /**
-   * Test that the merge hook causes our custom fields to not be treated as 
conflicts.
-   *
-   * We also need to check the custom data fields afterwards.
-   */
-  public function testMergeHook() {
-$this->callAPISuccess('Contribution', 'create', array(
-  'contact_id' => $this->contactID,
-  'financial_type_id' => 'Cash',
-  'total_amount' => 10,
-  'currency' => 'USD',
-  // Should cause 'is_2014 to be true.
-  'receive_date' => '2014-08-04',
-  wmf_civicrm_get_custom_field_name('original_currency') => 'NZD',
-  wmf_civicrm_get_custom_field_name('original_amount') => 8,
-));
-$this->callAPISuccess('Contribution', 'create', array(
-  'contact_id' => $this->contactID2,
-  'financial_type_id' => 'Cash',
-  'total_amount' => 5,
-  'currency' => 'USD',
-  // Should cause 'is_2012_donor to be true.
-  'receive_date' => '2013-01-04',
-));
-$this->callAPISuccess('Contribution', 'create', array(
-  'contact_id' => $this->contactID2,
-  'financial_type_id' => 'Cash',
-  'total_amount' => 9,
-  'currency' => 'NZD',
-  // Should cause 'is_2015_donor to be true.
-  'receive_date' => '2016-04-04',
-));
-$contact = $this->callAPISuccess('Contact', 'get', array(
-  'id' => $this->contactID,
-  'sequential' => 1,
-  'return' => 
array(wmf_civicrm_get_custom_field_name('lifetime_usd_total'), 
wmf_civicrm_get_custom_field_name('do_not_solicit')),
-));
-$this->assertEquals(10, 
$contact['values'][0][wmf_civicrm_get_custom_field_name('lifetime_usd_total')]);
-$result = $this->callAPISuccess('Job', 'process_batch_merge', array(
-  'criteria' => array('contact' => array('id' => array('IN' => 
array($this->contactID, $this->contactID2,
-));
-$this->assertEquals(1, count($result['values']['merged']));
-$contact = $this->callAPISuccess('Contact', 'get', array(
-  'id' => $this->contactID,
-  'sequential' => 1,
-  'return' => array(
-wmf_civicrm_get_custom_field_name('lifetime_usd_total'),
-wmf_civicrm_get_custom_field_name('do_not_solicit'),
-wmf_civicrm_get_custom_field_name('last_donation_amount'),
-wmf_civicrm_get_custom_field_name('last_donation_currency'),
-wmf_civicrm_get_custom_field_name('last_donation_usd'),
-wmf_civicrm_get_custom_field_name('last_donation_date'),
-wmf_civicrm_get_custom_field_name('is_2011_donor'),
-wmf_civicrm_get_custom_field_name('is_2012_donor'),
-wmf_civicrm_get_custom_field_name('is_2013_donor'),
-wmf_civicrm_get_custom_field_name('is_2014_donor'),
-wmf_civicrm_get_custom_field_name('is_2015_donor'),
-wmf_civicrm_get_custom_field_name('is_2016_donor'),
-  ),
-));
-$this->assertEquals(24, 
$contact['values'][0][wmf_civicrm_get_custom_field_name('lifetime_usd_total')]);
-$t

[MediaWiki-commits] [Gerrit] wikimedia...crm[deployment]: Merge branch 'master' of https://gerrit.wikimedia.org/r/wiki...

2017-10-09 Thread Eileen (Code Review)
Eileen has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/383296 )

Change subject: Merge branch 'master' of 
https://gerrit.wikimedia.org/r/wikimedia/fundraising/crm into deployment
..

Merge branch 'master' of 
https://gerrit.wikimedia.org/r/wikimedia/fundraising/crm into deployment

+ 3fdd4449ae46f4bc6c8586e888c7c700f395c84d The big group clean up.
+ bc006f63575a42223710cecfc9f494ad07c03ae8 Last change introduced an error when 
no address conflict exits

Change-Id: Ie0a05f08d5a3b4b7e2d69baecba45a5f95e12cc6
---
D sites/all/modules/wmf_civicrm/tests/phpunit/MergeTest.php
1 file changed, 0 insertions(+), 1,795 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/96/383296/1

diff --git a/sites/all/modules/wmf_civicrm/tests/phpunit/MergeTest.php 
b/sites/all/modules/wmf_civicrm/tests/phpunit/MergeTest.php
deleted file mode 100644
index 14c3bc3..000
--- a/sites/all/modules/wmf_civicrm/tests/phpunit/MergeTest.php
+++ /dev/null
@@ -1,1795 +0,0 @@
-<<< HEAD   (00da4b Merge branch 'master' of 
https://gerrit.wikimedia.org/r/wiki)
-===
-imitateAdminUser();
-$this->doDuckHunt();
-// Run through the merge first to make sure there aren't pre-existing 
contacts in the DB
-// that will ruin the tests.
-$this->callAPISuccess('Job', 'process_batch_merge', array('mode' => 
'safe'));
-
-$this->contactID = 
$this->breedDuck(array(wmf_civicrm_get_custom_field_name('do_not_solicit') => 
0));
-$this->contactID2 = 
$this->breedDuck(array(wmf_civicrm_get_custom_field_name('do_not_solicit') => 
1));
-  }
-
-  public function tearDown() {
-$this->callAPISuccess('Contribution', 'get', array(
-  'contact_id' => array('IN' => array($this->contactID, 
$this->contactID2)),
-  'api.Contribution.delete' => 1,
-));
-$this->callAPISuccess('Contact', 'delete', array('id' => 
$this->contactID));
-$this->callAPISuccess('Contact', 'delete', array('id' => 
$this->contactID2));
-parent::tearDown();
-  }
-
-  /**
-   * Test that the merge hook causes our custom fields to not be treated as 
conflicts.
-   *
-   * We also need to check the custom data fields afterwards.
-   */
-  public function testMergeHook() {
-$this->callAPISuccess('Contribution', 'create', array(
-  'contact_id' => $this->contactID,
-  'financial_type_id' => 'Cash',
-  'total_amount' => 10,
-  'currency' => 'USD',
-  // Should cause 'is_2014 to be true.
-  'receive_date' => '2014-08-04',
-  wmf_civicrm_get_custom_field_name('original_currency') => 'NZD',
-  wmf_civicrm_get_custom_field_name('original_amount') => 8,
-));
-$this->callAPISuccess('Contribution', 'create', array(
-  'contact_id' => $this->contactID2,
-  'financial_type_id' => 'Cash',
-  'total_amount' => 5,
-  'currency' => 'USD',
-  // Should cause 'is_2012_donor to be true.
-  'receive_date' => '2013-01-04',
-));
-$this->callAPISuccess('Contribution', 'create', array(
-  'contact_id' => $this->contactID2,
-  'financial_type_id' => 'Cash',
-  'total_amount' => 9,
-  'currency' => 'NZD',
-  // Should cause 'is_2015_donor to be true.
-  'receive_date' => '2016-04-04',
-));
-$contact = $this->callAPISuccess('Contact', 'get', array(
-  'id' => $this->contactID,
-  'sequential' => 1,
-  'return' => 
array(wmf_civicrm_get_custom_field_name('lifetime_usd_total'), 
wmf_civicrm_get_custom_field_name('do_not_solicit')),
-));
-$this->assertEquals(10, 
$contact['values'][0][wmf_civicrm_get_custom_field_name('lifetime_usd_total')]);
-$result = $this->callAPISuccess('Job', 'process_batch_merge', array(
-  'criteria' => array('contact' => array('id' => array('IN' => 
array($this->contactID, $this->contactID2,
-));
-$this->assertEquals(1, count($result['values']['merged']));
-$contact = $this->callAPISuccess('Contact', 'get', array(
-  'id' => $this->contactID,
-  'sequential' => 1,
-  'return' => array(
-wmf_civicrm_get_custom_field_name('lifetime_usd_total'),
-wmf_civicrm_get_custom_field_name('do_not_solicit'),
-wmf_civicrm_get_custom_field_name('last_donation_amount'),
-wmf_civicrm_get_custom_field_name('last_donation_currency'),
-wmf_civicrm_get_custom_field_name('last_donation_usd'),
-wmf_civicrm_get_custom_field_name('last_donation_date'),
-wmf_civicrm_get_custom_field_name('is_2011_donor'),
-wmf_civicrm_get_custom_field_name('is_2012_donor'),
-wmf_civicrm_get_custom_field_name('is_2013_donor'),
-wmf_civicrm_get_custom_field_name('is_2014_donor'),
-wmf_civicrm_get_custom_field_name('is_2015_donor'),
-wmf_civicrm_get_custom_field_name('is_2016_donor'),
-  ),
-));
-$this->assertEquals(24, 
$contact['values'][0][wmf_civicrm_get_custom_field_name('lifetime_usd_tot

[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Last change introduced an error when no address conflict exits

2017-10-09 Thread Eileen (Code Review)
Eileen has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/383295 )

Change subject: Last change introduced an error when no address conflict exits
..


Last change introduced an error when no address conflict exits

e.g hitting error on 
civicrm/contact/merge?reset=1&cid=3986284&oid=4244149&action=update&rgid=13&criteria={}&limit=5&gid=288

Bug T176699

Change-Id: I438fe2dd9f86b1a2a49fe7119ecb0656e04e3c4f
---
M sites/all/modules/wmf_civicrm/tests/phpunit/MergeTest.php
M sites/all/modules/wmf_civicrm/wmf_civicrm.module
2 files changed, 27 insertions(+), 0 deletions(-)

Approvals:
  jenkins-bot: Verified
  Ejegg: Looks good to me, approved



diff --git a/sites/all/modules/wmf_civicrm/tests/phpunit/MergeTest.php 
b/sites/all/modules/wmf_civicrm/tests/phpunit/MergeTest.php
index 9066984..f295002 100644
--- a/sites/all/modules/wmf_civicrm/tests/phpunit/MergeTest.php
+++ b/sites/all/modules/wmf_civicrm/tests/phpunit/MergeTest.php
@@ -735,6 +735,29 @@
   }
 
   /**
+   * Test that we still cope when there is no address conflict
+   *
+   * Bug T176699
+   */
+  public function 
testBatchMergeNoRealConflictOnAddressButAnotherConflictResolved() {
+$this->callAPISuccess('Address', 'create', array(
+  'contact_id' => $this->contactID2,
+  'country' => 'Korea, Republic of',
+  'location_type_id' => 1,
+));
+$this->callAPISuccess('Address', 'create', array(
+  'contact_id' => $this->contactID,
+  'country' => 'Korea, Republic of',
+  'location_type_id' => 1,
+));
+$this->contributionCreate(array('contact_id' => $this->contactID, 
'receive_date' => '2010-01-01', 'total_amount' => 500));
+
+$result = $this->callAPISuccess('Job', 'process_batch_merge', array('mode' 
=> 'safe'));
+$this->assertEquals(0, count($result['values']['skipped']));
+$this->assertEquals(1, count($result['values']['merged']));
+  }
+
+  /**
* Test that we don't see a city named after a country as the same as a 
country
* when it has no country.
*
diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.module 
b/sites/all/modules/wmf_civicrm/wmf_civicrm.module
index 17233c8..5fc5076 100644
--- a/sites/all/modules/wmf_civicrm/wmf_civicrm.module
+++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.module
@@ -4043,6 +4043,10 @@
 $keysToIgnore = array('id', 'is_primary', 'is_billing', 'manual_geo_code', 
'contact_id', 'reset_date', 'hold_date', 'display', 'location_type_id');
 $comparisonAddress = array_diff_key($comparisonAddress, 
array_flip($keysToIgnore));
 $mainAddress = array_diff_key($mainAddress, array_flip($keysToIgnore));
+if ($mainAddress === $comparisonAddress) {
+  // They are the same... which to choose, which to choose :-)
+  return FALSE;
+}
 if (count($comparisonAddress) === 1
   && !empty($comparisonAddress['country_id'])
   && !empty($mainAddress['country_id'])

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I438fe2dd9f86b1a2a49fe7119ecb0656e04e3c4f
Gerrit-PatchSet: 2
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Eileen 
Gerrit-Reviewer: Eileen 
Gerrit-Reviewer: Ejegg 
Gerrit-Reviewer: jenkins-bot <>

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


  1   2   3   4   5   6   7   8   9   10   >