From: ivan Date: Fri, 29 Sep 2006 17:22:22 +0000 (+0000) Subject: fix problem with viewing unlinked services X-Git-Tag: TRIXBOX_2_6~943 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=8abffd15f7fa51e8b62f03ffa21a01974813f99f fix problem with viewing unlinked services --- diff --git a/FS/FS/access_user.pm b/FS/FS/access_user.pm index 874da6687..ca0bcd657 100644 --- a/FS/FS/access_user.pm +++ b/FS/FS/access_user.pm @@ -298,12 +298,13 @@ Returns an sql fragement to select only agentnums this user can view. sub agentnums_sql { my $self = shift; - my @agentnums = $self->agentnums; - return ' 1 = 0 ' unless scalar(@agentnums); + my @agentnums = map { "agentnum = $_" } $self->agentnums; + + push @agentnums, 'agentnum IS NULL' + if $self->access_right('View/link unlinked services'); - '( '. - join( ' OR ', map "agentnum = $_", @agentnums ). - ' )'; + return ' 1 = 0 ' unless scalar(@agentnums); + '( '. join( ' OR ', @agentnums ). ' )'; } =item agentnum