From: cajus Date: Thu, 8 Oct 2009 09:35:46 +0000 (+0000) Subject: Remove remaining links if there are already #n existing accounts. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=48bf41101210813c9cd6d7aa2bd61a1a80cac419;p=gosa.git Remove remaining links if there are already #n existing accounts. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14563 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/include/functions.inc b/gosa-core/include/functions.inc index 28e5a7fc8..aa28014a0 100644 --- a/gosa-core/include/functions.inc +++ b/gosa-core/include/functions.inc @@ -1743,7 +1743,7 @@ function gen_uids($rule, $attributes) $size= preg_replace('/^.*{id(:|!)(\d+)}.*$/', '\\2', $uid); $start= $m[1]==":"?0:-1; - for ($i= $start, $p= pow(10,$size); $i < $p; $i++){ + for ($i= $start, $p= pow(10,$size)-1; $i < $p; $i++){ if ($i == -1) { $number= ""; } else { @@ -1757,6 +1757,9 @@ function gen_uids($rule, $attributes) break; } } + + /* Remove link if nothing has been found */ + $uid= preg_replace('/{id(:|!)\d+}/', '', $uid); } if(preg_match('/\{id#\d+}/',$uid)){ @@ -1772,6 +1775,9 @@ function gen_uids($rule, $attributes) break; } } + + /* Remove link if nothing has been found */ + $uid= preg_replace('/{id#\d+}/', '', $uid); } /* Don't assign used ones */