From f3b8b72d2a07683b2deb2774f29407e25e725b5a Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 1 Apr 2003 01:22:25 +0000 Subject: [PATCH] correct last_bill problems with $0 invoice (non-existant) edge cases --- FS/FS/cust_main.pm | 2 ++ FS/FS/cust_pkg.pm | 4 ++++ debian/changelog | 2 +- debian/control | 22 +++++++++++++------ httemplate/edit/REAL_cust_pkg.cgi | 18 +++++++++++----- httemplate/edit/process/REAL_cust_pkg.cgi | 2 ++ httemplate/search/cust_pkg.cgi | 31 ++++++++++++++++++--------- httemplate/view/cust_main.cgi | 35 ++++++++++++++++++++----------- 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: + + +Package: freeside-selfservice-server +Architecture: all +Depends: +Description: + + + 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 @@ <% -# +# my $error =''; my $pkgnum = ''; @@ -56,11 +56,19 @@ print ntable("#cccccc",2), $otaker, '', 'Setup date'. '', - 'Next bill date', + ( $setup ? time2str("%c %z (%Z)",$setup) : "" ), '">'; + +print 'Last bill date', + 'last_bill) + : "" ), + '">' + if $cust_pkg->dbdef_table->column('last_bill'); + +print 'Next bill date', '', -; + ( $bill ? time2str("%c %z (%Z)",$bill) : "" ), '">'; print 'Suspension date', time2str("%D",$susp), '' 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 ) { Package Setup +END + + print 'Next
bill
' + if defined dbdef->table('cust_pkg')->column('last_bill'); + + print <Next
bill
Susp. Expire @@ -203,17 +209,10 @@ if ( scalar(@cust_pkg) == 1 ) { company END -if ( defined dbdef->table('cust_main')->column('ship_last') ) { - print <(service) name - company -END -} + print '(service) namecompany' + if defined dbdef->table('cust_main')->column('ship_last'); -print <Services - -END + print 'Services'; my $n1 = ''; 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, <$pkgnum - $pkg $setup +END + + print "$last_bill" + if defined dbdef->table('cust_pkg')->column('last_bill'); + + print <$bill $susp $expire 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!
Packages !, #display packages -#formatting -print qq!!, &table(), "\n", - qq!Package!, - qq!DatesServices\n!, - qq!Setup!, - qq!Next bill!, - qq!Susp.Expire!, - qq!!, - qq!Cancel!, - qq!\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!Package!, + qq!DatesServices\n!, + qq!Setup!; + + print qq!Last bill! + if $packages[0]->dbdef_table->column('last_bill'); + + print qq!Next bill!, + qq!Susp.!, + qq!Expire!!, + qq!Cancel!, + qq!\n!; +} + my $n1 = ''; foreach my $package (@packages) { my $pkgnum = $package->pkgnum; @@ -424,7 +430,11 @@ foreach my $package (@packages) { } print ''; - 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 "", ( $package->getfield($_) ? time2str("%D
%l:%M:%S%P %z", $package->getfield($_) ) @@ -471,6 +481,7 @@ print ""; #formatting print ""; + print < 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"), '', &ntable("#cccccc",2), 'Comment', $comment, '', 'Setup date', - ( $setup ? time2str("%D",$setup) : "(Not setup)" ), '', - 'Next bill date', - ( $bill ? time2str("%D",$bill) : " " ), '', -; + ( $setup ? time2str("%D",$setup) : "(Not setup)" ), ''; + +print 'Last bill date', + ( $cust_pkg->last_bill ? time2str("%D",$cust_pkg->last_bill) : " " ), + '' + if $cust_pkg->dbdef_table->column('last_bill'); + +print 'Next bill date', + ( $bill ? time2str("%D",$bill) : " " ), ''; + print 'Suspension date', time2str("%D",$susp), '' if $susp; print 'Expiration date', @@ -80,8 +86,7 @@ print 'Cancellation date', time2str("%D",$cancel), '' if $cancel; print 'Order taker', $otaker, '', - '' -; + ''; unless ($expire) { print <