1 <% include( 'elements/search.html',
2 'html_init' => $html_init,
3 'title' => 'Package Search Results',
6 'count_query' => $count_query,
22 FS::UI::Web::cust_header(
23 $cgi->param('cust_fields')
30 sub { #my $part_pkg = $part_pkg{shift->pkgpart};
31 #$part_pkg->pkg; # ' - '. $part_pkg->comment;
32 $_[0]->pkg; # ' - '. $_[0]->comment;
35 sub { ucfirst(shift->status); },
36 sub { #shift->part_pkg->freq_pretty;
38 #my $part_pkg = $part_pkg{shift->pkgpart};
39 #$part_pkg->freq_pretty;
41 FS::part_pkg::freq_pretty(shift);
44 #sub { time2str('%b %d %Y', shift->setup); },
45 #sub { time2str('%b %d %Y', shift->last_bill); },
46 #sub { time2str('%b %d %Y', shift->bill); },
47 #sub { time2str('%b %d %Y', shift->susp); },
48 #sub { time2str('%b %d %Y', shift->expire); },
49 #sub { time2str('%b %d %Y', shift->get('cancel')); },
50 ( map { time_or_blank($_) }
51 qw( setup last_bill bill adjourn susp expire 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 #sub { '<table border=0 cellspacing=0 cellpadding=0 STYLE="border:none">'.
65 # join('', map { '<tr><td align="right" style="border:none">'. $_->[0].
66 # ':</td><td style="border:none">'. $_->[1]. '</td></tr>' }
74 { 'data' => $_->[0]. ':',
79 'link' => $p. 'view/' .
80 $_->[2]. '.cgi?'. $_->[3],
92 sub { shift->statuscolor; },
102 FS::UI::Web::cust_colors(),
105 'style' => [ '', '', '', '', 'b', '', '', '', '', '', '', '', '', '',
106 FS::UI::Web::cust_styles() ],
107 'size' => [ '', '', '', '', '-1' ],
108 'align' => 'rrlcclrrrrrrrl'. FS::UI::Web::cust_aligns(). 'r',
124 ( map { $_ ne 'Cust. Status' ? $clink : '' }
125 FS::UI::Web::cust_header(
126 $cgi->param('cust_fields')
131 'extra_choices_callback'=> $extra_choices,
137 unless $FS::CurrentUser::CurrentUser->access_right('List packages');
139 # my %part_pkg = map { $_->pkgpart => $_ } qsearch('part_pkg', {});
141 my %search_hash = ();
143 $search_hash{'query'} = $cgi->keywords;
145 for my $param (qw(agentnum magic status classnum pkgpart)) {
146 $search_hash{$param} = $cgi->param($param)
147 if $cgi->param($param);
154 #false laziness w/report_cust_pkg.html
157 'one-time charge' => { 'last_bill'=>1, 'bill'=>1, 'adjourn'=>1, 'susp'=>1, 'expire'=>1, 'cancel'=>1, },
158 'active' => { 'susp'=>1, 'cancel'=>1 },
159 'suspended' => { 'cancel' => 1 },
164 foreach my $field (qw( setup last_bill bill adjourn susp expire cancel )) {
166 my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi, $field);
168 next if $beginning == 0 && $ending == 4294967295
169 or $disable{$cgi->param('status')}->{$field};
171 $search_hash{$field} = [ $beginning, $ending ];
175 my $sql_query = FS::cust_pkg->search_sql(\%search_hash);
176 my $count_query = delete($sql_query->{'count_query'});
179 [ "${p}view/cust_main.cgi?".shift->custnum.'#cust_pkg', 'pkgnum' ];
183 my $cust_pkg = shift;
184 $cust_pkg->cust_main_custnum
185 ? [ "${p}view/cust_main.cgi?", 'custnum' ]
189 #if ( scalar(@cust_pkg) == 1 ) {
190 # print $cgi->redirect("${p}view/cust_main.cgi?". $cust_pkg[0]->custnum.
191 # "#cust_pkg". $cust_pkg[0]->pkgnum );
193 # my @cust_svc = qsearch( 'cust_svc', { 'pkgnum' => $pkgnum } );
194 # my $rowspan = scalar(@cust_svc) || 1;
197 # foreach my $cust_svc ( @cust_svc ) {
198 # my($label, $value, $svcdb) = $cust_svc->label;
199 # my $svcnum = $cust_svc->svcnum;
200 # my $sview = $p. "view";
201 # print $n2,qq!<TD><A HREF="$sview/$svcdb.cgi?$svcnum"><FONT SIZE=-1>$label</FONT></A></TD>!,
202 # qq!<TD><A HREF="$sview/$svcdb.cgi?$svcnum"><FONT SIZE=-1>$value</FONT></A></TD>!;
210 my $value = $record->get($column); #mmm closures
211 $value ? time2str('%b %d %Y', $value ) : '';
215 my $html_init = include('/elements/init_overlib.html');
217 my $extra_choices = sub {
221 $FS::CurrentUser::CurrentUser->access_right('Bulk change customer packages');
224 include( '/elements/popup_link.html',
225 'label' => 'Change these packages',
226 'action' => "${p}misc/bulk_change_pkg.cgi?$query",
227 'actionlabel' => 'Change Packages',