[freeside-commits] freeside/httemplate/search bill_batch.cgi, 1.2, 1.3

Ivan,,, ivan at wavetail.420.am
Wed Jul 20 11:34:21 PDT 2011


Update of /home/cvs/cvsroot/freeside/httemplate/search
In directory wavetail.420.am:/tmp/cvs-serv12005/httemplate/search

Modified Files:
	bill_batch.cgi 
Log Message:
per-agent invoice PDF batches, RT#13727

Index: bill_batch.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/bill_batch.cgi,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -d -r1.2 -r1.3
--- bill_batch.cgi	27 May 2011 01:11:02 -0000	1.2
+++ bill_batch.cgi	20 Jul 2011 18:34:19 -0000	1.3
@@ -3,10 +3,10 @@
 		 'name_singular' => 'batch',
 		 'query'         => { 'table'     => 'bill_batch',
 		                      'hashref'   => $hashref,
-				      'extra_sql' => $extra_sql.
-                                        'ORDER BY batchnum DESC',
+				      #'extra_sql' => $extra_sql.
+                                      'order_by'  => 'ORDER BY batchnum DESC',
 				    },
-		 'count_query'   => "$count_query $extra_sql",
+		 'count_query'   => $count_query,
 		 'header'        => [ 'Batch',
 				      'Item Count',
 				      'Status',
@@ -42,19 +42,30 @@
 				      sub { shift->status eq 'O' ? "b" : '' },
 				    ],
                  'really_disable_download' => 1,
+                 'agent_virt' => 1,
+                 'agent_null_right' => [ 'Process global invoice batches', 'Configuration' ],
+                 'agent_pos' => 1,
+
       )
 
 %>
 <%init>
 
+my $curuser = $FS::CurrentUser::CurrentUser;
+
 die "access denied"
-  unless $FS::CurrentUser::CurrentUser->access_right('View invoices');
+  unless $curuser->access_right('Process invoice batches')
+      || $curuser->access_right('Process global invoice batches')
+      || $curuser->access_right('Configuration'); #remove in 2.5
 
 my %statusmap = ('O'=>'Open', 'R'=>'Closed');
 my $hashref = {};
-my $count_query = 'SELECT COUNT(*) FROM bill_batch';
+my $count_query = "SELECT COUNT(*) FROM bill_batch WHERE". # $extra_sql AND "
+                    $curuser->agentnums_sql(
+                      'null_right' => ['Process global invoice batches', 'Configuration' ],
+                    );
 
-my $extra_sql = ''; # may add something here later
+#my $extra_sql = ''; # may add something here later
 my $link = [ "${p}view/bill_batch.cgi?batchnum=", 'batchnum' ];
 my $dlink = sub {
   [ "${p}view/bill_batch.cgi?start_download=1;".



More information about the freeside-commits mailing list