diff options
author | ivan <ivan> | 2003-04-01 01:22:25 +0000 |
---|---|---|
committer | ivan <ivan> | 2003-04-01 01:22:25 +0000 |
commit | f3b8b72d2a07683b2deb2774f29407e25e725b5a (patch) | |
tree | 328d0be79614abe74f52aeec3e00ff89810c8f18 | |
parent | 4063ea45f3ab0a9cb2582834e55ac3afc71425f9 (diff) |
correct last_bill problems with $0 invoice (non-existant) edge cases
-rw-r--r-- | FS/FS/cust_main.pm | 2 | ||||
-rw-r--r-- | FS/FS/cust_pkg.pm | 4 | ||||
-rw-r--r-- | debian/changelog | 2 | ||||
-rw-r--r-- | debian/control | 22 | ||||
-rwxr-xr-x | httemplate/edit/REAL_cust_pkg.cgi | 18 | ||||
-rwxr-xr-x | httemplate/edit/process/REAL_cust_pkg.cgi | 2 | ||||
-rwxr-xr-x | httemplate/search/cust_pkg.cgi | 31 | ||||
-rwxr-xr-x | httemplate/view/cust_main.cgi | 35 | ||||
-rwxr-xr-x | httemplate/view/cust_pkg.cgi | 17 |
9 files changed, 93 insertions, 40 deletions
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index 6331fda6d..d1e975406 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -1011,6 +1011,8 @@ sub bill { # only for figuring next bill date, nothing else, so, reset $sdate again # here $sdate = $cust_pkg->bill || $cust_pkg->setup || $time; + $cust_pkg->last_bill($sdate) + if $cust_pkg->dbdef_table->column('last_bill'); $mon += $part_pkg->freq; until ( $mon < 12 ) { $mon -= 12; $year++; } diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm index 88ffd4d17..4eea2c087 100644 --- a/FS/FS/cust_pkg.pm +++ b/FS/FS/cust_pkg.pm @@ -477,6 +477,10 @@ Useful for billing metered services. sub last_bill { my $self = shift; + if ( $self->dbdef_table->column('manual_flag') ) { + return $self->setfield('last_bill', $_[1]) if @_; + return $self->getfield('last_bill') if $self->getfield('last_bill'); + } my $cust_bill_pkg = qsearchs('cust_bill_pkg', { 'pkgnum' => $self->pkgnum, 'edate' => $self->bill, } ); $cust_bill_pkg ? $cust_bill_pkg->sdate : $self->setup || 0; diff --git a/debian/changelog b/debian/changelog index 5734b1fc8..d8283b5d9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -freeside (1.3.1-1) unstable; urgency=low +freeside (1.4.1-1) unstable; urgency=low * Initial Release. diff --git a/debian/control b/debian/control index 2f66fd395..de2820d83 100644 --- a/debian/control +++ b/debian/control @@ -8,14 +8,14 @@ Standards-Version: 3.5.2 Package: freeside Architecture: any Depends: freeside-lib -Recommends: freeside-doc, freeside-ui-webui, libterm-query-perl -Suggests: freeside-passwd-server, freeside-signup-server, freeside-session-server +Recommends: freeside-doc, freeside-ui-web, libterm-query-perl +Suggests: freeside-passwd-server, freeside-signup-server, freeside-session-server, freeside-selfservice-server Description: Billing and administration package for ISPs. Freeside is a billing and account administration package for ISPs. It stores customer information in an SQL database, and will update UNIX passwd and - shadow files, and configuration for sendmail, qmail, BIND and/or Apache. - It is also useful as a central database of accounts/domains/web-space - for a large number of machines. + shadow files, RADIUS users file and SQL databases, and configuration for + sendmail, qmail, BIND and/or Apache. It is also useful as a central database + of accounts/domains/web-space for a large number of machines. Package: freeside-doc Architecture: all @@ -25,7 +25,7 @@ Description: Documentation for freeside Package: freeside-lib Architecture: all -Depends: libdigest-md5-perl, liburi-perl, libhtml-parser-perl, libnet-perl, liblocale-codes-perl, libnet-whois-perl, libwww-perl, libbusiness-creditcard-perl, mailtools, libtimedate-perl, libdate-manip-perl, libfile-counterfile-perl, libfreezethaw-perl, libtext-template-perl, libdbd-pg-perl +Depends: libmime-base64-perl, libdigest-md5-perl, liburi-perl, libhtml-tagset-perl, libhtml-parser-perl, libnet-perl, liblocale-codes-perl, libnet-whois-perl, libwww-perl, libbusiness-creditcard-perl, libmailtools-perl, libtimedate-perl, libdate-manip-perl, libfile-counterfile-perl, libfreezethaw-perl, libtext-template-perl, libdbd-pg-perl, libdbix-datasource-perl, libdbix-dbschema-perl, libnet-ssh-perl, libnet-scp-perl, libapache-asp-perl, libtie-ixhash-perl, libtime-duration-perl, libhtml-widgets-selectlayers-perl, libstorable-perl, libapache-dbi-perl Description: Freeside libraries and extension API This package contains the libraries which implement the business logic and backend functions of Freeside, a billing and account administration package @@ -80,3 +80,13 @@ Description: Package: freeside-session-client Architecture: all Depends: ssh +Description: + <rar> + +Package: freeside-selfservice-server +Architecture: all +Depends: +Description: + <rar> + + 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 %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) : " " ), '</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) : " " ), + '</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) : " " ), '</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; |