From 8b0b00d221578b8912eb1540c453eb5f7156ea52 Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 9 Aug 2005 07:08:21 +0000 Subject: [PATCH] phone numbers will be replaced correctly, git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1083 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../gofon/phoneaccount/class_phoneAccount.inc | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/plugins/gofon/phoneaccount/class_phoneAccount.inc b/plugins/gofon/phoneaccount/class_phoneAccount.inc index 5fd9f63a2..4dacfe3ca 100644 --- a/plugins/gofon/phoneaccount/class_phoneAccount.inc +++ b/plugins/gofon/phoneaccount/class_phoneAccount.inc @@ -709,12 +709,37 @@ class phoneAccount extends plugin $this->macrostillavailable=true; } + if(is_array($this->phoneNumbers)){ + foreach($this->phoneNumbers as $telenumms) { + $nummsinorder[]=$telenumms; + } + }else{ + $nummsinorder=array(""); + } /* get all Postvars */ if(isset($this->macroarray[$this->macro])){ foreach($this->macroarray[$this->macro] as $key => $paras){ if(isset($_POST[$paras['var']])){ - $this->macroarray[$this->macro][$key]['choosen'] = $_POST[$paras['var']]; + $par = $this->macroarray[$this->macro][$key]; + $string = ""; + if(preg_match("/.*%telephoneNumber_.*/",$par['default'])){ + $string = $par['default']; + foreach($nummsinorder as $nummsinorderkey=> $nummsinorderval){ + $string = (str_replace("%telephoneNumber_".($nummsinorderkey+1),$nummsinorderval,$string)); + } + } + + if(preg_match("/.*%uid.*/",$par['default'])){ + if(empty($string)) $string = $par['default']; + $string = str_replace("%uid",$this->uid,$string); + } + + if(!empty($string)){ + $this->macroarray[$this->macro][$key]['choosen'] = $string; + }else{ + $this->macroarray[$this->macro][$key]['choosen'] = $_POST[$paras['var']]; + } } /* Checkboxes are special, they are not Posted if they are not selected, so the won't be changed with the above code -- 2.30.2