From 6991d4986df7fb3a6c7c49b5ae1b3713e87a16c4 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 29 Jan 2002 16:33:16 +0000 Subject: [PATCH] - web interface for hourly account charges! (FS::cust_pkg, FS::cust_svc and FS::svc_acct seconds_since methods) - Makefile target to regenerate HTML manpages on install - FS.pm doc update - $FS::Record::Debug now dumps all SQL - new FS::cust_main methods: ->cancel, ->invoicing_list_addpost - start of a billing event web interface - cust_pay::upgrade_replace doesn't error out if history includes overapplied payments --- FS/FS.pm | 53 ++++--- FS/FS/Record.pm | 13 +- FS/FS/cust_main.pm | 31 ++++- FS/FS/cust_pay.pm | 12 +- FS/FS/cust_pkg.pm | 28 +++- FS/FS/cust_svc.pm | 51 +++++-- FS/FS/svc_acct.pm | 35 ++++- Makefile | 12 +- bin/pod2x | 32 ++++- htetc/global.asa | 2 + htetc/handler.pl | 2 + httemplate/browse/part_bill_event.cgi | 64 +++++++++ httemplate/docs/install.html | 6 +- httemplate/docs/man/FS.html | 62 ++++++--- httemplate/docs/man/FS/CGI.html | 5 + httemplate/docs/man/FS/Conf.html | 26 +++- httemplate/docs/man/FS/Record.html | 56 +++++--- httemplate/docs/man/FS/SessionClient.html | 2 +- httemplate/docs/man/FS/SignupClient.html | 193 +++++++++++++------------- httemplate/docs/man/FS/UID.html | 8 +- httemplate/docs/man/FS/cust_bill.html | 37 +++-- httemplate/docs/man/FS/cust_credit.html | 22 ++- httemplate/docs/man/FS/cust_main.html | 174 ++++++++++++++++++++--- httemplate/docs/man/FS/cust_main_invoice.html | 2 +- httemplate/docs/man/FS/cust_pay.html | 27 +++- httemplate/docs/man/FS/cust_pay_batch.html | 4 +- httemplate/docs/man/FS/cust_pkg.html | 56 +++++--- httemplate/docs/man/FS/cust_refund.html | 14 +- httemplate/docs/man/FS/cust_svc.html | 25 +++- httemplate/docs/man/FS/domain_record.html | 14 +- httemplate/docs/man/FS/part_pkg.html | 16 ++- httemplate/docs/man/FS/part_svc.html | 32 +++-- httemplate/docs/man/FS/prepay_credit.html | 14 +- httemplate/docs/man/FS/svc_Common.html | 9 +- httemplate/docs/man/FS/svc_acct.html | 76 ++++++++-- httemplate/docs/man/FS/svc_acct_pop.html | 22 ++- httemplate/docs/man/FS/svc_acct_sm.html | 31 +++-- httemplate/docs/man/FS/svc_domain.html | 19 ++- httemplate/docs/man/FS/svc_www.html | 18 +-- httemplate/edit/part_bill_event.cgi | 131 +++++++++++++++++ httemplate/edit/part_pkg.cgi | 71 ++++++++-- httemplate/edit/process/part_bill_event.cgi | 32 +++++ httemplate/index.html | 1 + 43 files changed, 1194 insertions(+), 346 deletions(-) create mode 100755 httemplate/browse/part_bill_event.cgi create mode 100755 httemplate/edit/part_bill_event.cgi create mode 100755 httemplate/edit/process/part_bill_event.cgi diff --git a/FS/FS.pm b/FS/FS.pm index ca3330066..60831ecd5 100644 --- a/FS/FS.pm +++ b/FS/FS.pm @@ -14,8 +14,7 @@ FS - Freeside Perl modules =head1 SYNOPSIS -FS is the unofficial (i.e. non-CPAN) prefix for the Perl module portion of the -Freeside ISP billing software. This includes: +Freeside perl modules and CLI utilities. =head2 Utility classes @@ -25,9 +24,7 @@ L - Freeside configuration option meta-data. L - User class (not yet OO) -L - Non OO-subroutines for the web interface. This is -depriciated. Future development will be focused on the FS::UI user-interface -classes (see below). +L - Non OO-subroutines for the web interface. =head2 Database record classes @@ -60,6 +57,10 @@ L - Service definition class L - Column constraint class +L - External provisioning export class + +L - Export option class + L - Package (billing item) definition class L - Class linking package (billing item) @@ -87,6 +88,10 @@ L - Invoice class L - Invoice line item class +L - Invoice event definition class + +L - Completed invoice event class + L - Payment class L - Payment application class @@ -113,7 +118,27 @@ L - Job queue L - Job arguments -=head2 User Interface classes (under development; not yet usable) +=head1 Remote API modules + +L + +L + +L + +=head2 Command-line utilities + +L + +L + +L + +L + +L + +=head2 User Interface classes (under (stalled) development; not yet usable) L - User-interface base class @@ -139,17 +164,17 @@ Providers. The Freeside home page is at . -The main documentation is in htdocs/docs. - -=head1 VERSION - -$Id: FS.pm,v 1.10 2001-10-24 15:29:30 ivan Exp $ +The main documentation is in httemplate/docs. =head1 SUPPORT -A mailing list for users and developers is available. Send a blank message to +A mailing list for users is available. Send a blank message to to subscribe. +A mailing list for developers is available. It is intended to be lower volume +and higher SNR than the users list. Send a blank message to + to subscribe. + Commercial support is available; see . @@ -166,10 +191,6 @@ perl(1), main Freeside documentation in htdocs/docs/ =head1 BUGS -The version number of the FS Perl extension differs from the version of the -Freeside distribution, which are both different from the CVS version tag for -each file, which appears under the VERSION heading. - Those modules which would be useful separately should be pulled out, renamed appropriately and uploaded to CPAN. So far: DBIx::DBSchema, Net::SSH and Net::SCP... diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm index 6b7997f21..4286606f0 100644 --- a/FS/FS/Record.pm +++ b/FS/FS/Record.pm @@ -1,7 +1,8 @@ package FS::Record; use strict; -use vars qw($dbdef_file $dbdef $setup_hack $AUTOLOAD @ISA @EXPORT_OK $DEBUG); +use vars qw( $dbdef_file $dbdef $setup_hack $AUTOLOAD @ISA @EXPORT_OK $DEBUG + $me ); use subs qw(reload_dbdef); use Exporter; use Carp qw(carp cluck croak confess); @@ -16,6 +17,7 @@ use FS::SearchCache; @EXPORT_OK = qw(dbh fields hfields qsearch qsearchs dbdef jsearch); $DEBUG = 0; +$me = '[FS::Record]'; #ask FS::UID to run this stuff for us later $FS::UID::callback{'FS::Record'} = sub { @@ -225,7 +227,7 @@ sub qsearch { } $statement .= " $extra_sql" if defined($extra_sql); - warn $statement if $DEBUG; + warn "[debug]$me $statement\n" if $DEBUG; my $sth = $dbh->prepare($statement) or croak "$dbh->errstr doing $statement"; @@ -474,6 +476,7 @@ sub insert { join(', ',map(_quote($self->getfield($_),$self->table,$_), @fields)). ")" ; + warn "[debug]$me $statement\n" if $DEBUG; my $sth = dbh->prepare($statement) or return dbh->errstr; local $SIG{HUP} = 'IGNORE'; @@ -523,6 +526,7 @@ sub delete { ? ( $self->dbdef_table->primary_key) : $self->fields ); + warn "[debug]$me $statement\n" if $DEBUG; my $sth = dbh->prepare($statement) or return dbh->errstr; local $SIG{HUP} = 'IGNORE'; @@ -561,11 +565,11 @@ returns the error, otherwise returns false. sub replace { my ( $new, $old ) = ( shift, shift ); - warn "[debug][FS::Record] $new ->replace $old\n" if $DEBUG; + warn "[debug]$me $new ->replace $old\n" if $DEBUG; my @diff = grep $new->getfield($_) ne $old->getfield($_), $old->fields; unless ( @diff ) { - carp "[warning][FS::Record] $new -> replace $old: records identical"; + carp "[warning]$me $new -> replace $old: records identical"; return ''; } @@ -596,6 +600,7 @@ sub replace { } ( $primary_key ? ( $primary_key ) : $old->fields ) ) ; + warn "[debug]$me $statement\n" if $DEBUG; my $sth = dbh->prepare($statement) or return dbh->errstr; local $SIG{HUP} = 'IGNORE'; diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index 1a9d43e94..8a7a6f806 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -831,6 +831,18 @@ sub suspend { grep { $_->suspend } $self->unsuspended_pkgs; } +=item cancel + +Cancels all uncancelled packages (see L) for this customer. +Always returns a list: an empty list on success or a list of errors. + +=cut + +sub cancel { + my $self = shift; + grep { $_->cancel } $self->ncancelled_pkgs; +} + =item bill OPTIONS Generates invoices (see L) for this customer. Usually used in @@ -1722,7 +1734,7 @@ sub check_invoicing_list { =item default_invoicing_list -Returns the email addresses of any +Sets the invoicing list to all accounts associated with this customer. =cut @@ -1740,6 +1752,21 @@ sub default_invoicing_list { $self->invoicing_list(\@list); } +=item invoicing_list_addpost + +Adds postal invoicing to this customer. If this customer is already configured +to receive postal invoices, does nothing. + +=cut + +sub invoicing_list_addpost { + my $self = shift; + return if grep { $_ eq 'POST' } $self->invoicing_list; + my @invoicing_list = $self->invoicing_list; + push @invoicing_list, 'POST'; + $self->invoicing_list(\@invoicing_list); +} + =item referral_cust_main [ DEPTH [ EXCLUDE_HASHREF ] ] Returns an array of customers referred by this customer (referral_custnum set @@ -1966,7 +1993,7 @@ sub append_fuzzyfiles { =head1 VERSION -$Id: cust_main.pm,v 1.54 2002-01-09 13:29:33 ivan Exp $ +$Id: cust_main.pm,v 1.55 2002-01-29 16:33:15 ivan Exp $ =head1 BUGS diff --git a/FS/FS/cust_pay.pm b/FS/FS/cust_pay.pm index 3f811357a..51c7b29e1 100644 --- a/FS/FS/cust_pay.pm +++ b/FS/FS/cust_pay.pm @@ -181,11 +181,17 @@ sub upgrade_replace { #1.3.x->1.4.x '_date' => $self->_date, }; $error = $cust_bill_pay->insert; - if ( $error ) { + if ( $error =~ + /total cust_bill_pay.amount and cust_credit_bill.amount .* for invnum .* greater than cust_bill.charged/ ) { + #warn $error; + my $cust_bill = qsearchs( 'cust_bill', { 'invnum' => $self->invnum } ); + $new->custnum($cust_bill->custnum); + } elsif ( $error ) { $dbh->rollback if $oldAutoCommit; return $error; + } else { + $new->custnum($cust_bill_pay->cust_bill->custnum); } - $new->custnum($cust_bill_pay->cust_bill->custnum); } else { die; } @@ -312,7 +318,7 @@ sub unapplied { =head1 VERSION -$Id: cust_pay.pm,v 1.14 2002-01-28 06:57:23 ivan Exp $ +$Id: cust_pay.pm,v 1.15 2002-01-29 16:33:15 ivan Exp $ =head1 BUGS diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm index 633b3224f..b241ecac2 100644 --- a/FS/FS/cust_pkg.pm +++ b/FS/FS/cust_pkg.pm @@ -71,6 +71,8 @@ FS::cust_pkg - Object methods for cust_pkg objects @labels = $record->labels; + $seconds = $record->seconds_since($timestamp); + $error = FS::cust_pkg::order( $custnum, \@pkgparts ); $error = FS::cust_pkg::order( $custnum, \@pkgparts, \@remove_pkgnums ] ); @@ -487,6 +489,30 @@ sub cust_main { qsearchs( 'cust_main', { 'custnum' => $self->custnum } ); } +=item seconds_since TIMESTAMP + +Returns the number of seconds all accounts (see L) in this +package have been online since TIMESTAMP. + +TIMESTAMP is specified as a UNIX timestamp; see L. Also see +L and L for conversion functions. + +=cut + +sub seconds_since { + my($self, $since) = @_; + my $seconds = 0; + + foreach my $cust_svc ( + grep { $_->part_svc->svcdb eq 'svc_acct' } $self->cust_svc + ) { + $seconds += $cust_svc->seconds_since($since); + } + + $seconds; + +} + =back =head1 SUBROUTINES @@ -630,7 +656,7 @@ sub order { =head1 VERSION -$Id: cust_pkg.pm,v 1.15 2002-01-21 11:30:17 ivan Exp $ +$Id: cust_pkg.pm,v 1.16 2002-01-29 16:33:15 ivan Exp $ =head1 BUGS diff --git a/FS/FS/cust_svc.pm b/FS/FS/cust_svc.pm index 5fca892cd..541f0c801 100644 --- a/FS/FS/cust_svc.pm +++ b/FS/FS/cust_svc.pm @@ -3,7 +3,7 @@ package FS::cust_svc; use strict; use vars qw( @ISA ); use Carp qw( cluck ); -use FS::Record qw( qsearchs ); +use FS::Record qw( qsearchs dbh ); use FS::cust_pkg; use FS::part_pkg; use FS::part_svc; @@ -159,13 +159,8 @@ Returns a list consisting of: sub label { my $self = shift; my $svcdb = $self->part_svc->svcdb; - my $svc_x; - if ( $svcdb eq 'svc_acct' && $self->{'_svc_acct'} ) { - $svc_x = $self->{'_svc_acct'}; - } else { - $svc_x = qsearchs( $svcdb, { 'svcnum' => $self->svcnum } ) - or die "can't find $svcdb.svcnum ". $self->svcnum; - } + my $svc_x = $self->svc_x + or die "can't find $svcdb.svcnum ". $self->svcnum; my $tag; if ( $svcdb eq 'svc_acct' ) { $tag = $svc_x->email; @@ -195,11 +190,49 @@ sub label { $self->part_svc->svc, $tag, $svcdb; } +=item svc_x + +Returns the FS::svc_XXX object for this service (i.e. an FS::svc_acct object or +FS::svc_domain object, etc.) + +=cut + +sub svc_x { + my $self = shift; + my $svcdb = $self->part_svc->svcdb; + if ( $svcdb eq 'svc_acct' && $self->{'_svc_acct'} ) { + $self->{'_svc_acct'}; + } else { + qsearchs( $svcdb, { 'svcnum' => $self->svcnum } ); + } +} + +=item seconds_since TIMESTAMP + +See L. Equivalent to +$cust_svc->svc_x->seconds_since, but more efficient. Meaningless for records +where B is not "svc_acct". + +=cut + +#note: implementation here, POD in FS::svc_acct +sub seconds_since { + my($self, $since) = @_; + my $dbh = dbh; + my $sth = $dbh->prepare(' SELECT SUM(logout-login) FROM session + WHERE svcnum = ? + AND login >= ? + AND logout IS NOT NULL' + ) or die $dbh->errstr; + $sth->execute($self->svcnum, $since) or die $sth->errstr; + $sth->fetchrow_arrayref->[0]; +} + =back =head1 VERSION -$Id: cust_svc.pm,v 1.8 2001-12-15 22:58:33 ivan Exp $ +$Id: cust_svc.pm,v 1.9 2002-01-29 16:33:15 ivan Exp $ =head1 BUGS diff --git a/FS/FS/svc_acct.pm b/FS/FS/svc_acct.pm index 0340e7cc5..16270f9cc 100644 --- a/FS/FS/svc_acct.pm +++ b/FS/FS/svc_acct.pm @@ -134,6 +134,14 @@ FS::svc_acct - Object methods for svc_acct records %hash = $record->radius_check; + $domain = $record->domain; + + $svc_domain = $record->svc_domain; + + $email = $record->email; + + $seconds_since = $record->seconds_since($timestamp); + =head1 DESCRIPTION An FS::svc_acct object represents an account. FS::svc_acct inherits from @@ -990,6 +998,15 @@ sub svc_domain { : qsearchs( 'svc_domain', { 'svcnum' => $self->domsvc } ); } +=item cust_svc + +Returns the FS::cust_svc record for this account (see L). + +sub cust_svc { + my $self = shift; + qsearchs( 'cust_svc', { 'svcnum' => $self->svcnum } ); +} + =item email Returns an email address associated with the account. @@ -1001,6 +1018,22 @@ sub email { $self->username. '@'. $self->domain; } +=item seconds_since TIMESTAMP + +Returns the number of seconds this account has been online since TIMESTAMP. +See L + +TIMESTAMP is specified as a UNIX timestamp; see L. Also see +L and L for conversion functions. + +=cut + +#note: POD here, implementation in FS::cust_svc +sub seconds_since { + my $self = shift; + $self->cust_svc->seconds_since(@_); +} + =item ssh =cut @@ -1033,7 +1066,7 @@ sub ssh { =head1 VERSION -$Id: svc_acct.pm,v 1.63 2002-01-22 14:53:26 ivan Exp $ +$Id: svc_acct.pm,v 1.64 2002-01-29 16:33:15 ivan Exp $ =head1 BUGS diff --git a/Makefile b/Makefile index 121123287..6fa389355 100644 --- a/Makefile +++ b/Makefile @@ -24,17 +24,18 @@ FREESIDE_CONF = /usr/local/etc/freeside help: @echo "supported targets: aspdocs masondocs alldocs docs install-docs" + @echo " htmlman" @echo " perl-modules install-perl-modules" @echo " install deploy" @echo " create-database" @echo " clean" -aspdocs: httemplate/* httemplate/*/* httemplate/*/*/* httemplate/*/*/*/* httemplate/*/*/*/*/* +aspdocs: htmlman httemplate/* httemplate/*/* httemplate/*/*/* httemplate/*/*/*/* httemplate/*/*/*/*/* rm -rf aspdocs cp -pr httemplate aspdocs touch aspdocs -masondocs: httemplate/* httemplate/*/* httemplate/*/*/* httemplate/*/*/*/* httemplate/*/*/*/*/* +masondocs: htmlman httemplate/* httemplate/*/* httemplate/*/*/* httemplate/*/*/*/* httemplate/*/*/*/*/* rm -rf masondocs cp -pr httemplate masondocs ( cd masondocs; \ @@ -47,6 +48,13 @@ alldocs: aspdocs masondocs docs: make ${TEMPLATE}docs +htmlman: + bin/pod2x + +upload-docs: + ssh cleanwhisker.420.am rm -rf /var/www/www.sisd.com/freeside/devdocs + scp -pr httemplate/docs cleanwhisker.420.am:/var/www/www.sisd.com/freeside/devdocs + install-docs: docs [ -e ${FREESIDE_DOCUMENT_ROOT} ] && mv ${FREESIDE_DOCUMENT_ROOT} ${FREESIDE_DOCUMENT_ROOT}.`date +%Y%m%d%H%M%S` || true cp -r ${TEMPLATE}docs ${FREESIDE_DOCUMENT_ROOT} diff --git a/bin/pod2x b/bin/pod2x index 8c020062c..cbe142389 100755 --- a/bin/pod2x +++ b/bin/pod2x @@ -15,17 +15,41 @@ die "Can't find $site_perl" unless -d $site_perl; #die "Can't find $catman" unless -d $catman; die "Can't find $html" unless -d $html; +#make some useless links +foreach my $file ( + glob("$site_perl/bin/freeside-*"), +) { + next if $file =~ /\.pod$/; + #symlink $file, "$file.pod"; # or die "link $file to $file.pod: $!"; + system("cp $file $file.pod"); +} + foreach my $file ( glob("$site_perl/*.pm"), glob("$site_perl/*/*.pm"), - glob("$site_perl/*/*/*.pm") + glob("$site_perl/*/*/*.pm"), + glob("$site_perl/bin/*.pod"), + glob("./fs_sesmon/FS-SessionClient/*.pm"), + glob("./fs_signup/FS-SignupClient/*.pm"), + glob("./fs_selfadmin/FS-MailAdminServer/*.pm"), ) { #$file =~ /\/([\w\-]+)\.pm$/ or die "oops file $file"; - $file =~ /$site_perl\/(.*)\.pm$/ or die "oops file $file"; - my $name = $1; + my $name; + if ( $file =~ /fs_\w+\/FS\-\w+\/(.*)\.pm$/ ) { + $name = "FS/$1"; + } elsif ( $file =~ /$site_perl\/(.*)\.(pm|pod)$/ ) { + $name = $1; + } else { + die "oops file $file"; + } print "$name\n"; my $htmlroot = join('/', map '..',1..(scalar($file =~ tr/\///)-2)) || '.'; # system "pod2text $file >$catman/$name.txt"; - system "pod2html --podroot=$site_perl --podpath=./FS:./FS/UI:. --norecurse --htmlroot=$htmlroot $file >$html/$name.html"; + system "pod2html --podroot=$site_perl --podpath=./FS:./FS/UI:.:./bin --norecurse --htmlroot=$htmlroot $file >$html/$name.html"; + #system "pod2html --podroot=$site_perl --htmlroot=$htmlroot $file >$html/$name.html"; # system "pod2html $file >$html/$name.html"; } + +#remove the useless links +unlink glob("$site_perl/bin/*.pod"); + diff --git a/htetc/global.asa b/htetc/global.asa index c22afc132..20ef1467d 100644 --- a/htetc/global.asa +++ b/htetc/global.asa @@ -5,6 +5,7 @@ use CGI; use HTML::Entities; use Date::Format; use Date::Parse; +use Tie::IxHash; use FS::UID qw(cgisuidsetup dbh); use FS::Record qw(qsearch qsearchs fields); use FS::part_svc; @@ -12,6 +13,7 @@ use FS::part_pkg; use FS::pkg_svc; use FS::cust_pkg; use FS::cust_svc; +use FS::part_bill_event; use FS::CGI qw(header menubar popurl table itable ntable); sub Script_OnStart { diff --git a/htetc/handler.pl b/htetc/handler.pl index e643559f0..6ff9d436c 100644 --- a/htetc/handler.pl +++ b/htetc/handler.pl @@ -59,6 +59,7 @@ sub handler #use CGI::Carp qw(fatalsToBrowser); use Date::Format; use Date::Parse; + use Tie::IxHash; use HTML::Entities; use FS::UID qw(cgisuidsetup); use FS::Record qw(qsearch qsearchs fields); @@ -67,6 +68,7 @@ sub handler use FS::pkg_svc; use FS::cust_pkg; use FS::cust_svc; + use FS::part_bill_event; use FS::CGI qw(header menubar popurl table itable ntable); $cgi = new CGI; diff --git a/httemplate/browse/part_bill_event.cgi b/httemplate/browse/part_bill_event.cgi new file mode 100755 index 000000000..f33997666 --- /dev/null +++ b/httemplate/browse/part_bill_event.cgi @@ -0,0 +1,64 @@ + +<% + +my %search; +if ( $cgi->param('showdisabled') ) { + %search = (); +} else { + %search = ( 'disabled' => '' ); +} + +my @part_bill_event = qsearch('part_bill_event', \%search ); +my $total = scalar(@part_bill_event); + +%> +<%= header('Invoice Event Listing', menubar( 'Main Menu' => $p) ) %> + + Invoice events are actions taken on overdue invoices.

+<%= $total %> events +<%= $cgi->param('showdisabled') + ? do { $cgi->param('showdisabled', 0); + '( hide disabled events )'; } + : do { $cgi->param('showdisabled', 1); + '( show disabled events )'; } +%> + + + + + + + + +<% foreach my $part_bill_event ( sort { $a->payby cmp $b->payby + || $a->seconds <=> $b->seconds + || $a->eventpart <=> $b->eventpart + } @part_bill_event ) { + my $url = "${p}edit/part_bill_event.cgi?". $part_bill_event->eventpart; + use Time::Duration; + my $delay = duration_exact($hashref->{seconds}); +%> + + +<% unless ( $cgi->param('showdisabled') ) { %> + +<% } %> + + + + + +<% } %> + + + + +
param('showdisabled') ? 2 : 3 %>>EventPaybyAfterCode
+ <%= $part_bill_event->eventpart %> + <%= $part_bill_event->disabled ? 'DISABLED' : '' %> + <%= $part_bill_event->event %> + <%= $part_bill_event->payby %> + <%= $delay %> + <%= $part_bill_event->eventcode %>
Add a new billing event
+ + diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index 5e36d14a6..20bb168df 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -32,6 +32,7 @@ Before installing, you need:
  • MailTools
  • TimeDate
  • DateManip +
  • Time-Duration
  • File-CounterFile
  • FreezeThaw
  • String-Approx @@ -45,6 +46,7 @@ Before installing, you need:
  • String-ShellQuote
  • Net-SCP
  • Apache::ASP or HTML::Mason +
  • Tie-IxHash Install the Freeside distribution: @@ -151,10 +153,10 @@ require valid-user
    • First user:
      $ su
      -$ freeside-adduser -c -h /usr/local/etc/freeside/htpasswd username
      +$ freeside-adduser -c -h /usr/local/etc/freeside/htpasswd username
    • Additional users:
      $ su
      -$ freeside-adduser -h /usr/local/etc/freeside/htpasswd username
      +$ freeside-adduser -h /usr/local/etc/freeside/htpasswd username
    (using other auth types, add each user to your Apache authentication and then run: freeside-adduser username
  • As the freeside UNIX user, run bin/fs-setup username to create the database tables, passing the username of a Freeside user you created above: diff --git a/httemplate/docs/man/FS.html b/httemplate/docs/man/FS.html index 23e8ca42f..7db6bb9fd 100644 --- a/httemplate/docs/man/FS.html +++ b/httemplate/docs/man/FS.html @@ -17,12 +17,17 @@
  • Utility classes
  • Database record classes
  • -
  • User Interface classes (under development; not yet usable)
  • + + +
  • Remote API modules
  • +
  • DESCRIPTION
  • -
  • VERSION
  • SUPPORT
  • AUTHOR
  • SEE ALSO
  • @@ -37,29 +42,32 @@


    SYNOPSIS

    -

    FS is the unofficial (i.e. non-CPAN) prefix for the Perl module portion of the -Freeside ISP billing software. This includes:

    +

    Freeside perl modules and CLI utilities.

    Utility classes

    the FS::Conf manpage - Freeside configuration values

    +

    the FS::ConfItem manpage - Freeside configuration option meta-data.

    the FS::UID manpage - User class (not yet OO)

    -

    the FS::CGI manpage - Non OO-subroutines for the web interface. This is -depriciated. Future development will be focused on the FS::UI user-interface -classes (see below).

    +

    the FS::CGI manpage - Non OO-subroutines for the web interface.

    Database record classes

    the FS::Record manpage - Database record base class

    the FS::svc_acct_pop manpage - POP (Point of Presence, not Post Office Protocol) class

    +

    the FS::part_pop_local manpage - Local calling area class

    the FS::part_referral manpage - Referral class

    the FS::cust_main_county manpage - Locale (tax rate) class

    the FS::svc_Common manpage - Service base class

    the FS::svc_acct manpage - Account (shell, RADIUS, POP3) class

    the FS::svc_domain manpage - Domain class

    the FS::domain_record manpage - DNS zone entries

    -

    the FS::svc_acct_sm manpage - Vitual mail alias class

    +

    the FS::svc_forward manpage - Mail forwarding class

    +

    the FS::svc_acct_sm manpage - (Depreciated) Vitual mail alias class

    the FS::svc_www manpage - Web virtual host class.

    the FS::part_svc manpage - Service definition class

    +

    the FS::part_svc_column manpage - Column constraint class

    +

    the FS::part_export manpage - External provisioning export class

    +

    the FS::part_export_option manpage - Export option class

    the FS::part_pkg manpage - Package (billing item) definition class

    the FS::pkg_svc manpage - Class linking package (billing item) definitions (see the FS::part_pkg manpage) with service definitions @@ -76,16 +84,36 @@ definitions (see the FS::part_pkg manpage) wi class

    the FS::cust_bill manpage - Invoice class

    the FS::cust_bill_pkg manpage - Invoice line item class

    +

    the FS::part_bill_event manpage - Invoice event definition class

    +

    the FS::cust_bill_event manpage - Completed invoice event class

    the FS::cust_pay manpage - Payment class

    +

    the FS::cust_bill_pay manpage - Payment application class

    the FS::cust_credit manpage - Credit class

    the FS::cust_refund manpage - Refund class

    +

    the FS::cust_credit_refund manpage - Refund application class

    +

    the FS::cust_credit_bill manpage - Credit invoice application class

    the FS::cust_pay_batch manpage - Credit card transaction queue class

    the FS::prepay_credit manpage - Prepaid ``calling card'' credit class.

    the FS::nas manpage - Network Access Server class

    the FS::port manpage - NAS port class

    the FS::session manpage - User login session class

    +

    the FS::queue manpage - Job queue

    +

    the FS::queue_arg manpage - Job arguments

    -

    User Interface classes (under development; not yet usable)

    +
    +

    Remote API modules

    +

    the FS::SignupClient manpage

    +

    the FS::SessionClient manpage

    +

    the FS::MailAdminServer manpage

    +

    +

    Command-line utilities

    +

    the freeside-email manpage

    +

    the freeside-queued manpage

    +

    the freeside-adduser manpage

    +

    the freeside-bill manpage

    +

    the freeside-overdue manpage

    +

    +

    User Interface classes (under (stalled) development; not yet usable)

    the FS::UI::Base manpage - User-interface base class

    the FS::UI::Gtk manpage - Gtk user-interface class

    the FS::UI::CGI manpage - CGI (HTML) user-interface class

    @@ -95,22 +123,23 @@ class

    To quote perl(1), ``If you're intending to read these straight through for the first time, the suggested order will tend to reduce the number of forward references.''

    +

    If you've never used OO modules before, +http://www.cpan.org/doc/FMTEYEWTK/easy_objects.html might help you out.


    DESCRIPTION

    Freeside is a billing and administration package for Internet Service Providers.

    The Freeside home page is at <http://www.sisd.com/freeside>.

    -

    The main documentation is in htdocs/docs.

    -

    -


    -

    VERSION

    -

    $Id: FS.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

    +

    The main documentation is in httemplate/docs.


    SUPPORT

    -

    A mailing list for users and developers is available. Send a blank message to +

    A mailing list for users is available. Send a blank message to <ivan-freeside-subscribe@sisd.com> to subscribe.

    +

    A mailing list for developers is available. It is intended to be lower volume +and higher SNR than the users list. Send a blank message to +<ivan-freeside-devel-subscribe@sisd.com> to subscribe.

    Commercial support is available; see <http://www.sisd.com/freeside/commercial.html>.

    @@ -126,9 +155,6 @@ list and the individal files for details.


    BUGS

    -

    The version number of the FS Perl extension differs from the version of the -Freeside distribution, which are both different from the CVS version tag for -each file, which appears under the VERSION heading.

    Those modules which would be useful separately should be pulled out, renamed appropriately and uploaded to CPAN. So far: DBIx::DBSchema, Net::SSH and Net::SCP...

    diff --git a/httemplate/docs/man/FS/CGI.html b/httemplate/docs/man/FS/CGI.html index 05f7823b4..54a0bf39b 100644 --- a/httemplate/docs/man/FS/CGI.html +++ b/httemplate/docs/man/FS/CGI.html @@ -79,12 +79,17 @@ Returns HTML tag for beginning an (invisible) table.
    ntable
    This is getting silly. +

    +
    small_custview CUSTNUM || CUST_MAIN_OBJECT, COUNTRYDEFAULT
    +
    +Sheesh. I should just switch to Mason.


    BUGS

    Not OO.

    Not complete.

    +

    small_custview sooooo doesn't belong here. i should just switch to Mason.


    SEE ALSO

    diff --git a/httemplate/docs/man/FS/Conf.html b/httemplate/docs/man/FS/Conf.html index 7b1613efd..be49be31f 100644 --- a/httemplate/docs/man/FS/Conf.html +++ b/httemplate/docs/man/FS/Conf.html @@ -1,6 +1,6 @@ -FS::Conf - Read access to Freeside configuration values +FS::Conf - Freeside configuration values @@ -23,7 +23,7 @@

    NAME

    -

    FS::Conf - Read access to Freeside configuration values

    +

    FS::Conf - Freeside configuration values


    SYNOPSIS

    @@ -40,10 +40,12 @@ $value = $conf->config('key'); @list = $conf->config('key'); $bool = $conf->exists('key'); +
    +  @config_items = $conf->config_items;


    DESCRIPTION

    -

    Read access to Freeside configuration values. Keys currently map to filenames, +

    Read and write Freeside configuration values. Keys currently map to filenames, but this may change in the future.


    @@ -66,15 +68,29 @@ Returns the configuration value or values (depending on context) for key.
    Returns true if the specified key exists, even if the corresponding value is undefined. +

    +
    touch
    +
    +
    set
    +
    +
    delete
    +
    +
    config_items
    +
    +Returns all of the possible configuration items as FS::ConfItem objects. See +the FS::ConfItem manpage.


    BUGS

    -

    Write access (with locking) should be implemented.

    +

    Write access (touch, set, delete) should be documented.

    +

    If this was more than just crud that will never be useful outside Freeside I'd +worry that config_items is freeside-specific and icky.


    SEE ALSO

    -

    config.html from the base documentation contains a list of configuration files.

    +

    ``Configuration'' in the web interface (config/config.cgi).

    +

    httemplate/docs/config.html

    diff --git a/httemplate/docs/man/FS/Record.html b/httemplate/docs/man/FS/Record.html index 09304083f..108a84ad7 100644 --- a/httemplate/docs/man/FS/Record.html +++ b/httemplate/docs/man/FS/Record.html @@ -17,7 +17,6 @@
  • CONSTRUCTORS
  • METHODS
  • SUBROUTINES
  • -
  • VERSION
  • BUGS
  • SEE ALSO
  • @@ -68,16 +67,17 @@
         $value = $record->unique('column');
    -    $value = $record->ut_float('column');
    -    $value = $record->ut_number('column');
    -    $value = $record->ut_numbern('column');
    -    $value = $record->ut_money('column');
    -    $value = $record->ut_text('column');
    -    $value = $record->ut_textn('column');
    -    $value = $record->ut_alpha('column');
    -    $value = $record->ut_alphan('column');
    -    $value = $record->ut_phonen('column');
    -    $value = $record->ut_anythingn('column');
    + $error = $record->ut_float('column'); + $error = $record->ut_number('column'); + $error = $record->ut_numbern('column'); + $error = $record->ut_money('column'); + $error = $record->ut_text('column'); + $error = $record->ut_textn('column'); + $error = $record->ut_alpha('column'); + $error = $record->ut_alphan('column'); + $error = $record->ut_phonen('column'); + $error = $record->ut_anything('column'); + $error = $record->ut_name('column');
         $dbdef = reload_dbdef;
         $dbdef = reload_dbdef "/non/standard/filename";
    @@ -125,6 +125,14 @@ objects.
     #regular FS::TABLE methods
     #on it.

    +
    jsearch TABLE, HASHREF, SELECT, EXTRA_SQL, PRIMARY_TABLE, PRIMARY_KEY
    +
    +Experimental JOINed search method. Using this method, you can execute a +single SELECT spanning multiple tables, and cache the results for subsequent +method calls. Interface will almost definately change in an incompatible +fashion. +

    Arguments:

    +

    qsearchs TABLE, HASHREF
    Same as qsearch, except that if more than one record matches, it carps but @@ -266,10 +274,29 @@ Check/untaint ip addresses. IPv4 only for now. May be null.
    Check/untaint host and domain names.

    +
    ut_name COLUMN
    +
    +Check/untaint proper names; allows alphanumerics, spaces and the following +punctuation: , . - ' +

    May not be null.

    +

    +
    ut_zip COLUMN
    +
    +Check/untaint zip codes. +

    +
    ut_country COLUMN
    +
    +Check/untaint country codes. Country names are changed to codes, if possible - +see the Locale::Country manpage. +

    ut_anything COLUMN
    Untaints arbitrary data. Be careful.

    +
    ut_enum COLUMN CHOICES_ARRAYREF
    +
    +Check/untaint a column, supplying all possible choices, like the ``enum'' type. +

    fields [ TABLE ]
    This can be used as both a subroutine and a method call. It returns a list @@ -303,10 +330,6 @@ This is depriciated. Don't use it.


    -

    VERSION

    -

    $Id: Record.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

    -

    -


    BUGS

    This module should probably be renamed, since much of the functionality is of general use. It is not completely unlike Adapter::DBI (see below).

    @@ -323,7 +346,7 @@ true maps to the database (and WHERE clauses) would also help.

    A fallback check method should be provided which uses the dbdef.

    The ut_money method assumes money has two decimal digits.

    The Pg money kludge in the new method only strips `$'.

    -

    The ut_phonen method assumes US-style phone numbers.

    +

    The ut_phonen method only checks US-style phone numbers.

    The _quote function should probably use ut_float instead of a regex.

    All the subroutines probably should be methods, here or elsewhere.

    Probably should borrow/use some dbdef methods where appropriate (like sub @@ -331,6 +354,7 @@ fields)

    As of 1.14, DBI fetchall_hashref( {} ) doesn't set fetchrow_hashref NAME_lc, or allow it to be set. Working around it is ugly any way around - DBI should be fixed. (only affects RDBMS which return uppercase column names)

    +

    ut_zip should take an optional country like ut_phone.


    SEE ALSO

    diff --git a/httemplate/docs/man/FS/SessionClient.html b/httemplate/docs/man/FS/SessionClient.html index 615f35e0e..0abb2a6a1 100644 --- a/httemplate/docs/man/FS/SessionClient.html +++ b/httemplate/docs/man/FS/SessionClient.html @@ -83,7 +83,7 @@ optional, but must be correct if specified.


    VERSION

    -

    $Id: SessionClient.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

    +

    $Id: SessionClient.html,v 1.3 2002-01-29 17:42:46 ivan Exp $


    BUGS

    diff --git a/httemplate/docs/man/FS/SignupClient.html b/httemplate/docs/man/FS/SignupClient.html index 844f64f33..3438c804a 100644 --- a/httemplate/docs/man/FS/SignupClient.html +++ b/httemplate/docs/man/FS/SignupClient.html @@ -1,124 +1,131 @@ FS::SignupClient - Freeside signup client API - + +

    -

    NAME

    -

    -FS::SignupClient - Freeside signup client API - +

    NAME

    +

    FS::SignupClient - Freeside signup client API


    -

    SYNOPSIS

    -

    -

      use FS::SignupClient qw( signup_info new_customer );
    -
    -

    -

      ( $locales, $packages, $pops ) = signup_info;
    -
    -

    -

      $error = new_customer ( {
    -    'first'          => $first,
    -    'last'           => $last,
    -    'ss'             => $ss,
    -    'comapny'        => $company,
    -    'address1'       => $address1,
    -    'address2'       => $address2,
    -    'city'           => $city,
    -    'county'         => $county,
    -    'state'          => $state,
    -    'zip'            => $zip,
    -    'country'        => $country,
    -    'daytime'        => $daytime,
    -    'night'          => $night,
    -    'fax'            => $fax,
    -    'payby'          => $payby,
    -    'payinfo'        => $payinfo,
    -    'paydate'        => $paydate,
    -    'payname'        => $payname,
    -    'invoicing_list' => $invoicing_list,
    -    'pkgpart'        => $pkgpart,
    -    'username'       => $username,
    -    '_password'       => $password,
    -    'popnum'         => $popnum,
    -  } );
    -
    +

    SYNOPSIS

    +
    +  use FS::SignupClient qw( signup_info new_customer );
    +
    +  ( $locales, $packages, $pops ) = signup_info;
    +
    +  $error = new_customer ( {
    +    'first'            => $first,
    +    'last'             => $last,
    +    'ss'               => $ss,
    +    'comapny'          => $company,
    +    'address1'         => $address1,
    +    'address2'         => $address2,
    +    'city'             => $city,
    +    'county'           => $county,
    +    'state'            => $state,
    +    'zip'              => $zip,
    +    'country'          => $country,
    +    'daytime'          => $daytime,
    +    'night'            => $night,
    +    'fax'              => $fax,
    +    'payby'            => $payby,
    +    'payinfo'          => $payinfo,
    +    'paydate'          => $paydate,
    +    'payname'          => $payname,
    +    'invoicing_list'   => $invoicing_list,
    +    'referral_custnum' => $referral_custnum,
    +    'pkgpart'          => $pkgpart,
    +    'username'         => $username,
    +    '_password'        => $password,
    +    'popnum'           => $popnum,
    +  } );


    -

    DESCRIPTION

    -

    -This module provides an API for a remote signup server. - -

    -It needs to be run as the freeside user. Because of this, the program which -calls these subroutines should be written very carefully. - +

    DESCRIPTION

    +

    This module provides an API for a remote signup server.

    +

    It needs to be run as the freeside user. Because of this, the program which +calls these subroutines should be written very carefully.


    -

    SUBROUTINES

    +

    SUBROUTINES

    -
    signup_info
    -

    +

    signup_info
    +
    Returns three array references of hash references. - -

    -The first set of hash references is of allowable locales. Each hash -reference has the following keys: taxnum state county country - -

    -The second set of hash references is of allowable packages. Each hash -reference has the following keys: pkgpart pkg - -

    -The third set of hash references is of allowable POPs (Points Of Presence). -Each hash reference has the following keys: popnum city state ac exch - -

    new_customer HASHREF
    -

    -Adds a customer to the remote Freeside system. Requires a hash reference as -a paramater with the following keys: first last ss comapny address1 -address2 city county state zip country daytime night fax payby payinfo -paydate payname invoicing_list pkgpart username _password popnum - -

    -Returns a scalar error message, or the empty string for success. - -

    +

    The first set of hash references is of allowable locales. Each hash reference +has the following keys: + taxnum + state + county + country

    +

    The second set of hash references is of allowable packages. Each hash +reference has the following keys: + pkgpart + pkg

    +

    The third set of hash references is of allowable POPs (Points Of Presence). +Each hash reference has the following keys: + popnum + city + state + ac + exch

    +

    +
    new_customer HASHREF
    +
    +Adds a customer to the remote Freeside system. Requires a hash reference as +a paramater with the following keys: + first + last + ss + comapny + address1 + address2 + city + county + state + zip + country + daytime + night + fax + payby + payinfo + paydate + payname + invoicing_list + referral_custnum + pkgpart + username + _password + popnum +

    Returns a scalar error message, or the empty string for success.

    +


    -

    VERSION

    -

    -$Id: SignupClient.html,v 1.1 2001-07-30 07:36:03 ivan Exp $ - -

    -


    -

    BUGS

    +

    BUGS


    -

    SEE ALSO

    -

    -fs_signupd, FS::SignupServer, FS::cust_main - - +

    SEE ALSO

    +

    fs_signupd, the FS::SignupServer manpage, the FS::cust_main manpage

    diff --git a/httemplate/docs/man/FS/UID.html b/httemplate/docs/man/FS/UID.html index 9f4947765..3c28eebfd 100644 --- a/httemplate/docs/man/FS/UID.html +++ b/httemplate/docs/man/FS/UID.html @@ -31,7 +31,7 @@

    SYNOPSIS

       use FS::UID qw(adminsuidsetup cgisuidsetup dbh datasrc getotaker
    -  checkeuid checkruid swapuid);
    + checkeuid checkruid);
       adminsuidsetup $user;
    @@ -100,10 +100,6 @@ Returns true if effective UID is that of the freeside user.
     
    Returns true if the real UID is that of the freeside user.

    -
    swapuid
    -
    -Swaps real and effective UIDs. -

    getsecrets [ USER ]
    Sets the user to USER, if supplied. @@ -122,7 +118,7 @@ coderef into the hash %FS::UID::callback :


    VERSION

    -

    $Id: UID.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

    +

    $Id: UID.html,v 1.3 2002-01-29 17:42:46 ivan Exp $


    BUGS

    diff --git a/httemplate/docs/man/FS/cust_bill.html b/httemplate/docs/man/FS/cust_bill.html index 2e2ad37fe..8bdb87b56 100644 --- a/httemplate/docs/man/FS/cust_bill.html +++ b/httemplate/docs/man/FS/cust_bill.html @@ -50,6 +50,8 @@
       @cust_pay_objects = $cust_bill->cust_pay;
    +  $tax_amount = $record->tax;
    +
       @lines = $cust_bill->print_text;
       @lines = $cust_bill->print_text $time;

    @@ -72,6 +74,8 @@ following fields are currently supported:

    printed - how many times this invoice has been printed automatically (see collect in the FS::cust_main manpage).
    +
    closed - books closed flag, empty or `Y'
    +


    @@ -117,18 +121,34 @@ Returns the line items (see the FS::cust_bi

    cust_credit
    -Returns a list consisting of the total previous credited (see -the FS::cust_credit manpage) for this customer, followed by the previous outstanding -credits (FS::cust_credit objects). +Depreciated. See the cust_credited method. +
    + #Returns a list consisting of the total previous credited (see
    + #L<FS::cust_credit>) and unapplied for this customer, followed by the previous
    + #outstanding credits (FS::cust_credit objects).

    cust_pay
    -Returns all payments (see the FS::cust_pay manpage) for this invoice. +Depreciated. See the cust_bill_pay method. +

    #Returns all payments (see the FS::cust_pay manpage) for this invoice.

    +

    +
    cust_bill_pay
    +
    +Returns all payment applications (see the FS::cust_bill_pay manpage) for this invoice. +

    +
    cust_credited
    +
    +Returns all applied credits (see the FS::cust_credit_bill manpage) for this invoice. +

    +
    tax
    +
    +Returns the tax amount (see the FS::cust_bill_pkg manpage) for this invoice.

    owed
    Returns the amount owed (still outstanding) on this invoice, which is charged -minus all payments (see the FS::cust_pay manpage). +minus all payment applications (see the FS::cust_bill_pay manpage) and credit +applications (see the FS::cust_credit_bill manpage).

    print_text [TIME];
    @@ -141,7 +161,7 @@ It is specified as a UNIX timestamp; see perlfunc/``time''. Also see


    VERSION

    -

    $Id: cust_bill.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

    +

    $Id: cust_bill.html,v 1.3 2002-01-29 17:42:46 ivan Exp $


    BUGS

    @@ -153,8 +173,9 @@ or something similar so the look can be completely customized?)


    SEE ALSO

    -

    the FS::Record manpage, the FS::cust_main manpage, the FS::cust_pay manpage, the FS::cust_bill_pkg manpage, -the FS::cust_credit manpage, schema.html from the base documentation.

    +

    the FS::Record manpage, the FS::cust_main manpage, the FS::cust_bill_pay manpage, FS:;cust_pay, +the FS::cust_bill_pkg manpage, the FS::cust_bill_credit manpage, schema.html from the base +documentation.

    diff --git a/httemplate/docs/man/FS/cust_credit.html b/httemplate/docs/man/FS/cust_credit.html index 16caca60d..f30241371 100644 --- a/httemplate/docs/man/FS/cust_credit.html +++ b/httemplate/docs/man/FS/cust_credit.html @@ -61,6 +61,8 @@ FS::Record. The following fields are currently supported:

    reason - text
    +
    closed - books closed flag, empty or `Y'
    +


    @@ -92,17 +94,28 @@ methods.

    cust_refund
    -Returns all refunds (see the FS::cust_refund manpage) for this credit. +Depreciated. See the cust_credit_refund method. +

    #Returns all refunds (see the FS::cust_refund manpage) for this credit.

    +

    +
    cust_credit_refund
    +
    +Returns all refund applications (see the FS::cust_credit_refund manpage) for this credit. +

    +
    cust_credit_bill
    +
    +Returns all application to invoices (see the FS::cust_credit_bill manpage) for this +credit.

    credited
    Returns the amount of this credit that is still outstanding; which is -amount minus all refunds (see the FS::cust_refund manpage). +amount minus all refund applications (see the FS::cust_credit_refund manpage) and +applications to invoices (see the FS::cust_credit_bill manpage).


    VERSION

    -

    $Id: cust_credit.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

    +

    $Id: cust_credit.html,v 1.3 2002-01-29 17:42:46 ivan Exp $


    BUGS

    @@ -110,7 +123,8 @@ amount minus all refunds (see the FS::cust_re


    SEE ALSO

    -

    the FS::Record manpage, the FS::cust_refund manpage, the FS::cust_bill manpage, schema.html from the base +

    the FS::Record manpage, the FS::cust_credit_refund manpage, the FS::cust_refund manpage, +the FS::cust_credit_bill manpage the FS::cust_bill manpage, schema.html from the base documentation.

    diff --git a/httemplate/docs/man/FS/cust_main.html b/httemplate/docs/man/FS/cust_main.html index f8e9a8cfb..86e659ad0 100644 --- a/httemplate/docs/man/FS/cust_main.html +++ b/httemplate/docs/man/FS/cust_main.html @@ -15,6 +15,7 @@
  • SYNOPSIS
  • DESCRIPTION
  • METHODS
  • +
  • SUBROUTINES
  • VERSION
  • BUGS
  • SEE ALSO
  • @@ -46,6 +47,8 @@
       @cust_pkg = $record->ncancelled_pkgs;
    +  @cust_pkg = $record->suspended_pkgs;
    +
       $error = $record->bill;
       $error = $record->bill %options;
       $error = $record->bill 'time' => $time;
    @@ -134,6 +137,8 @@ FS::Record. The following fields are currently supported:

    otaker - order taker (assigned automatically, see the FS::UID manpage)
    +
    comments - comments (optional)
    +


    @@ -145,15 +150,15 @@ Creates a new customer. To add the customer to the database, see insert
    +
    insert [ CUST_PKG_HASHREF [ , INVOICING_LIST_ARYREF ] ]
    Adds this customer to the database. If there is an error, returns the error, otherwise returns false. -

    There is a special insert mode in which you pass a data structure to the insert -method containing FS::cust_pkg and FS::svc_tablename objects. When -running under a transactional database, all records are inserted atomicly, or -the transaction is rolled back. There should be a better explanation of this, -but until then, here's an example:

    +

    CUST_PKG_HASHREF: If you pass a Tie::RefHash data structure to the insert +method containing FS::cust_pkg and FS::svc_tablename objects, all records +are inserted atomicly, or the transaction is rolled back. Passing an empty +hash reference is equivalent to not supplying this parameter. There should be +a better explanation of this, but until then, here's an example:

       use Tie::RefHash;
       tie %hash, 'Tie::RefHash'; #this part is important
    @@ -162,6 +167,14 @@ but until then, here's an example:

    ... ); $cust_main->insert( \%hash );
    +

    INVOICING_LIST_ARYREF: If you pass an arrarref to the insert method, it will +be set as the invoicing list (see invoicing_list). Errors return as +expected and rollback the entire transaction; it is not necessary to call +check_invoicing_list first. The invoicing_list is set after the records in the +CUST_PKG_HASHREF above are inserted, so it is now possible to set an +invoicing_list destination to the newly-created svc_acct. Here's an example:

    +
    +  $cust_main->insert( {}, [ $email, 'POST' ] );

    delete NEW_CUSTNUM
    @@ -170,15 +183,23 @@ returns false.

    This will completely remove all traces of the customer record. This is not what you want when a customer cancels service; for that, cancel all of the customer's packages (see cancel in the FS::cust_pkg manpage).

    -

    If the customer has any packages, you need to pass a new (valid) customer -number for those packages to be transferred to.

    +

    If the customer has any uncancelled packages, you need to pass a new (valid) +customer number for those packages to be transferred to. Cancelled packages +will be deleted. Did I mention that this is NOT what you want when a customer +cancels service and that you really should be looking see cancel in the FS::cust_pkg manpage?

    You can't delete a customer with invoices (see the FS::cust_bill manpage), -or credits (see the FS::cust_credit manpage).

    +or credits (see the FS::cust_credit manpage) or payments (see the FS::cust_pay manpage).

    -
    replace OLD_RECORD
    +
    replace OLD_RECORD [ INVOICING_LIST_ARYREF ]
    Replaces the OLD_RECORD with this one in the database. If there is an error, returns the error, otherwise returns false. +

    INVOICING_LIST_ARYREF: If you pass an arrarref to the insert method, it will +be set as the invoicing list (see invoicing_list). Errors return as +expected and rollback the entire transaction; it is not necessary to call +check_invoicing_list first. Here's an example:

    +
    +  $new_cust_main->replace( $old_cust_main, [ $email, 'POST' ] );

    check
    @@ -194,14 +215,49 @@ Returns all packages (see the FS::cust_pkg manpa
    Returns all non-cancelled packages (see the FS::cust_pkg manpage) for this customer.

    +
    suspended_pkgs
    +
    +Returns all suspended packages (see the FS::cust_pkg manpage) for this customer. +

    +
    unflagged_suspended_pkgs
    +
    +Returns all unflagged suspended packages (see the FS::cust_pkg manpage) for this +customer (thouse packages without the `manual_flag' set). +

    +
    unsuspended_pkgs
    +
    +Returns all unsuspended (and uncancelled) packages (see the FS::cust_pkg manpage) for +this customer. +

    +
    unsuspend
    +
    +Unsuspends all unflagged suspended packages (see unflagged_suspended_pkgs +and the FS::cust_pkg manpage) for this customer. Always returns a list: an empty list +on success or a list of errors. +

    +
    suspend
    +
    +Suspends all unsuspended packages (see the FS::cust_pkg manpage) for this customer. +Always returns a list: an empty list on success or a list of errors. +

    +
    cancel
    +
    +Cancels all uncancelled packages (see the FS::cust_pkg manpage) for this customer. +Always returns a list: an empty list on success or a list of errors. +

    bill OPTIONS
    Generates invoices (see the FS::cust_bill manpage) for this customer. Usually used in conjunction with the collect method. +

    Options are passed as name-value pairs.

    The only currently available option is `time', which bills the customer as if it were that time. It is specified as a UNIX timestamp; see perlfunc/``time''). Also see the Time::Local manpage and the Date::Parse manpage for conversion -functions.

    +functions. For example:

    +
    + use Date::Parse;
    + ...
    + $cust_main->bill( 'time' => str2time('April 20th, 2001') );

    If there is an error, returns the error, otherwise returns false.

    collect OPTIONS
    @@ -211,28 +267,66 @@ functions.

    Depending on the value of `payby', this may print an invoice (`BILL'), charge a credit card (`CARD'), or just add any necessary (pseudo-)payment (`COMP').

    If there is an error, returns the error, otherwise returns false.

    +

    Options are passed as name-value pairs.

    Currently available options are:

    invoice_time - Use this time when deciding when to print invoices and late notices on those invoices. The default is now. It is specified as a UNIX timestamp; see perlfunc/``time''). Also see the Time::Local manpage and the Date::Parse manpage for conversion functions.

    -

    batch_card - Set this true to batch cards (see the cust_pay_batch manpage). By +

    batch_card - Set this true to batch cards (see the FS::cust_pay_batch manpage). By default, cards are processed immediately, which will generate an error if CyberCash is not installed.

    report_badcard - Set this true if you want bad card transactions to return an error. By default, they don't.

    +

    force_print - force printing even if invoice has been printed more than once +every 30 days, and don't increment the `printed' field.

    total_owed
    Returns the total owed for this customer on all invoices -(see the FS::cust_bill manpage). +(see owed in the FS::cust_bill manpage). +

    +
    total_owed_date TIME
    +
    +Returns the total owed for this customer on all invoices with date earlier than +TIME. TIME is specified as a UNIX timestamp; see perlfunc/``time''). Also +see the Time::Local manpage and the Date::Parse manpage for conversion functions. +

    +
    apply_credits
    +
    +Applies (see the FS::cust_credit_bill manpage) unapplied credits (see the FS::cust_credit manpage) +to outstanding invoice balances in chronological order and returns the value +of any remaining unapplied credits available for refund +(see the FS::cust_refund manpage). +

    +
    apply_payments
    +
    +Applies (see the FS::cust_bill_pay manpage) unapplied payments (see the FS::cust_pay manpage) +to outstanding invoice balances in chronological order. +
    + #and returns the value of any remaining unapplied payments.

    total_credited
    -Returns the total credits (see the FS::cust_credit manpage) for this customer. +Returns the total outstanding credit (see the FS::cust_credit manpage) for this +customer. See credited in the FS::cust_credit manpage. +

    +
    total_unapplied_payments
    +
    +Returns the total unapplied payments (see the FS::cust_pay manpage) for this customer. +See unapplied in the FS::cust_pay manpage.

    balance
    -Returns the balance for this customer (total owed minus total credited). +Returns the balance for this customer (total_owed minus total_credited +minus total_unapplied_payments). +

    +
    balance_date TIME
    +
    +Returns the balance for this customer, only considering invoices with date +earlier than TIME (total_owed_date minus total_credited minus +total_unapplied_payments). TIME is specified as a UNIX timestamp; see +perlfunc/``time''). Also see the Time::Local manpage and the Date::Parse manpage for conversion +functions.

    invoicing_list [ ARRAYREF ]
    @@ -248,11 +342,58 @@ check it without disturbing anything by passing nothing.

    Checks these arguements as valid input for the invoicing_list method. If there is an error, returns the error, otherwise returns false. +

    +
    default_invoicing_list
    +
    +Sets the invoicing list to all accounts associated with this customer. +

    +
    invoicing_list_addpost
    +
    +Adds postal invoicing to this customer. If this customer is already configured +to receive postal invoices, does nothing. +

    +
    referral_cust_main [ DEPTH [ EXCLUDE_HASHREF ] ]
    +
    +Returns an array of customers referred by this customer (referral_custnum set +to this custnum). If DEPTH is given, recurses up to the given depth, returning +customers referred by customers referred by this customer and so on, inclusive. +The default behavior is DEPTH 1 (no recursion). +

    +
    referral_cust_pkg [ DEPTH ]
    +
    +Like referral_cust_main, except returns a flat list of all unsuspended packages +for each customer. The number of items in this list may be useful for +comission calculations (perhaps after a grep). +

    +
    credit AMOUNT, REASON
    +
    +Applies a credit to this customer. If there is an error, returns the error, +otherwise returns false. +

    +
    charge AMOUNT PKG COMMENT
    +
    +Creates a one-time charge for this customer. If there is an error, returns +the error, otherwise returns false.


    +

    SUBROUTINES

    +
    +
    check_and_rebuild_fuzzyfiles
    +
    +
    rebuild_fuzzyfiles
    +
    +
    all_last
    +
    +
    all_company
    +
    +
    append_fuzzyfiles LASTNAME COMPANY
    +
    +
    +

    +


    VERSION

    -

    $Id: cust_main.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

    +

    $Id: cust_main.html,v 1.2 2002-01-29 16:33:15 ivan Exp $


    BUGS

    @@ -264,7 +405,6 @@ list.

    CyberCash v2 forces us to define some variables in package main.

    There should probably be a configuration file with a list of allowed credit card types.

    -

    CyberCash is the only processor.

    No multiple currency support (probably a larger project than just this module).


    diff --git a/httemplate/docs/man/FS/cust_main_invoice.html b/httemplate/docs/man/FS/cust_main_invoice.html index 6ab7fa289..a7929a943 100644 --- a/httemplate/docs/man/FS/cust_main_invoice.html +++ b/httemplate/docs/man/FS/cust_main_invoice.html @@ -100,7 +100,7 @@ Returns the literal email address for this record (or `POST').


    VERSION

    -

    $Id: cust_main_invoice.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

    +

    $Id: cust_main_invoice.html,v 1.3 2002-01-29 17:42:46 ivan Exp $


    BUGS

    diff --git a/httemplate/docs/man/FS/cust_pay.html b/httemplate/docs/man/FS/cust_pay.html index 803376260..ce057f068 100644 --- a/httemplate/docs/man/FS/cust_pay.html +++ b/httemplate/docs/man/FS/cust_pay.html @@ -50,7 +50,7 @@ currently supported:

    paynum - primary key (assigned automatically for new payments)
    -
    invnum - Invoice (see the FS::cust_bill manpage)
    +
    custnum - customer (see the FS::cust_main manpage)
    paid - Amount of this payment
    @@ -59,10 +59,12 @@ currently supported:

    payby - `CARD' (credit cards), `BILL' (billing), or `COMP' (free)
    -
    payinfo - card number, P.O.#, or comp issuer (4-8 lowercase alphanumerics; think username)
    +
    payinfo - card number, check #, or comp issuer (4-8 lowercase alphanumerics; think username), respectively
    paybatch - text field for tracking card processing
    +
    closed - books closed flag, empty or `Y'
    +


    @@ -74,8 +76,10 @@ Creates a new payment. To add the payment to the databse, see

    insert
    -Adds this payment to the databse, and updates the invoice (see -the FS::cust_bill manpage). +Adds this payment to the database. +

    For backwards-compatibility and convenience, if the additional field invnum +is defined, an FS::cust_bill_pay record for the full amount of the payment +will be created. In this case, custnum is optional.

    delete
    @@ -89,11 +93,21 @@ Currently unimplemented (accounting reasons).
    Checks all fields to make sure this is a valid payment. If there is an error, returns the error, otherwise returns false. Called by the insert method. +

    +
    cust_bill_pay
    +
    +Returns all applications to invoices (see the FS::cust_bill_pay manpage) for this +payment. +

    +
    unapplied
    +
    +Returns the amount of this payment that is still unapplied; which is +paid minus all payment applications (see the FS::cust_bill_pay manpage).


    VERSION

    -

    $Id: cust_pay.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

    +

    $Id: cust_pay.html,v 1.2 2002-01-29 16:33:15 ivan Exp $


    BUGS

    @@ -101,7 +115,8 @@ returns the error, otherwise returns false. Called by the insert method.


    SEE ALSO

    -

    the FS::Record manpage, the FS::cust_bill manpage, schema.html from the base documentation.

    +

    the FS::cust_bill_pay manpage, the FS::cust_bill manpage, the FS::Record manpage, schema.html from the +base documentation.

    diff --git a/httemplate/docs/man/FS/cust_pay_batch.html b/httemplate/docs/man/FS/cust_pay_batch.html index c1c73c301..052ccac39 100644 --- a/httemplate/docs/man/FS/cust_pay_batch.html +++ b/httemplate/docs/man/FS/cust_pay_batch.html @@ -49,7 +49,7 @@ batched (sent to a processor). FS::cust_pay_batch inherits from FS::Record. Typically called by the collect method of an FS::cust_main object. The following fields are currently supported:

    -
    trancode - 77 for charges
    +
    paybatchnum - primary key (automatically assigned)
    cardnum
    @@ -116,7 +116,7 @@ and repalce methods.


    VERSION

    -

    $Id: cust_pay_batch.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

    +

    $Id: cust_pay_batch.html,v 1.3 2002-01-29 17:42:46 ivan Exp $


    BUGS

    diff --git a/httemplate/docs/man/FS/cust_pkg.html b/httemplate/docs/man/FS/cust_pkg.html index 459d1297c..9f1005da7 100644 --- a/httemplate/docs/man/FS/cust_pkg.html +++ b/httemplate/docs/man/FS/cust_pkg.html @@ -53,6 +53,8 @@
       @labels = $record->labels;
    +  $seconds = $record->seconds_since($timestamp);
    +
       $error = FS::cust_pkg::order( $custnum, \@pkgparts );
       $error = FS::cust_pkg::order( $custnum, \@pkgparts, \@remove_pkgnums ] );

    @@ -79,6 +81,9 @@ inherits from FS::Record. The following fields are currently supported:

    otaker - order taker (assigned automatically if null, see the FS::UID manpage)
    +
    manual_flag - If this field is set to 1, disables the automatic +unsuspension of this package when using the unsuspendauto config file.
    +

    Note: setup, bill, susp, expire and cancel are specified as UNIX timestamps; see perlfunc/``time''. Also see the Time::Local manpage and the Date::Parse manpage for @@ -95,26 +100,12 @@ Create a new billing item. To add the item to the database, see delete

    -Currently unimplemented. You don't want to delete billing items, because there -would then be no record the customer ever purchased the item. Instead, see -the cancel method. +This method now works but you probably shouldn't use it. +

    You don't want to delete billing items, because there would then be no record +the customer ever purchased the item. Instead, see the cancel method.

    replace OLD_RECORD
    @@ -158,16 +149,32 @@ package, then unsuspends the package itself (clears the susp field). Returns the definition for this billing item, as an FS::part_pkg object (see the FS::part_pkg manpage).

    +
    cust_svc
    +
    +Returns the services for this package, as FS::cust_svc objects (see +the FS::cust_svc manpage) +

    labels
    Returns a list of lists, calling the label method for all services (see the FS::cust_svc manpage) of this billing item. +

    +
    cust_main
    +
    +Returns the parent customer object (see the FS::cust_main manpage). +

    +
    seconds_since TIMESTAMP
    +
    +Returns the number of seconds all accounts (see the FS::svc_acct manpage) in this +package have been online since TIMESTAMP. +

    TIMESTAMP is specified as a UNIX timestamp; see perlfunc/``time''. Also see +the Time::Local manpage and the Date::Parse manpage for conversion functions.


    SUBROUTINES

    -
    order CUSTNUM, PKGPARTS_ARYREF, [ REMOVE_PKGNUMS_ARYREF ]
    +
    order CUSTNUM, PKGPARTS_ARYREF, [ REMOVE_PKGNUMS_ARYREF [ RETURN_CUST_PKG_ARRAYREF ] ]
    CUSTNUM is a customer (see the FS::cust_main manpage)

    PKGPARTS is a list of pkgparts specifying the the billing item definitions (see @@ -176,12 +183,15 @@ permitted.

    REMOVE_PKGNUMS is an optional list of pkgnums specifying the billing items to remove for this customer. The services (see the FS::cust_svc manpage) are moved to the new billing items. An error is returned if this is not possible (see -the FS::pkg_svc manpage).

    +the FS::pkg_svc manpage). An empty arrayref is equivalent to not specifying this +parameter.

    +

    RETURN_CUST_PKG_ARRAYREF, if specified, will be filled in with the +newly-created cust_pkg objects.


    VERSION

    -

    $Id: cust_pkg.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

    +

    $Id: cust_pkg.html,v 1.2 2002-01-29 16:33:15 ivan Exp $


    BUGS

    @@ -194,11 +204,13 @@ compile time, rather than via 'require' in sub { setup, suspend, unsuspend, cancel } because they use %FS::UID::callback to load configuration values. Probably need a subroutine which decides what to do based on whether or not we've fetched the user yet, rather than a hash. See FS::UID and the TODO.

    +

    Now that things are transactional should the check in the insert method be +moved to check ?


    SEE ALSO

    -

    the FS::Record manpage, the FS::cust_main manpage, the FS::part_pkg manpage, the FS::cust_svc manpage -, the FS::pkg_svc manpage, schema.html from the base documentation

    +

    the FS::Record manpage, the FS::cust_main manpage, the FS::part_pkg manpage, the FS::cust_svc manpage, +the FS::pkg_svc manpage, schema.html from the base documentation

    diff --git a/httemplate/docs/man/FS/cust_refund.html b/httemplate/docs/man/FS/cust_refund.html index 39ed14de4..93bb07b2d 100644 --- a/httemplate/docs/man/FS/cust_refund.html +++ b/httemplate/docs/man/FS/cust_refund.html @@ -50,7 +50,7 @@ inherits from FS::Record. The following fields are currently supported:

    refundnum - primary key (assigned automatically for new refunds)
    -
    crednum - Credit (see the FS::cust_credit manpage)
    +
    custnum - customer (see the FS::cust_main manpage)
    refund - Amount of the refund
    @@ -61,8 +61,12 @@ inherits from FS::Record. The following fields are currently supported:

    payinfo - card number, P.O.#, or comp issuer (4-8 lowercase alphanumerics; think username)
    +
    paybatch - text field for tracking card processing
    +
    otaker - order taker (assigned automatically, see the FS::UID manpage)
    +
    closed - books closed flag, empty or `Y'
    +


    @@ -74,8 +78,10 @@ Creates a new refund. To add the refund to the database, see

    insert
    -Adds this refund to the database, and updates the credit (see -the FS::cust_credit manpage). +Adds this refund to the database. +

    For backwards-compatibility and convenience, if the additional field crednum is +defined, an FS::cust_credit_refund record for the full amount of the refund +will be created. In this case, custnum is optional.

    delete
    @@ -93,7 +99,7 @@ returns the error, otherwise returns false. Called by the insert method.


    VERSION

    -

    $Id: cust_refund.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

    +

    $Id: cust_refund.html,v 1.3 2002-01-29 17:42:46 ivan Exp $


    BUGS

    diff --git a/httemplate/docs/man/FS/cust_svc.html b/httemplate/docs/man/FS/cust_svc.html index c1ca2d700..97a299c52 100644 --- a/httemplate/docs/man/FS/cust_svc.html +++ b/httemplate/docs/man/FS/cust_svc.html @@ -64,7 +64,7 @@ The following fields are currently supported:

    Creates a new service. To add the refund to the database, see insert. Services are normally created by creating FS::svc_ objects (see -the FS::svc_acct manpage, the FS::svc_domain manpage, and the FS::svc_acct_sm manpage, among others). +the FS::svc_acct manpage, the FS::svc_domain manpage, and the FS::svc_forward manpage, among others).

    insert
    @@ -88,17 +88,38 @@ Checks all fields to make sure this is a valid service. If there is an error, returns the error, otehrwise returns false. Called by the insert and replace methods.

    +
    part_svc
    +
    +Returns the definition for this service, as a FS::part_svc object (see +the FS::part_svc manpage). +

    +
    cust_pkg
    +
    +Returns the definition for this service, as a FS::part_svc object (see +the FS::part_svc manpage). +

    label
    Returns a list consisting of: - The name of this service (from part_svc) - A meaningful identifier (username, domain, or mail alias) - The table name (i.e. svc_domain) for this service +

    +
    svc_x
    +
    +Returns the FS::svc_XXX object for this service (i.e. an FS::svc_acct object or +FS::svc_domain object, etc.) +

    +
    seconds_since TIMESTAMP
    +
    +See seconds_since in the FS::svc_acct manpage. Equivalent to +$cust_svc->svc_x->seconds_since, but more efficient. Meaningless for records +where svcdb is not ``svc_acct''.


    VERSION

    -

    $Id: cust_svc.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

    +

    $Id: cust_svc.html,v 1.2 2002-01-29 16:33:16 ivan Exp $


    BUGS

    diff --git a/httemplate/docs/man/FS/domain_record.html b/httemplate/docs/man/FS/domain_record.html index 7a1bf3e32..0349f7b78 100644 --- a/httemplate/docs/man/FS/domain_record.html +++ b/httemplate/docs/man/FS/domain_record.html @@ -18,7 +18,6 @@
  • VERSION
  • BUGS
  • SEE ALSO
  • -
  • HISTORY
  • @@ -95,7 +94,7 @@ and replace methods.


    VERSION

    -

    $Id: domain_record.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

    +

    $Id: domain_record.html,v 1.3 2002-01-29 17:42:46 ivan Exp $


    BUGS

    @@ -107,17 +106,6 @@ course, it's still better than editing the zone files directly. :)


    SEE ALSO

    the FS::Record manpage, schema.html from the base documentation.

    -

    -


    -

    HISTORY

    -

    $Log: domain_record.html,v $ -

    Revision 1.1 2001-07-30 07:36:03 ivan -

    templates!!! -

    -Revision 1.2 2001/05/18 14:08:55 ivan -tyop

    -

    Revision 1.1 2000/02/03 05:16:52 ivan -beginning of DNS and Apache support

    diff --git a/httemplate/docs/man/FS/part_pkg.html b/httemplate/docs/man/FS/part_pkg.html index 9aeaa3d3d..e1e96b54c 100644 --- a/httemplate/docs/man/FS/part_pkg.html +++ b/httemplate/docs/man/FS/part_pkg.html @@ -60,11 +60,21 @@ inherits from FS::Record. The following fields are currently supported:

    comment - Text name of this billing item definition (non-customer-viewable)
    -
    setup - Setup fee
    +
    setup - Setup fee expression
    freq - Frequency of recurring fee
    -
    recur - Recurring fee
    +
    recur - Recurring fee expression
    +
    +
    setuptax - Setup fee tax exempt flag, empty or `Y'
    +
    +
    recurtax - Recurring fee tax exempt flag, empty or `Y'
    +
    +
    plan - Price plan
    +
    +
    plandata - Price plan data
    +
    +
    disabled - Disabled flag, empty or `Y'

    setup and recur are evaluated as Safe perl expressions. You can use numbers @@ -120,7 +130,7 @@ SVCDB is specified and does not match the svcdb of the service definition,


    VERSION

    -

    $Id: part_pkg.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

    +

    $Id: part_pkg.html,v 1.3 2002-01-29 17:42:46 ivan Exp $


    BUGS

    diff --git a/httemplate/docs/man/FS/part_svc.html b/httemplate/docs/man/FS/part_svc.html index ca0a5dc71..0f5126f81 100644 --- a/httemplate/docs/man/FS/part_svc.html +++ b/httemplate/docs/man/FS/part_svc.html @@ -31,8 +31,8 @@
       use FS::part_svc;
    -  $record = new FS::part_referral \%hash
    -  $record = new FS::part_referral { 'column' => 'value' };
    + $record = new FS::part_svc \%hash + $record = new FS::part_svc { 'column' => 'value' };
       $error = $record->insert;
    @@ -52,11 +52,9 @@ FS::Record.  The following fields are currently supported:

    svc - text name of this service definition
    svcdb - table used for this service. See the FS::svc_acct manpage, -the FS::svc_domain manpage, and the FS::svc_acct_sm manpage, among others.
    +the FS::svc_domain manpage, and the FS::svc_forward manpage, among others.
    -
    svcdb__field - Default or fixed value for field in svcdb.
    -
    -
    svcdb__field_flag - defines svcdb__field action: null, `D' for default, or `F' for fixed
    +
    disabled - Disabled flag, empty or `Y'

    @@ -73,6 +71,10 @@ database, see insert. Adds this service definition to the database. If there is an error, returns the error, otherwise returns false.

    +
    svcdb__field - Default or fixed value for field in svcdb.
    +
    +
    svcdb__field_flag - defines svcdb__field action: null, `D' for default, or `F' for fixed
    +
    delete
    Currently unimplemented. @@ -87,11 +89,19 @@ returns the error, otherwise returns false. Checks all fields to make sure this is a valid service definition. If there is an error, returns the error, otherwise returns false. Called by the insert and replace methods. -

    +

    +
    part_svc_column COLUMNNAME
    +
    +Returns the part_svc_column object (see the FS::part_svc_column manpage) for the given +COLUMNNAME, or a new part_svc_column object if none exists. +

    +
    all_part_svc_column
    +
    +


    VERSION

    -

    $Id: part_svc.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

    +

    $Id: part_svc.html,v 1.3 2002-01-29 17:42:46 ivan Exp $


    BUGS

    @@ -101,9 +111,9 @@ should be fixed.


    SEE ALSO

    -

    the FS::Record manpage, the FS::part_pkg manpage, the FS::pkg_svc manpage, the FS::cust_svc manpage, -the FS::svc_acct manpage, the FS::svc_acct_sm manpage, the FS::svc_domain manpage, schema.html from the -base documentation.

    +

    the FS::Record manpage, the FS::part_svc_column manpage, the FS::part_pkg manpage, the FS::pkg_svc manpage, +the FS::cust_svc manpage, the FS::svc_acct manpage, the FS::svc_forward manpage, the FS::svc_domain manpage, +schema.html from the base documentation.

    diff --git a/httemplate/docs/man/FS/prepay_credit.html b/httemplate/docs/man/FS/prepay_credit.html index 4e77897a3..bb0c281c2 100644 --- a/httemplate/docs/man/FS/prepay_credit.html +++ b/httemplate/docs/man/FS/prepay_credit.html @@ -18,7 +18,6 @@
  • VERSION
  • BUGS
  • SEE ALSO
  • -
  • HISTORY
  • @@ -93,7 +92,7 @@ and replace methods.


    VERSION

    -

    $Id: prepay_credit.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

    +

    $Id: prepay_credit.html,v 1.3 2002-01-29 17:42:46 ivan Exp $


    BUGS

    @@ -101,17 +100,6 @@ and replace methods.

    SEE ALSO

    the FS::Record manpage, schema.html from the base documentation.

    -

    -


    -

    HISTORY

    -

    $Log: prepay_credit.html,v $ -

    Revision 1.1 2001-07-30 07:36:03 ivan -

    templates!!! -

    -Revision 1.2 2000/02/02 20:22:18 ivan -bugfix prepayment in signup server

    -

    Revision 1.1 2000/01/31 05:22:23 ivan -prepaid ``internet cards''

    diff --git a/httemplate/docs/man/FS/svc_Common.html b/httemplate/docs/man/FS/svc_Common.html index 100aee880..ccac5efa0 100644 --- a/httemplate/docs/man/FS/svc_Common.html +++ b/httemplate/docs/man/FS/svc_Common.html @@ -64,6 +64,11 @@ Sets all fields to their defaults (see the FS::p current values. If there is an error, returns the error, otherwise returns the FS::part_svc object (use ref() to test the return).

    +
    cust_svc
    +
    +Returns the cust_svc record associated with this svc_ record, as a FS::cust_svc +object (see the FS::cust_svc manpage). +

    suspend
    unsuspend
    @@ -76,13 +81,11 @@ methods. Called by the cancel method of FS::cust_pkg (see VERSION -

    $Id: svc_Common.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

    +

    $Id: svc_Common.html,v 1.3 2002-01-29 17:42:46 ivan Exp $


    BUGS

    The setfixed method return value.

    -

    The new method should set defaults from part_svc (like the check method -sets fixed values)?


    SEE ALSO

    diff --git a/httemplate/docs/man/FS/svc_acct.html b/httemplate/docs/man/FS/svc_acct.html index 81bc118df..9c41db3f0 100644 --- a/httemplate/docs/man/FS/svc_acct.html +++ b/httemplate/docs/man/FS/svc_acct.html @@ -49,6 +49,18 @@ $error = $record->cancel;
       %hash = $record->radius;
    +
    +  %hash = $record->radius_reply;
    +
    +  %hash = $record->radius_check;
    +
    +  $domain = $record->domain;
    +
    +  $svc_domain = $record->svc_domain;
    +
    +  $email = $record->email;
    +
    +  $seconds_since = $record->seconds_since($timestamp);


    DESCRIPTION

    @@ -77,8 +89,14 @@ FS::svc_Common. The following fields are currently supported:

    slipip - IP address
    +
    seconds -
    +
    +
    domsvc - svcnum from svc_domain
    +
    radius_Radius_Attribute - Radius-Attribute
    +
    domsvc - service number of svc_domain with which to associate
    +


    @@ -96,7 +114,8 @@ otherwise returns false. defined. An FS::cust_svc record will be created and inserted.

    If the configuration value (see the FS::Conf manpage) shellmachine exists, and the username, uid, and dir fields are defined, the command(s) specified in -the shellmachine-useradd configuration are exectued on shellmachine via ssh. +the shellmachine-useradd configuration are added to the job queue (see +the FS::queue manpage and the freeside-queued manpage) to be exectued on shellmachine via ssh. This behaviour can be surpressed by setting $FS::svc_acct::nossh_hack true. If the shellmachine-useradd configuration file does not exist,

    @@ -108,6 +127,7 @@ it empty,

    is the default instead. Otherwise the contents of the file are treated as a double-quoted perl string, with the following variables available: $username, $uid, $gid, $dir, and $shell.

    +

    (TODOC: cyrus config file, the FS::queue manpage and the freeside-queued manpage)

    delete
    @@ -116,7 +136,8 @@ error, otherwise returns false.

    The corresponding FS::cust_svc record will be deleted as well.

    If the configuration value (see the FS::Conf manpage) shellmachine exists, the command(s) specified in the shellmachine-userdel configuration file are -executed on shellmachine via ssh. This behavior can be surpressed by setting +added to the job queue (see the FS::queue manpage and the freeside-queued manpage) to be executed +on shellmachine via ssh. This behavior can be surpressed by setting $FS::svc_acct::nossh_hack true. If the shellmachine-userdel configuration file does not exist,

    @@ -128,6 +149,7 @@ is empty,

    is the default instead. Otherwise the contents of the file are treated as a double-quoted perl string, with the following variables available: $username and $dir.

    +

    (TODOC: cyrus config file)

    replace OLD_RECORD
    @@ -135,9 +157,10 @@ Replaces OLD_RECORD with this one in the database. If there is an error, returns the error, otherwise returns false.

    If the configuration value (see the FS::Conf manpage) shellmachine exists, and the dir field has changed, the command(s) specified in the shellmachine-usermod -configuraiton file are executed on shellmachine via ssh. This behavior can +configuraiton file are added to the job queue (see the FS::queue manpage and +the freeside-queued manpage) to be executed on shellmachine via ssh. This behavior can be surpressed by setting $FS::svc-acct::nossh_hack true. If the -shellmachine-userdel configuration file does not exist or is empty, :

    +shellmachine-userdel configuration file does not exist or is empty,

       [ -d $old_dir ] && mv $old_dir $new_dir || (
         chmod u+t $old_dir;
    @@ -148,8 +171,8 @@ shellmachine-userdel configuration file does not exist or is empty, :

    chown -R $uid.$gid $new_dir; rm -rf $old_dir )
    -

    is executed on shellmachine via ssh. This behaviour can be surpressed by -setting $FS::svc_acct::nossh_hack true.

    +

    is the default. This behaviour can be surpressed by setting +$FS::svc_acct::nossh_hack true.

    suspend
    @@ -193,11 +216,42 @@ Returns key/value pairs, suitable for assigning to a hash, for any RADIUS check attributes of this record.

    Accessing RADIUS attributes directly is not supported and will break in the future.

    -

    +

    +
    domain
    +
    +Returns the domain associated with this account. +

    +
    svc_domain
    +
    +Returns the FS::svc_domain record for this account's domain (see +the FS::svc_domain manpage. +

    +
    cust_svc
    +
    +Returns the FS::cust_svc record for this account (see the FS::cust_svc manpage). +

    sub cust_svc { + my $self = shift; + qsearchs( 'cust_svc', { 'svcnum' => $self->svcnum } ); +}

    +

    +
    email
    +
    +Returns an email address associated with the account. +

    +
    seconds_since TIMESTAMP
    +
    +Returns the number of seconds this account has been online since TIMESTAMP. +See the FS::session manpage +

    TIMESTAMP is specified as a UNIX timestamp; see perlfunc/``time''. Also see +the Time::Local manpage and the Date::Parse manpage for conversion functions.

    +

    +
    ssh
    +
    +


    VERSION

    -

    $Id: svc_acct.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

    +

    $Id: svc_acct.html,v 1.2 2002-01-29 16:33:16 ivan Exp $


    BUGS

    @@ -210,8 +264,10 @@ counterintuitive.


    SEE ALSO

    -

    the FS::svc_Common manpage, the FS::Record manpage, the FS::Conf manpage, the FS::cust_svc manpage, -the FS::part_svc manpage, the FS::cust_pkg manpage, the Net::SSH manpage, ssh, the FS::svc_acct_pop manpage, +

    the FS::svc_Common manpage, edit/part_svc.cgi from an installed web interface, +export.html from the base documentation, the FS::Record manpage, the FS::Conf manpage, +the FS::cust_svc manpage, the FS::part_svc manpage, the FS::cust_pkg manpage, the FS::queue manpage, +the freeside-queued manpage), the Net::SSH manpage, ssh, the FS::svc_acct_pop manpage, schema.html from the base documentation.

    diff --git a/httemplate/docs/man/FS/svc_acct_pop.html b/httemplate/docs/man/FS/svc_acct_pop.html index d65ca5778..80900627e 100644 --- a/httemplate/docs/man/FS/svc_acct_pop.html +++ b/httemplate/docs/man/FS/svc_acct_pop.html @@ -15,6 +15,7 @@
  • SYNOPSIS
  • DESCRIPTION
  • METHODS
  • +
  • SUBROUTINES
  • VERSION
  • BUGS
  • SEE ALSO
  • @@ -41,6 +42,8 @@ $error = $record->delete;
       $error = $record->check;
    +
    +  $html = FS::svc_acct_pop::popselector( $popnum, $state );


    DESCRIPTION

    @@ -88,19 +91,34 @@ returns the error, otherwise returns false. Checks all fields to make sure this is a valid point of presence. If there is an error, returns the error, otherwise returns false. Called by the insert and replace methods. +

    +
    text
    +
    +Returns: +

    ``$city, $state ($ac)/$exch''


    +

    SUBROUTINES

    +
    +
    popselector [ POPNUM [ STATE ] ]
    +
    +
    +

    +


    VERSION

    -

    $Id: svc_acct_pop.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

    +

    $Id: svc_acct_pop.html,v 1.3 2002-01-29 17:42:46 ivan Exp $


    BUGS

    It should be renamed to part_pop.

    +

    popselector? putting web ui components in here? they should probably live +somewhere else...


    SEE ALSO

    -

    the FS::Record manpage, the svc_acct manpage, schema.html from the base documentation.

    +

    the FS::Record manpage, the FS::svc_acct manpage, the FS::part_pop_local manpage, schema.html from the +base documentation.

    diff --git a/httemplate/docs/man/FS/svc_acct_sm.html b/httemplate/docs/man/FS/svc_acct_sm.html index ca50e7202..86c7b8b3b 100644 --- a/httemplate/docs/man/FS/svc_acct_sm.html +++ b/httemplate/docs/man/FS/svc_acct_sm.html @@ -13,6 +13,7 @@
  • NAME
  • SYNOPSIS
  • +
  • WARNING
  • DESCRIPTION
  • METHODS
  • VERSION
  • @@ -49,9 +50,14 @@ $error = $record->cancel;


    +

    WARNING

    +

    FS::svc_acct_sm is depreciated. This class is only included for migration +purposes. See the FS::svc_forward manpage.

    +

    +


    DESCRIPTION

    -

    An FS::svc_acct object represents a virtual mail alias. FS::svc_acct inherits -from FS::Record. The following fields are currently supported:

    +

    An FS::svc_acct_sm object represents a virtual mail alias. FS::svc_acct_sm +inherits from FS::Record. The following fields are currently supported:

    svcnum - primary key (assigned automatcially for new accounts)
    @@ -77,15 +83,17 @@ Adds this virtual mail alias to the database. If there is an error, returns the error, otherwise returns false.

    The additional fields pkgnum and svcpart (see the FS::cust_svc manpage) should be defined. An FS::cust_svc record will be created and inserted.

    -

    If the configuration values (see the FS::Conf manpage) shellmachine and qmailmachines -exist, and domuser is `*' (meaning a catch-all mailbox), the command:

    -  [ -e $dir/.qmail-$qdomain-default ] || {
    -    touch $dir/.qmail-$qdomain-default;
    -    chown $uid:$gid $dir/.qmail-$qdomain-default;
    -  }
    -

    is executed on shellmachine via ssh (see dot-qmail/``EXTENSION ADDRESSES''). -This behaviour can be surpressed by setting $FS::svc_acct_sm::nossh_hack true.

    + #If the configuration values (see L<FS::Conf>) shellmachine and qmailmachines + #exist, and domuser is `*' (meaning a catch-all mailbox), the command: + # + # [ -e $dir/.qmail-$qdomain-default ] || { + # touch $dir/.qmail-$qdomain-default; + # chown $uid:$gid $dir/.qmail-$qdomain-default; + # } + # + #is executed on shellmachine via ssh (see L<dot-qmail/"EXTENSION ADDRESSES">). + #This behaviour can be surpressed by setting $FS::svc_acct_sm::nossh_hack true.

    delete
    @@ -123,7 +131,7 @@ replace methods.


    VERSION

    -

    $Id: svc_acct_sm.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

    +

    $Id: svc_acct_sm.html,v 1.3 2002-01-29 17:42:46 ivan Exp $


    BUGS

    @@ -132,6 +140,7 @@ replace methods.


    SEE ALSO

    +

    the FS::svc_forward manpage

    the FS::Record manpage, the FS::Conf manpage, the FS::cust_svc manpage, the FS::part_svc manpage, the FS::cust_pkg manpage, the FS::svc_acct manpage, the FS::svc_domain manpage, the Net::SSH manpage, ssh, dot-qmail, schema.html from the base documentation.

    diff --git a/httemplate/docs/man/FS/svc_domain.html b/httemplate/docs/man/FS/svc_domain.html index ace3de154..266e0b355 100644 --- a/httemplate/docs/man/FS/svc_domain.html +++ b/httemplate/docs/man/FS/svc_domain.html @@ -57,6 +57,8 @@ FS::svc_Common. The following fields are currently supported:

    domain
    +
    catchall - optional svcnum of an svc_acct record, designating an email catchall account.
    +


    @@ -86,9 +88,18 @@ the domain_record table (see <FS::domain_record>).

    records are added to the domain_record table (see the FS::domain_record manpage).

    If any machines are defined in the mxmachines configuration file, MX records are added to the domain_record table (see the FS::domain_record manpage).

    -

    Any problems adding FS::domain_record records will emit warnings, but will -not return errors from this method. If your configuration files are correct -you shouln't have any problems.

    +

    If a machine is defined in the shellmachine configuration value, the +qmailmachines configuration file exists, and the catchall field points +to an an account with a home directory (see the FS::svc_acct manpage), the command:

    +
    +  [ -e $dir/.qmail-$qdomain-defualt ] || {
    +    touch $dir/.qmail-$qdomain-default;
    +    chown $uid:$gid $dir/.qmail-$qdomain-default;
    +  }
    +

    is executed on shellmachine via ssh (see dot-qmail/``EXTENSION ADDRESSES''). +This behaviour can be supressed by setting $FS::svc_domain::nossh_hack true.

    +

    a machine is defined +in the

    delete
    @@ -140,7 +151,7 @@ Submits a registration email for this domain.


    VERSION

    -

    $Id: svc_domain.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

    +

    $Id: svc_domain.html,v 1.3 2002-01-29 17:42:46 ivan Exp $


    BUGS

    diff --git a/httemplate/docs/man/FS/svc_www.html b/httemplate/docs/man/FS/svc_www.html index e72b219be..0e7f4f197 100644 --- a/httemplate/docs/man/FS/svc_www.html +++ b/httemplate/docs/man/FS/svc_www.html @@ -18,7 +18,6 @@
  • VERSION
  • BUGS
  • SEE ALSO
  • -
  • HISTORY
  • @@ -120,7 +119,7 @@ and repalce methods.


    VERSION

    -

    $Id: svc_www.html,v 1.1 2001-07-30 07:36:03 ivan Exp $

    +

    $Id: svc_www.html,v 1.3 2002-01-29 17:42:46 ivan Exp $


    BUGS

    @@ -129,21 +128,6 @@ and repalce methods.

    SEE ALSO

    the FS::svc_Common manpage, the FS::Record manpage, the FS::domain_record manpage, the FS::cust_svc manpage, the FS::part_svc manpage, the FS::cust_pkg manpage, schema.html from the base documentation.

    -

    -


    -

    HISTORY

    -

    $Log: svc_www.html,v $ -

    Revision 1.1 2001-07-30 07:36:03 ivan -

    templates!!! -

    -Revision 1.4 2001/04/22 01:56:15 ivan -get rid of FS::SSH.pm (became Net::SSH and Net::SCP on CPAN)

    -

    Revision 1.3 2000/11/22 23:30:51 ivan -tyop

    -

    Revision 1.2 2000/03/01 08:13:59 ivan -compilation bugfixes

    -

    Revision 1.1 2000/02/03 05:16:52 ivan -beginning of DNS and Apache support

    diff --git a/httemplate/edit/part_bill_event.cgi b/httemplate/edit/part_bill_event.cgi new file mode 100755 index 000000000..41d6666dc --- /dev/null +++ b/httemplate/edit/part_bill_event.cgi @@ -0,0 +1,131 @@ + + +<% + +if ( $cgi->param('eventnum') && $cgi->param('eventnum') =~ /^(\d+)$/ ) { + $cgi->param('eventnum', $1); +} else { + $cgi->param('eventnum', ''); +} + +my ($query) = $cgi->keywords; +my $action = ''; +my $part_bill_event = ''; +if ( $cgi->param('error') ) { + $part_bill_event = new FS::part_bill_event ( { + map { $_, scalar($cgi->param($_)) } fields('part_bill_event') + } ); +} +if ( $query && $query =~ /^(\d+)$/ ) { + $part_bill_event ||= qsearchs('part_bill_event',{'eventpart'=>$1}); +} else { + $part_bill_event ||= new FS::part_bill_event {}; +} +$action ||= $part_bill_event->pkgpart ? 'Edit' : 'Add'; +my $hashref = $part_bill_event->hashref; + +print header("$action Invoice Event Definition", menubar( + 'Main Menu' => popurl(2), + 'View all invoice events' => popurl(2). 'browse/part_bill_event.cgi', +)); + +print qq!Error: !, $cgi->param('error'), + "" + if $cgi->param('error'); + +print '
    '; + +print "Invoice Event #", $hashref->{eventpart} ? $hashref->{eventpart} : "(NEW)"; + +print ntable("#cccccc",2), <Payby +After days +END + +print 'Disabled'; +print '{disabled} eq "Y"; +print '>'; +print ''; + +print 'Action'; + +#print ntable(); + +#this is pretty kludgy right here. +tie my %events, 'Tie::IxHash', + + 'Charge a fee' => { + 'code' => '$cust_main->charge( %%%charge%%%, \'%%%reason%%%\' );', + 'html' => 'Amount
    '. + 'Reason ', + }, + 'Suspend accounts' => { + 'code' => '$cust_main->suspend();', + }, + 'Cancel accounts' => { + 'code' => '$cust_main->cancel();', + }, + + 'Add postal invoicing' => { + 'code' => '$cust_main->invoicing_list_addpost();', + 'pad' => 10, + }, + + 'Generate invoices' => { + 'code' => '$cust_main->bill();', + 'pad' => 20, + }, + + 'Apply unapplied payments and credits' => { + 'code' => '$cust_main->apply_payments; $cust_main->apply_credits;', + 'pad' => 30, + }, + + 'Collect on invoices' => { + 'code' => '$cust_main->collect();', + 'pad' => 40, + }, + +; + +foreach my $event ( keys %events ) { + print ntable( "#cccccc", 2). qq!$event!; + print ''. $events{$event}{html}. '' if exists $events{$event}{html}; + print qq!!; + print ''; +} + +#print ''; + +print < + +END + +print qq!!; +%> + + + + + diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index 735f4f269..ea3f62aa2 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -1,4 +1,4 @@ - + <% @@ -158,8 +158,8 @@ unless ( $cgi->param('clone') ) { } # prolly should be in database -my %plans = ( - +use Tie::IxHash; +tie my %plans, 'Tie::IxHash', 'flat' => { 'name' => 'Flat rate', 'fields' => { @@ -170,6 +170,7 @@ my %plans = ( 'default' => 0, }, }, + 'fieldorder' => [ 'setup_fee', 'recur_fee' ], 'setup' => 'what.setup_fee.value', 'recur' => 'what.recur_fee.value', }, @@ -190,11 +191,55 @@ my %plans = ( 'default' => 1, }, }, + 'fieldorder' => [ 'setup_fee', 'recur_fee', 'comission_depth', 'comission_amount' ], 'setup' => 'what.setup_fee.value', 'recur' => '\'my $error = $cust_pkg->cust_main->credit( \' + what.comission_amount.value + \' * scalar($cust_pkg->cust_main->referral_cust_pkg(\' + what.comission_depth.value+ \')), "commission" ); die $error if $error; \' + what.recur_fee.value + \';\'', }, -); + 'sesmon_hour' => { + 'name' => 'Base charge plus charge per-hour from the session monitor', + 'fields' => { + 'setup_fee' => { 'name' => 'Setup fee for this package', + 'default' => 0, + }, + 'recur_flat' => { 'name' => 'Base monthly charge for this package', + 'default' => 0, + }, + 'recur_included_hours' => { 'name' => 'Hours included', + 'default' => 0, + }, + 'recur_hourly_charge' => { 'name' => 'Additional charge per hour', + 'default' => 0, + }, + }, + 'fieldorder' => [ 'setup_fee', 'recur_flat', 'recur_included_hours', 'recur_hourly_charge' ], + 'setup' => 'what.setup_fee.value', + 'recur' => '\'my $hours = $cust_pkg->seconds_since($cust_bkg->bill || 0) / 3600 - \' + what.recur_included_hours.value + \'; $hours = 0 if $hours < 0; \' + what.recur_flat.value + \' + \' + what.recur_hourly_charge.value + \' * $hours;\'', + }, + + 'sesmon_minute' => { + 'name' => 'Base charge plus charge per-minute from the session monitor', + 'fields' => { + 'setup_fee' => { 'name' => 'Setup fee for this package', + 'default' => 0, + }, + 'recur_flat' => { 'name' => 'Base monthly charge for this package', + 'default' => 0, + }, + 'recur_included_min' => { 'name' => 'Minutes included', + 'default' => 0, + }, + 'recur_minly_charge' => { 'name' => 'Additional charge per minute', + 'default' => 0, + }, + }, + 'fieldorder' => [ 'setup_fee', 'recur_flat', 'recur_included_min', 'recur_minly_charge' ], + 'setup' => 'what.setup_fee.value', + 'recur' => '\'my $min = $cust_pkg->seconds_since($cust_bkg->bill || 0) / 60 - \' + what.recur_included_min.value + \'; $min = 0 if $min < 0; \' + what.recur_flat.value + \' + \' + what.recur_minly_charge.value + \' * $min;\'', + + }, + +; %> @@ -295,24 +340,30 @@ if ( $cgi->param('pkgnum') ) { <%= ntable("#cccccc",2) %> <% my $href = $plans{$layer}->{'fields'}; - foreach my $field ( keys %{ $href } ) { %> + foreach my $field ( exists($plans{$layer}->{'fieldorder'}) + ? @{$plans{$layer}->{'fieldorder'}} + : keys %{ $href } + ) { +%> <%= $href->{$field}{'name'} %> <% } %> -

    -Setup expression

    -Recurring espression

    -
    <% -print qq!
    !; %> +

    don't edit this unless you know what you're doing <%= ntable("#cccccc",2) %> +Setup expression

    +Recurring espression
    + + +