File tree Expand file tree Collapse file tree 1 file changed +15
-7
lines changed
Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -100,16 +100,24 @@ public function getAnyPhoneNumber() {
100100 $ phoneNo = $ numbers ['tel ' ];
101101 }
102102 if (array_key_exists ('kontakty ' , $ numbers ) && !empty ($ numbers ['kontakty ' ])) {
103+
104+ // Try to use primary contact if present
103105 foreach ($ numbers ['kontakty ' ] as $ kontakt ) {
104106 if ($ kontakt ['primarni ' ] == 'true ' ) {
105-
107+ if (strlen (trim ($ kontakt ['mobil ' ]))) {
108+ $ phoneNo = $ kontakt ['mobil ' ];
109+ break ;
110+ }
106111 }
107- if (strlen (trim ($ kontakt ['mobil ' ]))) {
108- $ phoneNo = $ kontakt ['mobil ' ];
109- break ;
110- } elseif (strlen (trim ($ kontakt ['mobil ' ]))) {
111- $ phoneNo = $ kontakt ['mobil ' ];
112- break ;
112+ }
113+
114+ // Use first contact if no primary is set
115+ if (is_null ($ phoneNo )) {
116+ foreach ($ numbers ['kontakty ' ] as $ kontakt ) {
117+ if (strlen (trim ($ kontakt ['mobil ' ]))) {
118+ $ phoneNo = $ kontakt ['mobil ' ];
119+ break ;
120+ }
113121 }
114122 }
115123 }
You can’t perform that action at this time.
0 commit comments