diff options
author | Ivan Kohler <ivan@freeside.biz> | 2013-10-24 23:29:58 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2013-10-24 23:29:58 -0700 |
commit | 2e7ce01632012ccc0dd440a8bc37a9ec9bd55fac (patch) | |
tree | bf00d00f00e9bfd0b7cc4273207f4e84c52da5d7 /httemplate | |
parent | 7b20719d5f7269adfebf55975766cd6eca4a7dd5 (diff) |
limit sales reports for employee, RT#25524
Diffstat (limited to 'httemplate')
-rw-r--r-- | httemplate/edit/access_user.html | 22 | ||||
-rw-r--r-- | httemplate/search/report_sales_commission.html | 42 |
2 files changed, 38 insertions, 26 deletions
diff --git a/httemplate/edit/access_user.html b/httemplate/edit/access_user.html index b087943c2..2d39f969c 100644 --- a/httemplate/edit/access_user.html +++ b/httemplate/edit/access_user.html @@ -7,17 +7,19 @@ 'last', 'first', { field=>'user_custnum', type=>'search-cust_main', }, + { field=>'report_salesnum', type=>'select-sales', empty_label=>'all', }, { field=>'disabled', type=>'checkbox', value=>'Y' }, ], 'labels' => { - 'usernum' => 'User number', - 'username' => 'Username', - '_password' => 'Password', - '_password2' => 'Re-enter Password', - 'last' => 'Last name', - 'first' => 'First name', - 'user_custnum' => 'Customer (optional)', - 'disabled' => 'Disable employee', + 'usernum' => 'User number', + 'username' => 'Username', + '_password' => 'Password', + '_password2' => 'Re-enter Password', + 'last' => 'Last name', + 'first' => 'First name', + 'user_custnum' => 'Customer (optional)', + 'report_salesnum' => 'Limit commission report to sales person', + 'disabled' => 'Disable employee', }, 'edit_callback' => \&edit_callback, 'field_callback'=> \&field_callback, @@ -68,8 +70,8 @@ my $check_user_custnum_search = <<END; END sub edit_callback { - my ($c, $o, $f, $opt) = @_; - $o->set('_password', ''); + my ($cgi, $access_user, $fields_listref, $opt_hashref) = @_; + $access_user->_password(''); } sub field_callback { diff --git a/httemplate/search/report_sales_commission.html b/httemplate/search/report_sales_commission.html index 792c3353e..19af428d8 100644 --- a/httemplate/search/report_sales_commission.html +++ b/httemplate/search/report_sales_commission.html @@ -4,25 +4,34 @@ <TABLE BGCOLOR="#cccccc" CELLSPACING=0> -<& /elements/tr-select-agent.html, - 'onchange' => 'agent_changed(this)', -&> +% if ( $curuser->report_salesnum ) { -<SCRIPT TYPE="text/javascript"> + <INPUT TYPE="hidden" NAME="agentnum" VALUE="<% $curuser->report_sales->agentnum %>"> + <INPUT TYPE="hidden" NAME="salesnum" VALUE="<% $curuser->report_salesnum %>"> - function agent_changed(what) { - salesnum_agentnum_changed(what); - } +% } else { - <&| /elements/onload.js &> - agent_changed(document.getElementById('agentnum')) - </&> + <& /elements/tr-select-agent.html, + 'onchange' => 'agent_changed(this)', + &> -</SCRIPT> + <SCRIPT TYPE="text/javascript"> -<& /elements/tr-select-sales.html, - 'empty_label' => 'all', -&> + function agent_changed(what) { + salesnum_agentnum_changed(what); + } + + <&| /elements/onload.js &> + agent_changed(document.getElementById('agentnum')) + </&> + + </SCRIPT> + + <& /elements/tr-select-sales.html, + 'empty_label' => 'all', + &> + +% } <& /elements/tr-checkbox.html, 'label' => 'Customer sales person if there is no package sales person', @@ -46,7 +55,8 @@ <% include('/elements/footer.html') %> <%init> -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Financial reports'); +my $curuser = $FS::CurrentUser::CurrentUser; + +die "access denied" unless $curuser->access_right('Financial reports'); </%init> |