diff options
author | ivan <ivan> | 2007-09-29 02:17:48 +0000 |
---|---|---|
committer | ivan <ivan> | 2007-09-29 02:17:48 +0000 |
commit | 4b5c6ba830fe2845a0055e1fcf5af0c7e8b8cd0c (patch) | |
tree | 4f79e06b5214a13597258acc1d8e528cd884dc32 /FS | |
parent | 11f1a064f3618bac4078c8ae86654b3182ec0e07 (diff) |
fix ambiguous agentnum errors in cust_event.html & report_tax.cgi (provide a table option in access_user::agentnums_sql so this is easy to fix for other reports too)
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS/access_user.pm | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/FS/FS/access_user.pm b/FS/FS/access_user.pm index 8e4ad46bd..e3a677b11 100644 --- a/FS/FS/access_user.pm +++ b/FS/FS/access_user.pm @@ -323,6 +323,8 @@ Options are passed as a hashref or a list. Available options are: =item null_right - The fragment will also allow the selection of null agentnums if the current user has the provided access right +=item table - Optional table name in which agentnum is being checked. Sometimes required to resolve 'column reference "agentnum" is ambiguous' errors. + =back =cut @@ -331,9 +333,11 @@ sub agentnums_sql { my( $self ) = shift; my %opt = ref($_[0]) ? %{$_[0]} : @_; - my @agentnums = map { "agentnum = $_" } $self->agentnums; + my $agentnum = $opt{'table'} ? $opt{'table'}.'.agentnum' : 'agentnum'; + + my @agentnums = map { "$agentnum = $_" } $self->agentnums; - push @agentnums, 'agentnum IS NULL' + push @agentnums, "$agentnum IS NULL" if $opt{'null'} || ( $opt{'null_right'} && $self->access_right($opt{'null_right'}) ); |