summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
authorivan <ivan>2003-04-01 01:22:25 +0000
committerivan <ivan>2003-04-01 01:22:25 +0000
commitf3b8b72d2a07683b2deb2774f29407e25e725b5a (patch)
tree328d0be79614abe74f52aeec3e00ff89810c8f18 /httemplate
parent4063ea45f3ab0a9cb2582834e55ac3afc71425f9 (diff)
correct last_bill problems with $0 invoice (non-existant) edge cases
Diffstat (limited to 'httemplate')
-rwxr-xr-xhttemplate/edit/REAL_cust_pkg.cgi18
-rwxr-xr-xhttemplate/edit/process/REAL_cust_pkg.cgi2
-rwxr-xr-xhttemplate/search/cust_pkg.cgi31
-rwxr-xr-xhttemplate/view/cust_main.cgi35
-rwxr-xr-xhttemplate/view/cust_pkg.cgi17
5 files changed, 70 insertions, 33 deletions
diff --git a/httemplate/edit/REAL_cust_pkg.cgi b/httemplate/edit/REAL_cust_pkg.cgi
index 0d2f1c238..e44acba3c 100755
--- a/httemplate/edit/REAL_cust_pkg.cgi
+++ b/httemplate/edit/REAL_cust_pkg.cgi
@@ -1,6 +1,6 @@
<!-- mason kludge -->
<%
-# <!-- $Id: REAL_cust_pkg.cgi,v 1.4 2002-07-08 13:07:40 ivan Exp $ -->
+# <!-- $Id: REAL_cust_pkg.cgi,v 1.5 2003-04-01 01:22:24 ivan Exp $ -->
my $error ='';
my $pkgnum = '';
@@ -56,11 +56,19 @@ print ntable("#cccccc",2),
$otaker, '</TD></TR>',
'<TR><TD ALIGN="right">Setup date</TD><TD>'.
'<INPUT TYPE="text" NAME="setup" SIZE=32 VALUE="',
- ( $setup ? time2str("%c %z (%Z)",$setup) : "" ), '"></TD></TR>',
- '<TR><TD ALIGN="right">Next bill date</TD><TD>',
+ ( $setup ? time2str("%c %z (%Z)",$setup) : "" ), '"></TD></TR>';
+
+print '<TR><TD ALIGN="right">Last bill date</TD><TD>',
+ '<INPUT TYPE="text" NAME="last_bill" SIZE=32 VALUE="',
+ ( $cust_pkg->last_bill
+ ? time2str("%c %z (%Z)", $cust_pkg->last_bill)
+ : "" ),
+ '"></TD></TR>'
+ if $cust_pkg->dbdef_table->column('last_bill');
+
+print '<TR><TD ALIGN="right">Next bill date</TD><TD>',
'<INPUT TYPE="text" NAME="bill" SIZE=32 VALUE="',
- ( $bill ? time2str("%c %z (%Z)",$bill) : "" ), '"></TD></TR>',
-;
+ ( $bill ? time2str("%c %z (%Z)",$bill) : "" ), '"></TD></TR>';
print '<TR><TD ALIGN="right">Suspension date</TD><TD BGCOLOR="#ffffff">',
time2str("%D",$susp), '</TD></TR>'
diff --git a/httemplate/edit/process/REAL_cust_pkg.cgi b/httemplate/edit/process/REAL_cust_pkg.cgi
index 2e0352c76..7f5c5e49c 100755
--- a/httemplate/edit/process/REAL_cust_pkg.cgi
+++ b/httemplate/edit/process/REAL_cust_pkg.cgi
@@ -5,6 +5,8 @@ my $old = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum});
my %hash = $old->hash;
$hash{'setup'} = $cgi->param('setup') ? str2time($cgi->param('setup')) : '';
$hash{'bill'} = $cgi->param('bill') ? str2time($cgi->param('bill')) : '';
+$hash{'last_bill'} =
+ $cgi->param('last_bill') ? str2time($cgi->param('last_bill')) : '';
$hash{'expire'} = $cgi->param('expire') ? str2time($cgi->param('expire')) : '';
my $new = new FS::cust_pkg \%hash;
diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi
index 78a5bb3bb..3cc520fa8 100755
--- a/httemplate/search/cust_pkg.cgi
+++ b/httemplate/search/cust_pkg.cgi
@@ -194,6 +194,12 @@ if ( scalar(@cust_pkg) == 1 ) {
<TR>
<TH>Package</TH>
<TH><FONT SIZE=-1>Setup</FONT></TH>
+END
+
+ print '<TH><FONT SIZE=-1>Next<BR>bill</FONT></TH>'
+ if defined dbdef->table('cust_pkg')->column('last_bill');
+
+ print <<END;
<TH><FONT SIZE=-1>Next<BR>bill</FONT></TH>
<TH><FONT SIZE=-1>Susp.</FONT></TH>
<TH><FONT SIZE=-1>Expire</FONT></TH>
@@ -203,17 +209,10 @@ if ( scalar(@cust_pkg) == 1 ) {
<TH>company</TH>
END
-if ( defined dbdef->table('cust_main')->column('ship_last') ) {
- print <<END;
- <TH>(service) name</TH>
- <TH>company</TH>
-END
-}
+ print '<TH>(service) name</TH><TH>company</TH>'
+ if defined dbdef->table('cust_main')->column('ship_last');
-print <<END;
- <TH COLSPAN=2>Services</TH>
- </TR>
-END
+ print '<TH COLSPAN=2>Services</TH></TR>';
my $n1 = '<TR>';
my(%saw,$cust_pkg);
@@ -244,6 +243,12 @@ END
$cust_main ? $cust_main->first : '',
$cust_main ? $cust_main->company : '',
);
+
+ my $last_bill = $cust_pkg->getfield('last_bill')
+ ? time2str("%D", $cust_pkg->getfield('last_bill') )
+ : ''
+ if defined dbdef->table('cust_pkg')->column('last_bill');
+
my($ship_last, $ship_first, $ship_company);
if ( defined dbdef->table('cust_main')->column('ship_last') ) {
($ship_last, $ship_first, $ship_company) = (
@@ -270,6 +275,12 @@ END
print $n1, <<END;
<TD ROWSPAN=$rowspan><A HREF="${p}view/cust_pkg.cgi?$pkgnum"><FONT SIZE=-1>$pkgnum - $pkg</FONT></A></TD>
<TD ROWSPAN=$rowspan>$setup</TD>
+END
+
+ print "<TD ROWSPAN=$rowspan>$last_bill</TD>"
+ if defined dbdef->table('cust_pkg')->column('last_bill');
+
+ print <<END;
<TD ROWSPAN=$rowspan>$bill</TD>
<TD ROWSPAN=$rowspan>$susp</TD>
<TD ROWSPAN=$rowspan>$expire</TD>
diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi
index 6fe759bd9..9b7b5d029 100755
--- a/httemplate/view/cust_main.cgi
+++ b/httemplate/view/cust_main.cgi
@@ -342,17 +342,6 @@ print qq!<BR><A NAME="cust_pkg">Packages</A> !,
#display packages
-#formatting
-print qq!!, &table(), "\n",
- qq!<TR><TH COLSPAN=2 ROWSPAN=2>Package</TH><TH COLSPAN=5>!,
- qq!Dates</TH><TH COLSPAN=2 ROWSPAN=2>Services</TH></TR>\n!,
- qq!<TR><TH><FONT SIZE=-1>Setup</FONT></TH><TH>!,
- qq!<FONT SIZE=-1>Next bill</FONT>!,
- qq!</TH><TH><FONT SIZE=-1>Susp.</FONT></TH><TH><FONT SIZE=-1>Expire!,
- qq!</FONT></TH>!,
- qq!<TH><FONT SIZE=-1>Cancel</FONT></TH>!,
- qq!</TR>\n!;
-
#get package info
my @packages;
if ( $conf->exists('hidecancelledpackages') ) {
@@ -361,6 +350,23 @@ if ( $conf->exists('hidecancelledpackages') ) {
@packages = sort { $a->pkgnum <=> $b->pkgnum } ($cust_main->all_pkgs);
}
+if ( @packages ) {
+ #formatting
+ print &table(), "\n",
+ qq!<TR><TH COLSPAN=2 ROWSPAN=2>Package</TH><TH COLSPAN=5>!,
+ qq!Dates</TH><TH COLSPAN=2 ROWSPAN=2>Services</TH></TR>\n<TR>!,
+ qq!<TH><FONT SIZE=-1>Setup</FONT></TH>!;
+
+ print qq!<TH><FONT SIZE=-1>Last bill</FONT></TH>!
+ if $packages[0]->dbdef_table->column('last_bill');
+
+ print qq!<TH><FONT SIZE=-1>Next bill</FONT></TH>!,
+ qq!<TH><FONT SIZE=-1>Susp.</FONT></TH>!,
+ qq!<TH><FONT SIZE=-1>Expire!</FONT></TH>!,
+ qq!<TH><FONT SIZE=-1>Cancel</FONT></TH>!,
+ qq!</TR>\n!;
+}
+
my $n1 = '<TR>';
foreach my $package (@packages) {
my $pkgnum = $package->pkgnum;
@@ -424,7 +430,11 @@ foreach my $package (@packages) {
}
print '</FONT></TD>';
- for ( qw( setup bill susp expire cancel ) ) {
+ my @fields = qw( setup );
+ push @fields, qw( last_bill ) if $package->dbdef_table->column('last_bill');
+ push @fields, qw( bill susp expire cancel);
+
+ for ( @fields ) {
print "<TD ROWSPAN=$rowspan><FONT SIZE=-1>", ( $package->getfield($_)
? time2str("%D</FONT><BR><FONT SIZE=-3>%l:%M:%S%P&nbsp;%z</FONT>",
$package->getfield($_) )
@@ -471,6 +481,7 @@ print "</TR>";
#formatting
print "</TABLE>";
+
print <<END;
<SCRIPT>
function cust_pay_areyousure(href) {
diff --git a/httemplate/view/cust_pkg.cgi b/httemplate/view/cust_pkg.cgi
index aa3b3b15a..c3880114c 100755
--- a/httemplate/view/cust_pkg.cgi
+++ b/httemplate/view/cust_pkg.cgi
@@ -68,10 +68,16 @@ print &ntable("#cccccc"), '<TR><TD>', &ntable("#cccccc",2),
'<TR><TD ALIGN="right">Comment</TD><TD BGCOLOR="#ffffff">',
$comment, '</TD></TR>',
'<TR><TD ALIGN="right">Setup date</TD><TD BGCOLOR="#ffffff">',
- ( $setup ? time2str("%D",$setup) : "(Not setup)" ), '</TD></TR>',
- '<TR><TD ALIGN="right">Next bill date</TD><TD BGCOLOR="#ffffff">',
- ( $bill ? time2str("%D",$bill) : "&nbsp;" ), '</TD></TR>',
-;
+ ( $setup ? time2str("%D",$setup) : "(Not setup)" ), '</TD></TR>';
+
+print '<TR><TD ALIGN="right">Last bill date</TD><TD BGCOLOR="#ffffff">',
+ ( $cust_pkg->last_bill ? time2str("%D",$cust_pkg->last_bill) : "&nbsp;" ),
+ '</TD></TR>'
+ if $cust_pkg->dbdef_table->column('last_bill');
+
+print '<TR><TD ALIGN="right">Next bill date</TD><TD BGCOLOR="#ffffff">',
+ ( $bill ? time2str("%D",$bill) : "&nbsp;" ), '</TD></TR>';
+
print '<TR><TD ALIGN="right">Suspension date</TD><TD BGCOLOR="#ffffff">',
time2str("%D",$susp), '</TD></TR>' if $susp;
print '<TR><TD ALIGN="right">Expiration date</TD><TD BGCOLOR="#ffffff">',
@@ -80,8 +86,7 @@ print '<TR><TD ALIGN="right">Cancellation date</TD><TD BGCOLOR="#ffffff">',
time2str("%D",$cancel), '</TD></TR>' if $cancel;
print '<TR><TD ALIGN="right">Order taker</TD><TD BGCOLOR="#ffffff">',
$otaker, '</TD></TR>',
- '</TABLE></TD></TR></TABLE>'
-;
+ '</TABLE></TD></TR></TABLE>';
unless ($expire) {
print <<END;