Check for null value
authorHeather Killam <heather.killam.kw@gmail.com>
Mon, 6 Jun 2016 01:17:37 +0000 (19:17 -0600)
committerHeather Killam <heather.killam.kw@gmail.com>
Mon, 6 Jun 2016 01:17:37 +0000 (19:17 -0600)
CRM/Contact/Form/Edit/Address.php

index aacbf14de03cc81bad0fc43f8941addffd165059..effbc4224e470855146d63f8282544ce757900f5 100644 (file)
@@ -361,9 +361,15 @@ class CRM_Contact_Form_Edit_Address {
             $address['street_address'] = $streetAddress;
           }
           if (isset($address['street_number'])) {
-            $address['street_number'] .= CRM_Utils_Array::value('street_number_suffix', $address);
+            // CRM-17619 - if the street number suffix begins with a number, add a space
+            $thesuffix = CRM_Utils_Array::value('street_number_suffix', $address);
+            if ($thesuffix) {
+              if (ctype_digit(substr($thesuffix, 0, 1))) {
+                $address['street_number'] .= " ";
+              }
+            }
+            $address['street_number'] .= $thesuffix;
           }
-
           // build array for set default.
           foreach ($parseFields as $field) {
             $addressValues["{$field}_{$cnt}"] = CRM_Utils_Array::value($field, $address);