Mwalker has submitted this change and it was merged.

Change subject: paypal subscr_payment does not always contain an address
......................................................................


paypal subscr_payment does not always contain an address

Change-Id: I24e810c562a47c015918b3a081d6473508698b18
---
M sites/all/modules/queue2civicrm/recurring/recurring.module
1 file changed, 24 insertions(+), 23 deletions(-)

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



diff --git a/sites/all/modules/queue2civicrm/recurring/recurring.module 
b/sites/all/modules/queue2civicrm/recurring/recurring.module
index d616536..eca7c4c 100644
--- a/sites/all/modules/queue2civicrm/recurring/recurring.module
+++ b/sites/all/modules/queue2civicrm/recurring/recurring.module
@@ -592,29 +592,30 @@
          $msg_normalized[ 'first_name' ] = $msg[ 'first_name' ];
          $msg_normalized[ 'middle_name' ] = '';
          $msg_normalized[ 'last_name' ] = $msg[ 'last_name' ];
-         $split = split("\n", str_replace("\r", '', $msg[ 'address_street' ]));
-         $msg_normalized[ 'street_address' ] = $split[0];
-         if ( count( $split ) > 1 ) {
-           $msg_normalized[ 'supplemental_address_1' ] = $split[1];
-         }
-         $msg_normalized[ 'city' ] = $msg[ 'address_city' ];
-         $msg_normalized[ 'state_province' ] = $msg[ 'address_state' ];
-         $msg_normalized[ 'country' ] = $msg[ 'address_country_code' ];
-         $msg_normalized[ 'postal_code' ] = $msg[ 'address_zip' ];
-       
-         // Shipping info (address same as above since PayPal only passes 1 
address)
-         $split = split(" ", $msg[ 'address_name' ]);
-         $msg_normalized[ 'last_name_2' ] = array_pop($split);
-         $msg_normalized[ 'first_name_2' ] = implode(" ", $split);
-         $split = split("\n", str_replace("\r", '', $msg[ 'address_street' ]));
-         $msg_normalized[ 'street_address_2' ] = $split[0];
-         if ( count( $split ) > 1 ) {
-           $msg_normalized[ 'supplemental_address_2' ] = $split[1];
-         }
-         $msg_normalized[ 'city_2' ] = $msg[ 'address_city' ];
-         $msg_normalized[ 'state_province_2' ] = $msg[ 'address_state' ];
-         $msg_normalized[ 'country_2' ] = $msg[ 'address_country_code' ];
-         $msg_normalized[ 'postal_code_2' ] = $msg[ 'address_zip' ];
+
+      if ( isset( $msg['address_street'] ) ) {
+          $split = split("\n", str_replace("\r", '', $msg[ 'address_street' 
]));
+          $msg_normalized[ 'street_address' ] = $split[0];
+          if ( count( $split ) > 1 ) {
+            $msg_normalized[ 'supplemental_address_1' ] = $split[1];
+          }
+          $msg_normalized[ 'city' ] = $msg[ 'address_city' ];
+          $msg_normalized[ 'state_province' ] = $msg[ 'address_state' ];
+          $msg_normalized[ 'country' ] = $msg[ 'address_country_code' ];
+          $msg_normalized[ 'postal_code' ] = $msg[ 'address_zip' ];
+
+          // Shipping info (address same as above since PayPal only passes 1 
address)
+          $split = split(" ", $msg[ 'address_name' ]);
+          $msg_normalized[ 'last_name_2' ] = array_pop($split);
+          $msg_normalized[ 'first_name_2' ] = implode(" ", $split);
+          $split = split("\n", str_replace("\r", '', $msg[ 'address_street' 
]));
+          $msg_normalized[ 'street_address_2' ] = $split[0];
+          if ( count( $split ) > 1 ) {
+            $msg_normalized[ 'supplemental_address_2' ] = $split[1];
+          }
+      } elseif ( isset( $msg['residence_country'] ) ) {
+        $msg_normalized['country'] = $msg['residence_country'];
+      }
   }
   
   // payment-specific message handling

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I24e810c562a47c015918b3a081d6473508698b18
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Adamw <[email protected]>
Gerrit-Reviewer: Adamw <[email protected]>
Gerrit-Reviewer: Katie Horn <[email protected]>
Gerrit-Reviewer: Mwalker <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to