You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/BAG/GravityForms/BAGAddress/BAGLookup.php
+26Lines changed: 26 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -87,6 +87,32 @@ protected function processResponse($response): string
87
87
]);
88
88
}
89
89
90
+
// If no addition was provided, try to find the result without any addition
91
+
if ($this->homeNumberAddition === '') {
92
+
$exactMatch = null;
93
+
94
+
foreach ($response->docsas$doc) {
95
+
if (!isset($doc->huisnummertoevoeging) && !isset($doc->huisletter)) {
96
+
$exactMatch = $doc;
97
+
break;
98
+
}
99
+
}
100
+
101
+
if ($exactMatch !== null) {
102
+
$address = newBAGEntity($exactMatch);
103
+
return\wp_send_json_success([
104
+
'message' => __('1 result found', config('core.text_domain')),
105
+
'results' => [
106
+
'street' => $address->straatnaam,
107
+
'houseNumber' => $address->huisnummer,
108
+
'city' => $address->woonplaatsnaam,
109
+
'zip' => $address->postcode,
110
+
'displayname' => $address->weergavenaam
111
+
]
112
+
]);
113
+
}
114
+
}
115
+
90
116
returnwp_send_json_error(
91
117
[
92
118
'message' => __('Found too many results. Try to make the address more specific. For example with a house number addition', config('core.text_domain')),
0 commit comments