+my $html_init = sub {
+ my $query = shift;
+ my $text = '';
+ my $curuser = $FS::CurrentUser::CurrentUser;
+
+ if ( $curuser->access_right('Bulk change customer packages') ) {
+ $text .= include('/elements/init_overlib.html').
+ include( '/elements/popup_link.html',
+ 'label' => emt('Change these packages'),
+ 'action' => "${p}misc/bulk_change_pkg.cgi?$query",
+ 'actionlabel' => emt('Change Packages'),
+ 'width' => 569,
+ 'height' => 210,
+ ). '<BR>';
+
+ $text .= include( '/elements/popup_link.html',
+ 'label' => emt('Suspend these packages'),
+ 'action' => "${p}misc/bulk_suspend_pkg.cgi?$query",
+ 'actionlabel' => emt('Suspend Packages'),
+ 'width' => 569,
+ 'height' => 210,
+ ). '<BR>' if $search_hash{status} eq 'active';
+
+ $text .= include( '/elements/popup_link.html',
+ 'label' => emt('Unsuspend these packages'),
+ 'action' => "${p}misc/bulk_unsuspend_pkg.cgi?$query",
+ 'actionlabel' => emt('Unsuspend Packages'),
+ 'width' => 569,
+ 'height' => 210,
+ ). '<BR>' if $search_hash{status} eq 'suspended';
+
+ if ( $curuser->access_right('Edit customer package dates') ) {
+ $text .= include( '/elements/popup_link.html',
+ 'label' => emt('Increment next bill date'),
+ 'action' => "${p}misc/bulk_pkg_increment_bill.cgi?$query",
+ 'actionlabel' => emt('Increment Bill Date'),
+ 'width' => 569,
+ 'height' => 210,
+ ). '<BR>';
+ }
+ $text .= include( '/elements/email-link.html',
+ 'search_hash' => \%search_hash,
+ 'table' => 'cust_pkg',
+ ). '<BR><BR>';
+ }
+ return $text;
+};
+
+my $large_pkg_size = $conf->config('cust_pkg-large_pkg_size');
+
+my $process_svc_labels = sub {
+ my $cust_pkg = shift;
+ my @out;
+ foreach my $part_svc ( $cust_pkg->part_svc) {
+ # some false laziness with view/cust_main/packages/services.html
+
+ my $num_cust_svc = $cust_pkg->num_cust_svc( $part_svc->svcpart );
+
+ if ( $large_pkg_size > 0 and $large_pkg_size <= $num_cust_svc ) {
+ my $href = $p.'search/cust_pkg_svc.html?svcpart='.$part_svc->svcpart.
+ ';pkgnum='.$cust_pkg->pkgnum;
+ push @out, [
+ { 'data' => $part_svc->svc . ':',
+ 'align' => 'right',
+ 'rowspan' => 2 },
+ { 'data' => mt('(view all [_1])', $num_cust_svc),
+ 'data_style' => 'b',
+ 'align' => 'left',
+ 'link' => $href, },
+ ],
+ [
+ { 'data' => include('/elements/search-cust_svc.html',
+ 'svcpart' => $part_svc->svcpart,
+ 'pkgnum' => $cust_pkg->pkgnum,
+ ),
+ 'align' => 'left' },
+ ];
+ }
+ else {
+ foreach ( map { [ $_->label ] } @{ $part_svc->cust_pkg_svc } ) {
+ push @out, [
+ { 'data' => $_->[0]. ':',
+ 'align'=> 'right',
+ },
+
+ { 'data' => $_->[1],
+ 'align'=> 'left',
+ 'link' => $p. 'view/cust_svc.cgi?' . $_->[3],
+ },
+
+ ];
+ }
+ }
+ } #foreach $cust_pkg
+ return @out;
+};
+