-%><%= include( 'elements/search.html',
- 'title' => 'Package Search Results',
- 'name' => 'packages',
- 'query' => $sql_query,
- 'count_query' => $count_query,
- #'redirect' => $link,
- 'header' => [ '#',
- 'Package',
- 'Status',
- 'Freq.',
- 'Setup',
- 'Last bill',
- 'Next bill',
- 'Susp.',
- 'Expire',
- 'Cancel',
- FS::UI::Web::cust_header(),
- 'Services',
- ],
- 'fields' => [
- 'pkgnum',
- sub { my $part_pkg = $part_pkg{shift->pkgpart};
- $part_pkg->pkg; # ' - '. $part_pkg->comment;
- },
- sub { ucfirst(shift->status); },
- sub { #shift->part_pkg->freq_pretty;
- my $part_pkg = $part_pkg{shift->pkgpart};
- $part_pkg->freq_pretty;
- },
+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';
+
+ $text .= include( '/elements/popup_link.html',
+ 'label' => emt('Cancel these packages'),
+ 'action' => "${p}misc/bulk_cancel_pkg.cgi?$query",
+ 'actionlabel' => emt('Cancel Packages'),
+ 'width' => 569,
+ 'height' => 210,
+ 'color' => '#ff0000',
+ ). '<BR>' unless $search_hash{status} eq 'cancelled';
+
+ 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;
+};