X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Fcust_pkg.cgi;h=b354bc133f44876977ef1987eff468212ddabe60;hb=f8a8f142236a338fde4b733df48e022d19748c88;hp=84b083a3da8219c3ad0f257103b8e53ba0f5f90f;hpb=ab9e07a6507647e1aaf59df75edc54b40a745643;p=freeside.git diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi index 84b083a3d..b354bc133 100755 --- a/httemplate/search/cust_pkg.cgi +++ b/httemplate/search/cust_pkg.cgi @@ -12,9 +12,11 @@ 'Setup', 'Last bill', 'Next bill', + 'Adjourn', 'Susp.', 'Expire', 'Cancel', + 'Reason', FS::UI::Web::cust_header( $cgi->param('cust_fields') ), @@ -43,7 +45,18 @@ #sub { time2str('%b %d %Y', shift->expire); }, #sub { time2str('%b %d %Y', shift->get('cancel')); }, ( map { time_or_blank($_) } - qw( setup last_bill bill susp expire cancel ) ), + qw( setup last_bill bill adjourn susp expire cancel ) ), + + sub { my $self = shift; + my $return = ''; + if ($self->getfield('cancel') || + $self->getfield('suspend')) { + my $reason = $self->last_reason;# too inefficient? + $return = $reason->reason if $reason; + + } + $return; + }, \&FS::UI::Web::cust_fields, #sub { ''. @@ -126,7 +139,7 @@ my @where = (); if ( $cgi->param('agentnum') =~ /^(\d+)$/ and $1 ) { push @where, - "agentnum = $1"; + "cust_main.agentnum = $1"; } ## @@ -210,14 +223,14 @@ my $orderby = ''; #false laziness w/report_cust_pkg.html my %disable = ( 'all' => {}, - 'one-time charge' => { 'last_bill'=>1, 'bill'=>1, 'susp'=>1, 'expire'=>1, 'cancel'=>1, }, + 'one-time charge' => { 'last_bill'=>1, 'bill'=>1, 'adjourn'=>1, 'susp'=>1, 'expire'=>1, 'cancel'=>1, }, 'active' => { 'susp'=>1, 'cancel'=>1 }, 'suspended' => { 'cancel' => 1 }, 'cancelled' => {}, '' => {}, ); -foreach my $field (qw( setup last_bill bill susp expire cancel )) { +foreach my $field (qw( setup last_bill bill adjourn susp expire cancel )) { my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi, $field); @@ -225,11 +238,11 @@ foreach my $field (qw( setup last_bill bill susp expire cancel )) { or $disable{$cgi->param('status')}->{$field}; push @where, - "$field IS NOT NULL", - "$field >= $beginning", - "$field <= $ending"; + "cust_pkg.$field IS NOT NULL", + "cust_pkg.$field >= $beginning", + "cust_pkg.$field <= $ending"; - $orderby ||= "ORDER BY $field"; + $orderby ||= "ORDER BY cust_pkg.$field"; } @@ -273,7 +286,7 @@ if ( $cgi->param('magic') && ## # here is the agent virtualization -push @where, $FS::CurrentUser::CurrentUser->agentnums_sql; +push @where, $FS::CurrentUser::CurrentUser->agentnums_sql('table'=>'cust_main'); my $extra_sql = scalar(@where) ? ' WHERE '. join(' AND ', @where) : '';