1 <& elements/search.html,
2 'html_init' => $html_init,
6 'count_query' => $count_query,
7 'header' => [ emt('#'),
27 FS::UI::Web::cust_header(
28 $cgi->param('cust_fields')
37 sub { ucfirst(shift->status); },
39 sub { sprintf( $money_char.'%.2f',
40 shift->part_pkg->option('setup_fee'),
44 sprintf( $money_char.'%.2f',
45 $c->part_pkg->base_recur($c)
48 sub { FS::part_pkg::freq_pretty(shift); },
50 ( map { time_or_blank($_) }
51 qw( setup last_bill bill adjourn susp dundate expire contract_end change_date cancel ) ),
53 sub { my $self = shift;
55 foreach my $action ( qw ( cancel susp ) ) {
56 my $reason = $self->last_reason($action);
57 $return = $reason->reason if $reason;
63 \&FS::UI::Web::cust_fields,
64 # in cust_pkg.cgi, service labels would go here
65 time_or_blank('history_date'),
72 sub { shift->statuscolor; },
88 FS::UI::Web::cust_colors(),
91 'style' => [ '', '', '', '', 'b', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
92 FS::UI::Web::cust_styles() ],
93 'size' => [ '', '', '', '', '-1' ],
94 'align' => 'rrlcccrrlrrrrrrrrrrl'. FS::UI::Web::cust_aligns(). 'r',
112 '', # link to changed-from package?
116 ( map { $_ ne 'Cust. Status' ? $clink : '' }
117 FS::UI::Web::cust_header(
118 $cgi->param('cust_fields')
126 # shamelessly cloned from cust_pkg.cgi, with minimal changes to make it work
128 my $curuser = $FS::CurrentUser::CurrentUser;
131 unless $curuser->access_right('List packages');
133 my $conf = new FS::Conf;
134 my $money_char = $conf->config('money_char') || '$';
136 my %search_hash = ();
138 #some false laziness w/misc/bulk_change_pkg.cgi
140 $search_hash{'query'} = $cgi->keywords;
143 for (qw( agentnum custnum magic status custom cust_fields pkgbatch )) {
144 $search_hash{$_} = $cgi->param($_) if $cgi->param($_);
148 for my $param (qw( pkgpart classnum )) {
149 $search_hash{$param} = [ $cgi->param($param) ]
150 if grep { $_ eq $param } $cgi->param;
153 #scalars that need to be passed if empty
154 for my $param (qw( censustract censustract2 )) {
155 $search_hash{$param} = $cgi->param($param) || ''
156 if grep { $_ eq $param } $cgi->param;
159 my $report_option = $cgi->param('report_option');
160 $search_hash{report_option} = $report_option if $report_option;
162 for my $param (grep /^report_option_any/, $cgi->param) {
163 $search_hash{$param} = $cgi->param($param);
170 #false laziness w/report_cust_pkg.html
173 'one-time charge' => { 'last_bill'=>1, 'bill'=>1, 'adjourn'=>1, 'susp'=>1, 'expire'=>1, 'cancel'=>1, 'contract_end'=>1, 'dundate'=>1, },
174 'active' => { 'susp'=>1, 'cancel'=>1 },
175 'suspended' => { 'cancel' =>1, 'dundate'=>1, },
180 foreach my $field (qw( setup last_bill bill adjourn susp expire contract_end change_date cancel active )) {
182 my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi, $field);
184 next if $beginning == 0 && $ending == 4294967295
185 or $disable{$cgi->param('status')}->{$field};
187 $search_hash{$field} = [ $beginning, $ending ];
192 if ( $cgi->param('date') =~ /^(\d+)$/ ) {
194 $search_hash{'date'} = $date;
197 my $query = FS::h_cust_pkg->search(\%search_hash);
198 my $count_query = delete($query->{'count_query'});
200 my $show = $curuser->default_customer_view =~ /^(jumbo|packages)$/
206 my $frag = 'cust_pkg'. $self->pkgnum; #hack for IE ignoring real #fragment
207 [ "${p}view/cust_main.cgi?custnum=".$self->custnum.
208 "$show;fragment=$frag#cust_pkg",
214 my $cust_pkg = shift;
215 $cust_pkg->cust_main_custnum
216 ? [ "${p}view/cust_main.cgi?", 'custnum' ]
224 my $value = $record->get($column); #mmm closures
225 $value ? time2str('%b %d %Y', $value ) : '';
231 my $title = 'Historical Package View - ';
234 } elsif ( $date == 4294967295 ) {
237 $title .= time2str('%h %o %Y', $date);