1 <% include( 'elements/search.html',
2 'html_init' => $html_init,
3 'title' => 'Package Search Results',
6 'count_query' => $count_query,
24 FS::UI::Web::cust_header(
25 $cgi->param('cust_fields')
32 sub { #my $part_pkg = $part_pkg{shift->pkgpart};
33 #$part_pkg->pkg; # ' - '. $part_pkg->comment;
34 $_[0]->pkg; # ' - '. $_[0]->comment;
37 sub { ucfirst(shift->status); },
38 sub { sprintf( $money_char.'%.2f',
39 shift->part_pkg->option('setup_fee'),
43 sprintf( $money_char.'%.2f',
44 $c->part_pkg->base_recur($c)
47 sub { #shift->part_pkg->freq_pretty;
49 #my $part_pkg = $part_pkg{shift->pkgpart};
50 #$part_pkg->freq_pretty;
52 FS::part_pkg::freq_pretty(shift);
55 #sub { time2str('%b %d %Y', shift->setup); },
56 #sub { time2str('%b %d %Y', shift->last_bill); },
57 #sub { time2str('%b %d %Y', shift->bill); },
58 #sub { time2str('%b %d %Y', shift->susp); },
59 #sub { time2str('%b %d %Y', shift->expire); },
60 #sub { time2str('%b %d %Y', shift->get('cancel')); },
61 ( map { time_or_blank($_) }
62 qw( setup last_bill bill adjourn susp expire cancel ) ),
64 sub { my $self = shift;
66 foreach my $action ( qw ( cancel susp ) ) {
67 my $reason = $self->last_reason($action);
68 $return = $reason->reason if $reason;
74 \&FS::UI::Web::cust_fields,
75 #sub { '<table border=0 cellspacing=0 cellpadding=0 STYLE="border:none">'.
76 # join('', map { '<tr><td align="right" style="border:none">'. $_->[0].
77 # ':</td><td style="border:none">'. $_->[1]. '</td></tr>' }
85 { 'data' => $_->[0]. ':',
90 'link' => $p. 'view/' .
91 $_->[2]. '.cgi?'. $_->[3],
103 sub { shift->statuscolor; },
115 FS::UI::Web::cust_colors(),
118 'style' => [ '', '', '', '', 'b', '', '', '', '', '', '', '', '', '', '', '',
119 FS::UI::Web::cust_styles() ],
120 'size' => [ '', '', '', '', '-1' ],
121 'align' => 'rrlccrrlrrrrrrrl'. FS::UI::Web::cust_aligns(). 'r',
139 ( map { $_ ne 'Cust. Status' ? $clink : '' }
140 FS::UI::Web::cust_header(
141 $cgi->param('cust_fields')
146 'extra_choices_callback'=> $extra_choices,
151 my $curuser = $FS::CurrentUser::CurrentUser;
154 unless $curuser->access_right('List packages');
156 my $conf = new FS::Conf;
157 my $money_char = $conf->config('money_char') || '$';
159 # my %part_pkg = map { $_->pkgpart => $_ } qsearch('part_pkg', {});
161 my %search_hash = ();
163 $search_hash{'query'} = $cgi->keywords;
165 for my $param (qw(agentnum magic status classnum pkgpart custom)) {
166 $search_hash{$param} = $cgi->param($param)
167 if $cgi->param($param);
174 #false laziness w/report_cust_pkg.html
177 'one-time charge' => { 'last_bill'=>1, 'bill'=>1, 'adjourn'=>1, 'susp'=>1, 'expire'=>1, 'cancel'=>1, },
178 'active' => { 'susp'=>1, 'cancel'=>1 },
179 'suspended' => { 'cancel' => 1 },
184 foreach my $field (qw( setup last_bill bill adjourn susp expire cancel )) {
186 my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi, $field);
188 next if $beginning == 0 && $ending == 4294967295
189 or $disable{$cgi->param('status')}->{$field};
191 $search_hash{$field} = [ $beginning, $ending ];
195 my $sql_query = FS::cust_pkg->search_sql(\%search_hash);
196 my $count_query = delete($sql_query->{'count_query'});
198 my $show = $curuser->default_customer_view =~ /^(jumbo|packages)$/
204 my $frag = 'cust_pkg'. $self->pkgnum; #hack for IE ignoring real #fragment
205 [ "${p}view/cust_main.cgi?custnum=".$self->custnum.
206 "$show;fragment=$frag#cust_pkg",
212 my $cust_pkg = shift;
213 $cust_pkg->cust_main_custnum
214 ? [ "${p}view/cust_main.cgi?", 'custnum' ]
218 #if ( scalar(@cust_pkg) == 1 ) {
219 # print $cgi->redirect("${p}view/cust_main.cgi?". $cust_pkg[0]->custnum.
220 # "#cust_pkg". $cust_pkg[0]->pkgnum );
222 # my @cust_svc = qsearch( 'cust_svc', { 'pkgnum' => $pkgnum } );
223 # my $rowspan = scalar(@cust_svc) || 1;
226 # foreach my $cust_svc ( @cust_svc ) {
227 # my($label, $value, $svcdb) = $cust_svc->label;
228 # my $svcnum = $cust_svc->svcnum;
229 # my $sview = $p. "view";
230 # print $n2,qq!<TD><A HREF="$sview/$svcdb.cgi?$svcnum"><FONT SIZE=-1>$label</FONT></A></TD>!,
231 # qq!<TD><A HREF="$sview/$svcdb.cgi?$svcnum"><FONT SIZE=-1>$value</FONT></A></TD>!;
239 my $value = $record->get($column); #mmm closures
240 $value ? time2str('%b %d %Y', $value ) : '';
244 my $html_init = include('/elements/init_overlib.html');
246 my $extra_choices = sub {
250 $FS::CurrentUser::CurrentUser->access_right('Bulk change customer packages');
253 include( '/elements/popup_link.html',
254 'label' => 'Change these packages',
255 'action' => "${p}misc/bulk_change_pkg.cgi?$query",
256 'actionlabel' => 'Change Packages',