<& /elements/header-popup.html, $title &>
% if ( $curuser->option('show_pkgnum') ) { % } <& elements/detail-table.html, id => 'DetailTable', details => \@details, &>
Package # <% $pkgnum %>
Package <% $part_pkg->pkg %>
Comment <% $part_pkg->comment |h %>
Status <% ucfirst($cust_pkg->status) %>
<% ucfirst($name{$detailtype}) %>:

<%init> my %access_right = ( 'I' => 'Edit customer package invoice details', 'C' => 'Edit customer package comments', ); my %name = ( 'I' => 'invoice details', 'C' => 'package comments', ); my $curuser = $FS::CurrentUser::CurrentUser; $cgi->param('detailtype') =~ /^(\w)$/ or die 'illegal detailtype'; my $detailtype = $1; my $right = $access_right{$detailtype}; die "access denied" unless $curuser->access_right($right); $cgi->param('pkgnum') =~ /^(\d+)$/ or die 'illegal pkgnum'; my $pkgnum = $1; my $cust_pkg = qsearchs({ 'table' => 'cust_pkg', 'addl_from' => 'LEFT JOIN cust_main USING ( custnum )', 'hashref' => { 'pkgnum' => $pkgnum }, 'extra_sql' => ' AND '. $curuser->agentnums_sql, }); my $part_pkg = $cust_pkg->part_pkg; my @details = map { $_->detail } $cust_pkg->cust_pkg_detail($detailtype); my $title = ( scalar(@details) ? 'Edit ' : 'Add ' ). $name{$detailtype};