[freeside-commits] freeside/FS/FS access_user.pm,1.16,1.17

Ivan,,, ivan at wavetail.420.am
Fri Sep 28 19:17:50 PDT 2007


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail:/tmp/cvs-serv1047/FS/FS

Modified Files:
	access_user.pm 
Log Message:
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)

Index: access_user.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/access_user.pm,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- access_user.pm	1 Aug 2007 22:24:36 -0000	1.16
+++ access_user.pm	29 Sep 2007 02:17:48 -0000	1.17
@@ -323,6 +323,8 @@
 
 =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 @@
   my( $self ) = shift;
   my %opt = ref($_[0]) ? %{$_[0]} : @_;
 
-  my @agentnums = map { "agentnum = $_" } $self->agentnums;
+  my $agentnum = $opt{'table'} ? $opt{'table'}.'.agentnum' : 'agentnum';
 
-  push @agentnums, 'agentnum IS NULL'
+  my @agentnums = map { "$agentnum = $_" } $self->agentnums;
+
+  push @agentnums, "$agentnum IS NULL"
     if $opt{'null'}
     || ( $opt{'null_right'} && $self->access_right($opt{'null_right'}) );
 



More information about the freeside-commits mailing list