diff options
author | ivan <ivan> | 2009-02-08 02:05:25 +0000 |
---|---|---|
committer | ivan <ivan> | 2009-02-08 02:05:25 +0000 |
commit | 8b72ad2a4d67f46e4bda36179e992d82d069689f (patch) | |
tree | 5caa8331a3c04910d341dce7977be4b4c05f0ad5 /httemplate/edit | |
parent | d4ac14699c56a2e5a9b8d2ce24c4c6ee837327c6 (diff) |
further work on agents editing own packages: allow them to see (but not edit) global packages for their type, RT#1331
Diffstat (limited to 'httemplate/edit')
-rwxr-xr-x | httemplate/edit/cust_main.cgi | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index 8f29c5da2..1e2ab0f6f 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -568,22 +568,33 @@ function copyelement(from, to) { % % #false laziness, copied from FS::cust_pkg::order % my $pkgpart; +% my $agentnum = ''; % my @agents = $FS::CurrentUser::CurrentUser->agents; % if ( scalar(@agents) == 1 ) { % # $pkgpart->{PKGPART} is true iff $custnum may purchase PKGPART % $pkgpart = $agents[0]->pkgpart_hashref; +% $agentnum = $agents[0]->agentnum; % } else { % #can't know (agent not chosen), so, allow all +% $agentnum = 'all'; % my %typenum; % foreach my $agent ( @agents ) { % next if $typenum{$agent->typenum}++; -% #fixed in 5.004_05 #$pkgpart->{$_}++ foreach keys %{ $agent->pkgpart_hashref } -% foreach ( keys %{ $agent->pkgpart_hashref } ) { $pkgpart->{$_}++; } #5.004_04 workaround +% $pkgpart->{$_}++ foreach keys %{ $agent->pkgpart_hashref } % } % } % #eslaf % -% my @part_pkg = grep { $_->svcpart('svc_acct') && $pkgpart->{ $_->pkgpart } } +% my @part_pkg = grep { $_->svcpart('svc_acct') +% && ( $pkgpart->{ $_->pkgpart } +% || $agentnum eq 'all' +% || ( $agentnum ne 'all' +% && $agentnum +% && $_->agentnum +% && $_->agentnum == $agentnum +% ) +% ) +% } % qsearch( 'part_pkg', { 'disabled' => '' }, '', 'ORDER BY pkg' ); # case? % % if ( @part_pkg ) { |