diff --git a/include/class.sequence.php b/include/class.sequence.php index ebd4fe862abc3f1fb416e5bab46646d3ae30e82d..1b3fc3182ec1e890d8517d3c2969818d862fb40a 100644 --- a/include/class.sequence.php +++ b/include/class.sequence.php @@ -42,11 +42,17 @@ class Sequence extends VerySimpleModel { */ function next($format=false, $check=false) { $digits = $format ? $this->getDigitCount($format) : false; + + if ($check && !is_callable($check)) + $check = false; + do { $next = $this->__next($digits); $formatted = $format ? $this->format($format, $next) : $next; } - while ($check && !$check($formatted, $next)); + while ($check + && !call_user_func_array($check, array($formatted, $next))); + return $formatted; }