[freeside-commits] freeside/httemplate/elements tr-select-agent.html, 1.1, 1.2 select-table.html, 1.2, 1.3 select-agent.html, 1.2, 1.3

Ivan,,, ivan at wavetail.420.am
Sun Jun 18 19:33:54 PDT 2006


Update of /home/cvs/cvsroot/freeside/httemplate/elements
In directory wavetail:/tmp/cvs-serv8904/httemplate/elements

Modified Files:
	tr-select-agent.html select-table.html select-agent.html 
Log Message:
agent virtualization, take one (stuff from "inactive" changeset snuck into cust_main.pm and the package reporting changeset in search/cust_pkg.cgi here too)

Index: select-agent.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/select-agent.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- select-agent.html	22 Apr 2006 00:58:39 -0000	1.2
+++ select-agent.html	19 Jun 2006 02:33:52 -0000	1.3
@@ -11,6 +11,8 @@
                  'value'       => $agentnum,
                  'empty_label' => 'all',
                  'hashref'     => { 'disabled' => '' },
+                 'extra_sql'   => ' AND '.
+                                  $FS::CurrentUser::CurrentUser->agentnums_sql,
                  %select_opt,
              )
 %>

Index: select-table.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/select-table.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- select-table.html	7 May 2006 20:27:21 -0000	1.2
+++ select-table.html	19 Jun 2006 02:33:52 -0000	1.3
@@ -10,6 +10,7 @@
   ##opt
   # 'empty_label' => '', #better specify it though, the default might change
   # 'hashref'     => {},
+  # 'extra_sql'   => '',
   # 'records'     => \@records, #instead of hashref
   # 'pre_options' => [ 'value' => 'option' ], #before normal options
 
@@ -25,7 +26,11 @@
   if ( $opt{'records'} ) {
     @records = @{ $opt{'records'} };
   } else {
-    @records = qsearch( $opt{'table'}, ( $opt{'hashref'} || {} ) );
+    @records = qsearch( {
+      'table'     => $opt{'table'},
+      'hashref'   => ( $opt{'hashref'} || {} ),
+      'extra_sql' => ( $opt{'extra_sql'} || '' ),
+    });
   }
 
   my @pre_options = $opt{'pre_options'} ? @{ $opt{'pre_options'} } : ();

Index: tr-select-agent.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/tr-select-agent.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- tr-select-agent.html	22 Dec 2005 04:01:17 -0000	1.1
+++ tr-select-agent.html	19 Jun 2006 02:33:52 -0000	1.2
@@ -3,9 +3,16 @@
 
   my @agents;
   if ( $opt{'agents'} ) {
-    @agents = @{ $opt{'agents'} };
+    #@agents = @{ $opt{'agents'} };
+    #here is the agent virtualization
+    my $agentnums_href = $FS::CurrentUser::CurrentUser->agentnums_href;
+    @agents = grep $agentnums_href->{$_->agentnum}, @{ $opt{'agents'} };
   } else {
-    @agents = qsearch( 'agent', { disabled=>'' } );
+    @agents = qsearch( {
+      'table'     => 'agent',
+      'hashref'   => { disabled=>'' },
+      'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
+    });
   }
 
 %>



More information about the freeside-commits mailing list