X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Fcust_pkg.cgi;h=dabcf46fbe1c2188f9846647fc84239b96bc62ba;hb=f91771606ce8a2bb4f2fa44e7bf54c9b7c945db6;hp=e862cefab79f157de0909e13606f7ab249b4b0e3;hpb=63ec39a8c2a32b5ac325c4973945a26398678347;p=freeside.git diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi index e862cefab..dabcf46fb 100755 --- a/httemplate/search/cust_pkg.cgi +++ b/httemplate/search/cust_pkg.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi @cust_pkg $sortby $query %part_pkg @@ -31,13 +31,11 @@ $limit .= " OFFSET $offset" if $offset; my $total; -($query) = $cgi->keywords; my $unconf = ''; -#this tree is a little bit redundant +($query) = $cgi->keywords; if ( $query eq 'pkgnum' ) { $sortby=\*pkgnum_sort; - } elsif ( $query eq 'APKG_pkgnum' ) { $sortby=\*pkgnum_sort; @@ -86,7 +84,7 @@ my $sth = dbh->prepare($statement) or die dbh->errstr. " doing $statement"; $sth->execute or die "Error executing \"$statement\": ". $sth->errstr; -$total = @{$sth->fetchrow_arrayref}[0]; +$total = $sth->fetchrow_arrayref->[0]; @cust_pkg = qsearch('cust_pkg',{}, '', "$unconf ORDER BY pkgnum $limit" ); @@ -100,6 +98,7 @@ if ( scalar(@cust_pkg) == 1 ) { } else { $total ||= scalar(@cust_pkg); + #begin pager my $pager = ''; if ( $total != scalar(@cust_pkg) && $maxrecords ) { unless ( $offset == 0 ) { @@ -124,11 +123,17 @@ if ( scalar(@cust_pkg) == 1 ) { '">Next '; } } + #end pager print header('Package Search Results',''), "$total matching packages found

$pager", &table(), < Package + Setup + Next
bill
+ Susp. + Expire + Cancel Cust# (bill) name company @@ -152,8 +157,24 @@ END sort $sortby grep(!$saw{$_->pkgnum}++, @cust_pkg) ) { my($cust_main)=qsearchs('cust_main',{'custnum'=>$cust_pkg->custnum}); - my($pkgnum, $custnum, $last, $first, $company) = ( + my($pkgnum, $setup, $bill, $susp, $expire, $cancel, + $custnum, $last, $first, $company ) = ( $cust_pkg->pkgnum, + $cust_pkg->getfield('setup') + ? time2str("%D", $cust_pkg->getfield('setup') ) + : '', + $cust_pkg->getfield('bill') + ? time2str("%D", $cust_pkg->getfield('bill') ) + : '', + $cust_pkg->getfield('susp') + ? time2str("%D", $cust_pkg->getfield('susp') ) + : '', + $cust_pkg->getfield('expire') + ? time2str("%D", $cust_pkg->getfield('expire') ) + : '', + $cust_pkg->getfield('cancel') + ? time2str("%D", $cust_pkg->getfield('cancel') ) + : '', $cust_pkg->custnum, $cust_main ? $cust_main->last : '', $cust_main ? $cust_main->first : '', @@ -184,6 +205,11 @@ END my $p = popurl(2); print $n1, <$pkgnum - $pkg + $setup + $bill + $susp + $expire + $cancel END if ( $cust_main ) { print <