default to a session cookie instead of setting an explicit timeout, weird timezone...
[freeside.git] / httemplate / search / agent_commission.html
1 % if ( $agentnum ) {
2 %   my $url = 'agent_pkg_class.html?' . $cgi->query_string;
3 <% $cgi->redirect($url) %>
4 % } else {
5 <& elements/commission.html,
6   'title'         => $title,
7   'name_singular' => 'agent',
8   'header'        => [ 'Agent' ],
9   'fields'        => [ 'agent' ],
10   'links'         => [ '' ],
11   'align'         => 'l',
12   'query'         => \%query,
13   'count_query'   => $count_query,
14   'disableable'   => 1,
15   'sales_detail_link'   => $sales_link,
16   'credit_detail_link'  => $commission_link,
17 &>
18 % }
19 <%init>
20
21 die "access denied"
22   unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
23
24 my $conf = new FS::Conf;
25
26 my %query = ( 'table' => 'agent' );
27 my $count_query = "SELECT COUNT(*) FROM agent";
28
29 my $agentnum = '';
30 if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
31   $agentnum = $1;
32 } else {
33   $cgi->delete('agentnum');
34 }
35
36 my $title = 'Agent commission';
37
38 my $sales_link = [ 'agent_pkg_class.html?agentnum=', 'agentnum' ];
39
40 my $commission_link = [ 'cust_credit.html?commission_agentnum=', 'agentnum' ];
41
42 </%init>