From: cajus Date: Thu, 18 Feb 2010 08:38:02 +0000 (+0000) Subject: Took patch. Thanks. Closes #782 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=da6cbcf9e62f081e2e32d6a19e04fe892f253dd1;p=gosa.git Took patch. Thanks. Closes #782 git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15643 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/gofon/gofon/phoneaccount/class_phoneAccount.inc b/gosa-plugins/gofon/gofon/phoneaccount/class_phoneAccount.inc index d62f786d0..96d61a66d 100644 --- a/gosa-plugins/gofon/gofon/phoneaccount/class_phoneAccount.inc +++ b/gosa-plugins/gofon/gofon/phoneaccount/class_phoneAccount.inc @@ -410,6 +410,17 @@ class phoneAccount extends plugin return($ret); } + function stripInvalidChars($tele){ + /* Strip invalid chars, but maintain a leading + for international numbers */ + $t_tele= preg_replace("/[^0-9]/","",$tele); + if (preg_match('/^\+/', $tele)) { + $t_tele= "+".$t_tele; + } + return($t_tele); + } + + + /* This function generates the Database entries. * The Parameter 'save' could be true or false. @@ -478,17 +489,11 @@ class phoneAccount extends plugin /* Prepare some basic attributes */ $oldnums = array(); - /* Strip invalid chars, but maintain a leading + for international numbers */ - $t_tele= preg_replace("/[^0-9]/","",$tele); - if (preg_match('/^\+/', $tele)) { - $t_tele= "+".$t_tele; - } - foreach($this->a_old_telenums as $tele){ - $oldnums[]= $t_tele; + $oldnums[]= $this->stripInvalidChars($tele); } foreach($this->phoneNumbers as $tele){ - $newnums[]= $t_tele; + $newnums[]= $this->stripInvalidChars($tele); } if(empty($this->uid)) trigger_error("Uid is empty.");