Bernd Wurst commited on 2024-08-23 18:21:09
Zeige 1 geänderte Dateien mit 24 Einfügungen und 4 Löschungen.
... | ... |
@@ -1,6 +1,25 @@ |
1 | 1 |
<?php |
2 | 2 |
require_once('api.php'); |
3 | 3 |
|
4 |
+ |
|
5 |
+function phonetisch_reduzieren($word) |
|
6 |
+{ |
|
7 |
+ $word=strtolower($word); |
|
8 |
+ $substitution=array( |
|
9 |
+ "ä"=>"ae", |
|
10 |
+ "ö"=>"oe", |
|
11 |
+ "ü"=>"ue", |
|
12 |
+ "ß"=>"ss", |
|
13 |
+ "ph"=>"f" |
|
14 |
+ ); |
|
15 |
+ |
|
16 |
+ foreach ($substitution as $letter=>$substitution) { |
|
17 |
+ $word=str_replace($letter,$substitution,$word); |
|
18 |
+ } |
|
19 |
+ return $word; |
|
20 |
+} |
|
21 |
+ |
|
22 |
+ |
|
4 | 23 |
function suche_kunde($name, $number) { |
5 | 24 |
global $content; |
6 | 25 |
if (! $number) { |
... | ... |
@@ -18,10 +37,11 @@ function suche_kunde($name, $number) { |
18 | 37 |
$name = strtolower($name); |
19 | 38 |
foreach ($ret as $item) { |
20 | 39 |
$cust = $item['customer']; |
21 |
- if ((isset($cust['lastname']) && $name == strtolower($cust['lastname'])) || |
|
22 |
- (isset($cust['firstname']) && $name == strtolower($cust['firstname'])) || |
|
23 |
- (isset($cust['firstname']) && isset($cust['lastname']) && $name == strtolower($cust['firstname'] .' '. $cust['lastname'])) || |
|
24 |
- (isset($cust['firstname']) && isset($cust['lastname']) && $name == strtolower($cust['lastname'] .' '. $cust['firstname'])) |
|
40 |
+ if ((isset($cust['lastname']) && phonetisch_reduzieren($name) == phonetisch_reduzieren($cust['lastname'])) || |
|
41 |
+ (isset($cust['firstname']) && phonetisch_reduzieren($name) == phonetisch_reduzieren($cust['firstname'])) || |
|
42 |
+ (isset($cust['firstname']) && isset($cust['lastname']) && phonetisch_reduzieren($name) == phonetisch_reduzieren($cust['firstname'] .' '. $cust['lastname'])) || |
|
43 |
+ (isset($cust['firstname']) && isset($cust['lastname']) && phonetisch_reduzieren($name) == phonetisch_reduzieren($cust['lastname'] .' '. $cust['firstname'])) || |
|
44 |
+ (isset($cust['firstname']) && isset($cust['lastname']) && phonetisch_reduzieren($name) == phonetisch_reduzieren($cust['lastname'] .', '. $cust['firstname'])) |
|
25 | 45 |
) { |
26 | 46 |
return $cust; |
27 | 47 |
} |
28 | 48 |