% my $editi = $curuser->access_right('Edit customer package invoice details');
% my $editc = $curuser->access_right('Edit customer package comments');
+% my @cust_pkg_detail = $cust_pkg->cust_pkg_detail;
+% my @invoice_detail = grep { $_->detailtype eq 'I' } @cust_pkg_detail;
+% my @comments = grep { $_->detailtype eq 'C' } @cust_pkg_detail;
%
-% if ( $cust_pkg->cust_pkg_detail('I')
-% || $cust_pkg->cust_pkg_detail('C')
-% || $editi
-% || $editc ) {
+% if ( scalar(@invoice_detail) || scalar(@comments) || $editi || $editc ) {
%
% my $editlink = $p. 'edit/cust_pkg_detail?pkgnum='. $cust_pkg->pkgnum.
% ';detailtype=';
<TR>
-% if ( $cust_pkg->cust_pkg_detail('I') ) {
+% if ( @invoice_detail ) {
<TD VALIGN="top">
<% include('/elements/table-grid.html') %>
<TR>
</FONT>
</TH>
</TR>
-% foreach my $cust_pkg_detail ( $cust_pkg->cust_pkg_detail('I') ) {
+% foreach my $cust_pkg_detail ( @invoice_detail ) {
<TR>
<TD><FONT SIZE="-1"> - <% $cust_pkg_detail->detail |h %></FONT></TD>
</TR>
</TD>
% }
-% if ( $cust_pkg->cust_pkg_detail('C') ) {
+% if ( @comments ) {
<TD VALIGN="top">
<% include('/elements/table-grid.html') %>
<TR>
</FONT>
</TH>
</TR>
-% foreach my $cust_pkg_detail ( $cust_pkg->cust_pkg_detail('C') ) {
+% foreach my $cust_pkg_detail ( @comments ) {
<TR>
<TD><FONT SIZE="-1"> - <% $cust_pkg_detail->detail |h %></FONT></TD>
</TR>
}
sub pkg_change_link {
+ my $cust_pkg = shift;
+ my $locationnum = $cust_pkg->locationnum;
include( '/elements/popup_link-cust_pkg.html',
- 'action' => $p. 'misc/change_pkg.cgi?dummy=value',
- 'label' => 'Change package',
- 'actionlabel' => 'Change',
- 'cust_pkg' => shift,
- )
+ 'action' => $p. "misc/change_pkg.cgi?locationnum=$locationnum",
+ 'label' => 'Change package',
+ 'actionlabel' => 'Change',
+ 'cust_pkg' => $cust_pkg,
+ );
}
sub pkg_dates_link { pkg_link('edit/REAL_cust_pkg', 'Edit dates', @_ ); }