X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fbrowse%2Fpart_pkg.cgi;h=801c09f8f1726007299923928eff5fbc5e58d722;hb=52b311cb03ee6714c2ea8d108efdfef86c2c3e1d;hp=780f40b9fa797ad7d51e307e8d3b6f756d5e3a86;hpb=8b72ad2a4d67f46e4bda36179e992d82d069689f;p=freeside.git diff --git a/httemplate/browse/part_pkg.cgi b/httemplate/browse/part_pkg.cgi index 780f40b9f..801c09f8f 100755 --- a/httemplate/browse/part_pkg.cgi +++ b/httemplate/browse/part_pkg.cgi @@ -30,6 +30,7 @@ my $edit_global = 'Edit global package definitions'; my $acl_edit = $curuser->access_right($edit); my $acl_edit_global = $curuser->access_right($edit_global); my $acl_config = $curuser->access_right('Configuration'); #to edit services + #and agent types die "access denied" unless $acl_edit || $acl_edit_global; @@ -46,23 +47,11 @@ if ( $cgi->param('active') ) { my $extra_sql = ''; -my $agentnums = join(',', $curuser->agentnums); - unless ( $acl_edit_global ) { - $extra_sql .= " - WHERE ( - agentnum IS NOT NULL OR 0 < ( - SELECT COUNT(*) - FROM type_pkgs - LEFT JOIN agent_type USING ( typenum ) - LEFT JOIN agent AS typeagent USING ( typenum ) - WHERE type_pkgs.pkgpart = part_pkg.pkgpart - AND typeagent.agentnum IN ($agentnums) - ) - ) - "; + $extra_sql .= ' WHERE '. FS::part_pkg->curuser_pkgs_sql; } +my $agentnums = join(',', $curuser->agentnums); my $count_cust_pkg = " SELECT COUNT(*) FROM cust_pkg LEFT JOIN cust_main USING ( custnum ) WHERE cust_pkg.pkgpart = part_pkg.pkgpart @@ -95,7 +84,12 @@ my $html_init; One or more service definitions are grouped together into a package definition and given pricing information. Customers purchase packages rather than purchase services directly.

+
Add a new package definition + or + !.include('/elements/select-part_pkg.html', 'element_name' => 'clone' ). qq! + +


!; #} @@ -181,6 +175,40 @@ push @fields, sub { # $part_pkg->freq_pretty; #.'
' }; +### +# Agent goes here if displayed +### + +#agent type +if ( $acl_edit_global ) { + #really we just want a count, but this is fine unless someone has tons + my @all_agent_types = map {$_->typenum} qsearch('agent_type',{}); + if ( scalar(@all_agent_types) > 1 ) { + push @header, 'Agent types'; + my $typelink = $p. 'edit/agent_type.cgi?'; + push @fields, sub { my $part_pkg = shift; + [ + map { warn $_; + my $agent_type = $_->agent_type; + warn $agent_type; + [ + { 'data' => $agent_type->atype, #escape? + 'align' => 'left', + 'link' => ( $acl_config + ? $typelink. + $agent_type->typenum + : '' + ), + }, + ]; + } + $part_pkg->type_pkgs + ]; + }; + $align .= 'l'; + } +} + #if ( $cgi->param('active') ) { push @header, 'Customer
packages'; my %col = (