- web interface for hourly account charges!
authorivan <ivan>
Tue, 29 Jan 2002 16:33:16 +0000 (16:33 +0000)
committerivan <ivan>
Tue, 29 Jan 2002 16:33:16 +0000 (16:33 +0000)
  (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

43 files changed:
FS/FS.pm
FS/FS/Record.pm
FS/FS/cust_main.pm
FS/FS/cust_pay.pm
FS/FS/cust_pkg.pm
FS/FS/cust_svc.pm
FS/FS/svc_acct.pm
Makefile
bin/pod2x
htetc/global.asa
htetc/handler.pl
httemplate/browse/part_bill_event.cgi [new file with mode: 0755]
httemplate/docs/install.html
httemplate/docs/man/FS.html
httemplate/docs/man/FS/CGI.html
httemplate/docs/man/FS/Conf.html
httemplate/docs/man/FS/Record.html
httemplate/docs/man/FS/SessionClient.html
httemplate/docs/man/FS/SignupClient.html
httemplate/docs/man/FS/UID.html
httemplate/docs/man/FS/cust_bill.html
httemplate/docs/man/FS/cust_credit.html
httemplate/docs/man/FS/cust_main.html
httemplate/docs/man/FS/cust_main_invoice.html
httemplate/docs/man/FS/cust_pay.html
httemplate/docs/man/FS/cust_pay_batch.html
httemplate/docs/man/FS/cust_pkg.html
httemplate/docs/man/FS/cust_refund.html
httemplate/docs/man/FS/cust_svc.html
httemplate/docs/man/FS/domain_record.html
httemplate/docs/man/FS/part_pkg.html
httemplate/docs/man/FS/part_svc.html
httemplate/docs/man/FS/prepay_credit.html
httemplate/docs/man/FS/svc_Common.html
httemplate/docs/man/FS/svc_acct.html
httemplate/docs/man/FS/svc_acct_pop.html
httemplate/docs/man/FS/svc_acct_sm.html
httemplate/docs/man/FS/svc_domain.html
httemplate/docs/man/FS/svc_www.html
httemplate/edit/part_bill_event.cgi [new file with mode: 0755]
httemplate/edit/part_pkg.cgi
httemplate/edit/process/part_bill_event.cgi [new file with mode: 0755]
httemplate/index.html

index ca33300..60831ec 100644 (file)
--- 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<FS::ConfItem> - Freeside configuration option meta-data.
 
 L<FS::UID> - User class (not yet OO)
 
-L<FS::CGI> - 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<FS::CGI> - Non OO-subroutines for the web interface.
 
 =head2 Database record classes
 
@@ -60,6 +57,10 @@ L<FS::part_svc> - Service definition class
 
 L<FS::part_svc_column> - Column constraint class
 
+L<FS::part_export> - External provisioning export class
+
+L<FS::part_export_option> - Export option class
+
 L<FS::part_pkg> - Package (billing item) definition class
 
 L<FS::pkg_svc> - Class linking package (billing item)
@@ -87,6 +88,10 @@ L<FS::cust_bill> - Invoice class
 
 L<FS::cust_bill_pkg> - Invoice line item class
 
+L<FS::part_bill_event> - Invoice event definition class
+
+L<FS::cust_bill_event> - Completed invoice event class
+
 L<FS::cust_pay> - Payment class
 
 L<FS::cust_bill_pay> - Payment application class
@@ -113,7 +118,27 @@ L<FS::queue> - Job queue
 
 L<FS::queue_arg> - Job arguments
 
-=head2 User Interface classes (under development; not yet usable)
+=head1 Remote API modules
+
+L<FS::SignupClient>
+
+L<FS::SessionClient>
+
+L<FS::MailAdminServer>
+
+=head2 Command-line utilities
+
+L<freeside-email>
+
+L<freeside-queued>
+
+L<freeside-adduser>
+
+L<freeside-bill>
+
+L<freeside-overdue>
+
+=head2 User Interface classes (under (stalled) development; not yet usable)
 
 L<FS::UI::Base> - User-interface base class
 
@@ -139,17 +164,17 @@ Providers.
 
 The Freeside home page is at <http://www.sisd.com/freeside>.
 
-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
 <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>.
 
@@ -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...
index 6b7997f..4286606 100644 (file)
@@ -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';
index 1a9d43e..8a7a6f8 100644 (file)
@@ -831,6 +831,18 @@ sub suspend {
   grep { $_->suspend } $self->unsuspended_pkgs;
 }
 
+=item cancel
+
+Cancels all uncancelled packages (see L<FS::cust_pkg>) 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<FS::cust_bill>) 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
 
index 3f81135..51c7b29 100644 (file)
@@ -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
 
index 633b322..b241eca 100644 (file)
@@ -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<FS::svc_acct>) in this
+package have been online since TIMESTAMP.
+
+TIMESTAMP is specified as a UNIX timestamp; see L<perlfunc/"time">.  Also see
+L<Time::Local> and L<Date::Parse> 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
 
index 5fca892..541f0c8 100644 (file)
@@ -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<FS::svc_acct/seconds_since>.  Equivalent to
+$cust_svc->svc_x->seconds_since, but more efficient.  Meaningless for records
+where B<svcdb> 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
 
index 0340e7c..16270f9 100644 (file)
@@ -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<FS::cust_svc>).
+
+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<FS::session>
+
+TIMESTAMP is specified as a UNIX timestamp; see L<perlfunc/"time">.  Also see
+L<Time::Local> and L<Date::Parse> 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
 
index 1211232..6fa3893 100644 (file)
--- 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}
index 8c02006..cbe1423 100755 (executable)
--- 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");
+
index c22afc1..20ef146 100644 (file)
@@ -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 {
index e643559..6ff9d43 100644 (file)
@@ -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 (executable)
index 0000000..f339976
--- /dev/null
@@ -0,0 +1,64 @@
+<!-- $Id: part_bill_event.cgi,v 1.1 2002-01-29 16:33:15 ivan Exp $ -->
+<% 
+
+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.<BR><BR>
+<%= $total %> events
+<%= $cgi->param('showdisabled')
+      ? do { $cgi->param('showdisabled', 0);
+             '( <a href="'. $cgi->self_url. '">hide disabled events</a> )'; }
+      : do { $cgi->param('showdisabled', 1);
+             '( <a href="'. $cgi->self_url. '">show disabled events</a> )'; }
+%>
+<TABLE BORDER=1>
+  <TR>
+    <TH COLSPAN=<%= $cgi->param('showdisabled') ? 2 : 3 %>>Event</TH>
+    <TH>Payby</TH>
+    <TH>After</TH>
+    <TH>Code</TH>
+  </TR>
+
+<% 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});
+%>
+  <TR>
+    <TD><A HREF="<%= $url %>">
+      <%= $part_bill_event->eventpart %></A></TD>
+<% unless ( $cgi->param('showdisabled') ) { %>
+    <TD>
+      <%= $part_bill_event->disabled ? 'DISABLED' : '' %></TD>
+<% } %>
+    <TD><A HREF="<%= $url %>">
+      <%= $part_bill_event->event %></A></TD>
+    <TD>
+      <%= $part_bill_event->payby %></TD>
+    <TD>
+      <%= $delay %></TD>
+    <TD>
+      <%= $part_bill_event->eventcode %></TD>
+  </TR>
+<% } %>
+
+  <TR>
+    <TD COLSPAN=6><A HREF="<%= $p %>edit/part_bill_event.cgi"><I>Add a new billing event</I></A></TD>
+  </TR>
+</TABLE>
+</BODY>
+</HTML>
index 5e36d14..20bb168 100644 (file)
@@ -32,6 +32,7 @@ Before installing, you need:
       <li><a href="http://search.cpan.org/search?dist=MailTools">MailTools</a>
       <li><a href="http://search.cpan.org/search?dist=TimeDate">TimeDate</a>
       <li><a href="http://search.cpan.org/search?dist=DateManip">DateManip</a>
+      <li><a href="http://search.cpan.org/search?dist=Time-Duration">Time-Duration</a>
       <li><a href="http://search.cpan.org/search?dist=File-CounterFile">File-CounterFile</a>
       <li><a href="http://search.cpan.org/search?dist=FreezeThaw">FreezeThaw</a>
       <li><a href="http://search.cpan.org/search?dist=String-Approx">String-Approx</a>
@@ -45,6 +46,7 @@ Before installing, you need:
       <li><a href="http://search.cpan.org/search?dist=String-ShellQuote">String-ShellQuote</a>
       <li><a href="http://search.cpan.org/search?dist=Net-SCP">Net-SCP</a>
       <li><a href="http://www.apache-asp.org/">Apache::ASP</a> or <a href="http://www.masonhq.com/">HTML::Mason</a>
+      <li><a href="http;//search.cpan.org/search?dist=Tie-IxHash">Tie-IxHash</a>
     </ul>
 </ul>
 Install the Freeside distribution:
@@ -151,10 +153,10 @@ require valid-user
     <ul>
       <li>First user:<font size="-1">
 <pre>$ su
-$ freeside-adduser -c -h /usr/local/etc/freeside/htpasswd <i>username</i></pre></font>
+$ <a href="man/bin/freeside-adduser.html">freeside-adduser</a> -c -h /usr/local/etc/freeside/htpasswd <i>username</i></pre></font>
       <li>Additional users:<font size="-1">
 <pre>$ su
-$ freeside-adduser -h /usr/local/etc/freeside/htpasswd <i>username</i></pre></font>
+$ <a href="man/bin/freeside-adduser.html">freeside-adduser</a> -h /usr/local/etc/freeside/htpasswd <i>username</i></pre></font>
     </ul>
   <i>(using other auth types, add each user to your <a href="http://httpd.apache.org/docs/misc/FAQ.html#user-authentication">Apache authentication</a> and then run: <tt>freeside-adduser <b>username</b></tt></i>
   <li>As the freeside UNIX user, run <tt>bin/fs-setup <b>username</b></tt> to create the database tables, passing the username of a Freeside user you created above:
index 23e8ca4..7db6bb9 100644 (file)
 
                <LI><A HREF="#utility classes">Utility classes</A></LI>
                <LI><A HREF="#database record classes">Database record classes</A></LI>
-               <LI><A HREF="#user interface classes (under development; not yet usable)">User Interface classes (under development; not yet usable)</A></LI>
+       </UL>
+
+       <LI><A HREF="#remote api modules">Remote API modules</A></LI>
+       <UL>
+
+               <LI><A HREF="#commandline utilities">Command-line utilities</A></LI>
+               <LI><A HREF="#user interface classes (under (stalled) development; not yet usable)">User Interface classes (under (stalled) development; not yet usable)</A></LI>
                <LI><A HREF="#notes">Notes</A></LI>
        </UL>
 
        <LI><A HREF="#description">DESCRIPTION</A></LI>
-       <LI><A HREF="#version">VERSION</A></LI>
        <LI><A HREF="#support">SUPPORT</A></LI>
        <LI><A HREF="#author">AUTHOR</A></LI>
        <LI><A HREF="#see also">SEE ALSO</A></LI>
 <P>
 <HR>
 <H1><A NAME="synopsis">SYNOPSIS</A></H1>
-<P>FS is the unofficial (i.e. non-CPAN) prefix for the Perl module portion of the
-Freeside ISP billing software.  This includes:</P>
+<P>Freeside perl modules and CLI utilities.</P>
 <P>
 <H2><A NAME="utility classes">Utility classes</A></H2>
 <P><A HREF="././FS/Conf.html">the FS::Conf manpage</A> - Freeside configuration values</P>
+<P><A HREF="././FS/ConfItem.html">the FS::ConfItem manpage</A> - Freeside configuration option meta-data.</P>
 <P><A HREF="././FS/UID.html">the FS::UID manpage</A> - User class (not yet OO)</P>
-<P><A HREF="././FS/CGI.html">the FS::CGI manpage</A> - Non OO-subroutines for the web interface.  This is
-depriciated.  Future development will be focused on the FS::UI user-interface
-classes (see below).</P>
+<P><A HREF="././FS/CGI.html">the FS::CGI manpage</A> - Non OO-subroutines for the web interface.</P>
 <P>
 <H2><A NAME="database record classes">Database record classes</A></H2>
 <P><A HREF="././FS/Record.html">the FS::Record manpage</A> - Database record base class</P>
 <P><A HREF="././FS/svc_acct_pop.html">the FS::svc_acct_pop manpage</A> - POP (Point of Presence, not Post
 Office Protocol) class</P>
+<P><A HREF="././FS/part_pop_local.html">the FS::part_pop_local manpage</A> - Local calling area class</P>
 <P><A HREF="././FS/part_referral.html">the FS::part_referral manpage</A> - Referral class</P>
 <P><A HREF="././FS/cust_main_county.html">the FS::cust_main_county manpage</A> - Locale (tax rate) class</P>
 <P><A HREF="././FS/svc_Common.html">the FS::svc_Common manpage</A> - Service base class</P>
 <P><A HREF="././FS/svc_acct.html">the FS::svc_acct manpage</A> - Account (shell, RADIUS, POP3) class</P>
 <P><A HREF="././FS/svc_domain.html">the FS::svc_domain manpage</A> - Domain class</P>
 <P><A HREF="././FS/domain_record.html">the FS::domain_record manpage</A> - DNS zone entries</P>
-<P><A HREF="././FS/svc_acct_sm.html">the FS::svc_acct_sm manpage</A> - Vitual mail alias class</P>
+<P><A HREF="././FS/svc_forward.html">the FS::svc_forward manpage</A> - Mail forwarding class</P>
+<P><A HREF="././FS/svc_acct_sm.html">the FS::svc_acct_sm manpage</A> - (Depreciated) Vitual mail alias class</P>
 <P><A HREF="././FS/svc_www.html">the FS::svc_www manpage</A> - Web virtual host class.</P>
 <P><A HREF="././FS/part_svc.html">the FS::part_svc manpage</A> - Service definition class</P>
+<P><A HREF="././FS/part_svc_column.html">the FS::part_svc_column manpage</A> - Column constraint class</P>
+<P><A HREF="././FS/part_export.html">the FS::part_export manpage</A> - External provisioning export class</P>
+<P><A HREF="././FS/part_export_option.html">the FS::part_export_option manpage</A> - Export option class</P>
 <P><A HREF="././FS/part_pkg.html">the FS::part_pkg manpage</A> - Package (billing item) definition class</P>
 <P><A HREF="././FS/pkg_svc.html">the FS::pkg_svc manpage</A> - Class linking package (billing item)
 definitions (see <A HREF="././FS/part_pkg.html">the FS::part_pkg manpage</A>) with service definitions
@@ -76,16 +84,36 @@ definitions (see <A HREF="././FS/part_pkg.html">the FS::part_pkg manpage</A>) wi
 class</P>
 <P><A HREF="././FS/cust_bill.html">the FS::cust_bill manpage</A> - Invoice class</P>
 <P><A HREF="././FS/cust_bill_pkg.html">the FS::cust_bill_pkg manpage</A> - Invoice line item class</P>
+<P><A HREF="././FS/part_bill_event.html">the FS::part_bill_event manpage</A> - Invoice event definition class</P>
+<P><A HREF="././FS/cust_bill_event.html">the FS::cust_bill_event manpage</A> - Completed invoice event class</P>
 <P><A HREF="././FS/cust_pay.html">the FS::cust_pay manpage</A> - Payment class</P>
+<P><A HREF="././FS/cust_bill_pay.html">the FS::cust_bill_pay manpage</A> - Payment application class</P>
 <P><A HREF="././FS/cust_credit.html">the FS::cust_credit manpage</A> - Credit class</P>
 <P><A HREF="././FS/cust_refund.html">the FS::cust_refund manpage</A> - Refund class</P>
+<P><A HREF="././FS/cust_credit_refund.html">the FS::cust_credit_refund manpage</A> - Refund application class</P>
+<P><A HREF="././FS/cust_credit_bill.html">the FS::cust_credit_bill manpage</A> - Credit invoice application class</P>
 <P><A HREF="././FS/cust_pay_batch.html">the FS::cust_pay_batch manpage</A> - Credit card transaction queue class</P>
 <P><A HREF="././FS/prepay_credit.html">the FS::prepay_credit manpage</A> - Prepaid ``calling card'' credit class.</P>
 <P><A HREF="././FS/nas.html">the FS::nas manpage</A> - Network Access Server class</P>
 <P><A HREF="././FS/port.html">the FS::port manpage</A> - NAS port class</P>
 <P><A HREF="././FS/session.html">the FS::session manpage</A> - User login session class</P>
+<P><A HREF="././FS/queue.html">the FS::queue manpage</A> - Job queue</P>
+<P><A HREF="././FS/queue_arg.html">the FS::queue_arg manpage</A> - Job arguments</P>
 <P>
-<H2><A NAME="user interface classes (under development; not yet usable)">User Interface classes (under development; not yet usable)</A></H2>
+<HR>
+<H1><A NAME="remote api modules">Remote API modules</A></H1>
+<P><A HREF="./FS/SignupClient.html">the FS::SignupClient manpage</A></P>
+<P><A HREF="./FS/SessionClient.html">the FS::SessionClient manpage</A></P>
+<P><A HREF="./FS/MailAdminServer.html">the FS::MailAdminServer manpage</A></P>
+<P>
+<H2><A NAME="commandline utilities">Command-line utilities</A></H2>
+<P><A HREF="././bin/freeside-email.html">the freeside-email manpage</A></P>
+<P><A HREF="././bin/freeside-queued.html">the freeside-queued manpage</A></P>
+<P><A HREF="././bin/freeside-adduser.html">the freeside-adduser manpage</A></P>
+<P><A HREF="././bin/freeside-bill.html">the freeside-bill manpage</A></P>
+<P><A HREF="././bin/freeside-overdue.html">the freeside-overdue manpage</A></P>
+<P>
+<H2><A NAME="user interface classes (under (stalled) development; not yet usable)">User Interface classes (under (stalled) development; not yet usable)</A></H2>
 <P><A HREF="././FS/UI/Base.html">the FS::UI::Base manpage</A> - User-interface base class</P>
 <P><A HREF="././FS/UI/Gtk.html">the FS::UI::Gtk manpage</A> - Gtk user-interface class</P>
 <P><A HREF="././FS/UI/CGI.html">the FS::UI::CGI manpage</A> - CGI (HTML) user-interface class</P>
@@ -95,22 +123,23 @@ class</P>
 <P>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.''</P>
+<P>If you've never used OO modules before,
+<A HREF="http://www.cpan.org/doc/FMTEYEWTK/easy_objects.html">http://www.cpan.org/doc/FMTEYEWTK/easy_objects.html</A> might help you out.</P>
 <P>
 <HR>
 <H1><A NAME="description">DESCRIPTION</A></H1>
 <P>Freeside is a billing and administration package for Internet Service
 Providers.</P>
 <P>The Freeside home page is at &lt;http://www.sisd.com/freeside&gt;.</P>
-<P>The main documentation is in htdocs/docs.</P>
-<P>
-<HR>
-<H1><A NAME="version">VERSION</A></H1>
-<P>$Id: FS.html,v 1.1 2001-07-30 07:36:03 ivan Exp $</P>
+<P>The main documentation is in httemplate/docs.</P>
 <P>
 <HR>
 <H1><A NAME="support">SUPPORT</A></H1>
-<P>A mailing list for users and developers is available.  Send a blank message to
+<P>A mailing list for users is available.  Send a blank message to
 &lt;<A HREF="mailto:ivan-freeside-subscribe@sisd.com">ivan-freeside-subscribe@sisd.com</A>&gt; to subscribe.</P>
+<P>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
+&lt;<A HREF="mailto:ivan-freeside-devel-subscribe@sisd.com">ivan-freeside-devel-subscribe@sisd.com</A>&gt; to subscribe.</P>
 <P>Commercial support is available; see
 &lt;http://www.sisd.com/freeside/commercial.html&gt;.</P>
 <P>
@@ -126,9 +155,6 @@ list and the individal files for details.</P>
 <P>
 <HR>
 <H1><A NAME="bugs">BUGS</A></H1>
-<P>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.</P>
 <P>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...</P>
index 05f7823..54a0bf3 100644 (file)
@@ -79,12 +79,17 @@ Returns HTML tag for beginning an (invisible) table.
 <DT><STRONG><A NAME="item_ntable">ntable</A></STRONG><BR>
 <DD>
 This is getting silly.
+<P></P>
+<DT><STRONG><A NAME="item_small_custview_CUSTNUM_%7C%7C_CUST_MAIN_OBJECT%2C_">small_custview CUSTNUM || CUST_MAIN_OBJECT, COUNTRYDEFAULT</A></STRONG><BR>
+<DD>
+Sheesh. I should just switch to Mason.
 <P></P></DL>
 <P>
 <HR>
 <H1><A NAME="bugs">BUGS</A></H1>
 <P>Not OO.</P>
 <P>Not complete.</P>
+<P>small_custview sooooo doesn't belong here.  i should just switch to Mason.</P>
 <P>
 <HR>
 <H1><A NAME="see also">SEE ALSO</A></H1>
index 7b1613e..be49be3 100644 (file)
@@ -1,6 +1,6 @@
 <HTML>
 <HEAD>
-<TITLE>FS::Conf - Read access to Freeside configuration values</TITLE>
+<TITLE>FS::Conf - Freeside configuration values</TITLE>
 <LINK REV="made" HREF="mailto:perl@packages.debian.org">
 </HEAD>
 
@@ -23,7 +23,7 @@
 <HR>
 <P>
 <H1><A NAME="name">NAME</A></H1>
-<P>FS::Conf - Read access to Freeside configuration values</P>
+<P>FS::Conf - Freeside configuration values</P>
 <P>
 <HR>
 <H1><A NAME="synopsis">SYNOPSIS</A></H1>
   $value = $conf-&gt;config('key');
   @list  = $conf-&gt;config('key');
   $bool  = $conf-&gt;exists('key');</PRE>
+<PRE>
+  @config_items = $conf-&gt;config_items;</PRE>
 <P>
 <HR>
 <H1><A NAME="description">DESCRIPTION</A></H1>
-<P>Read access to Freeside configuration values.  Keys currently map to filenames,
+<P>Read and write Freeside configuration values.  Keys currently map to filenames,
 but this may change in the future.</P>
 <P>
 <HR>
@@ -66,15 +68,29 @@ Returns the configuration value or values (depending on context) for key.
 <DD>
 Returns true if the specified key exists, even if the corresponding value
 is undefined.
+<P></P>
+<DT><STRONG><A NAME="item_touch">touch</A></STRONG><BR>
+<DD>
+<DT><STRONG><A NAME="item_set">set</A></STRONG><BR>
+<DD>
+<DT><STRONG><A NAME="item_delete">delete</A></STRONG><BR>
+<DD>
+<DT><STRONG><A NAME="item_config_items">config_items</A></STRONG><BR>
+<DD>
+Returns all of the possible configuration items as FS::ConfItem objects.  See
+<A HREF=".././FS/ConfItem.html">the FS::ConfItem manpage</A>.
 <P></P></DL>
 <P>
 <HR>
 <H1><A NAME="bugs">BUGS</A></H1>
-<P>Write access (with locking) should be implemented.</P>
+<P>Write access (touch, set, delete) should be documented.</P>
+<P>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.</P>
 <P>
 <HR>
 <H1><A NAME="see also">SEE ALSO</A></H1>
-<P>config.html from the base documentation contains a list of configuration files.</P>
+<P>``Configuration'' in the web interface (config/config.cgi).</P>
+<P>httemplate/docs/config.html</P>
 
 </BODY>
 
index 0930408..108a84a 100644 (file)
@@ -17,7 +17,6 @@
        <LI><A HREF="#constructors">CONSTRUCTORS</A></LI>
        <LI><A HREF="#methods">METHODS</A></LI>
        <LI><A HREF="#subroutines">SUBROUTINES</A></LI>
-       <LI><A HREF="#version">VERSION</A></LI>
        <LI><A HREF="#bugs">BUGS</A></LI>
        <LI><A HREF="#see also">SEE ALSO</A></LI>
 </UL>
 <PRE>
     $value = $record-&gt;unique('column');</PRE>
 <PRE>
-    $value = $record-&gt;ut_float('column');
-    $value = $record-&gt;ut_number('column');
-    $value = $record-&gt;ut_numbern('column');
-    $value = $record-&gt;ut_money('column');
-    $value = $record-&gt;ut_text('column');
-    $value = $record-&gt;ut_textn('column');
-    $value = $record-&gt;ut_alpha('column');
-    $value = $record-&gt;ut_alphan('column');
-    $value = $record-&gt;ut_phonen('column');
-    $value = $record-&gt;ut_anythingn('column');</PRE>
+    $error = $record-&gt;ut_float('column');
+    $error = $record-&gt;ut_number('column');
+    $error = $record-&gt;ut_numbern('column');
+    $error = $record-&gt;ut_money('column');
+    $error = $record-&gt;ut_text('column');
+    $error = $record-&gt;ut_textn('column');
+    $error = $record-&gt;ut_alpha('column');
+    $error = $record-&gt;ut_alphan('column');
+    $error = $record-&gt;ut_phonen('column');
+    $error = $record-&gt;ut_anything('column');
+    $error = $record-&gt;ut_name('column');</PRE>
 <PRE>
     $dbdef = reload_dbdef;
     $dbdef = reload_dbdef &quot;/non/standard/filename&quot;;
@@ -125,6 +125,14 @@ objects.
 #regular FS::TABLE methods
 #on it.</P>
 <P></P>
+<DT><STRONG><A NAME="item_jsearch_TABLE%2C_HASHREF%2C_SELECT%2C_EXTRA_SQL%2C">jsearch TABLE, HASHREF, SELECT, EXTRA_SQL, PRIMARY_TABLE, PRIMARY_KEY</A></STRONG><BR>
+<DD>
+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.
+<P>Arguments:</P>
+<P></P>
 <DT><STRONG><A NAME="item_qsearchs">qsearchs TABLE, HASHREF</A></STRONG><BR>
 <DD>
 Same as qsearch, except that if more than one record matches, it <STRONG>carp</STRONG>s but
@@ -266,10 +274,29 @@ Check/untaint ip addresses.  IPv4 only for now.  May be null.
 <DD>
 Check/untaint host and domain names.
 <P></P>
+<DT><STRONG><A NAME="item_ut_name_COLUMN">ut_name COLUMN</A></STRONG><BR>
+<DD>
+Check/untaint proper names; allows alphanumerics, spaces and the following
+punctuation: , . - '
+<P>May not be null.</P>
+<P></P>
+<DT><STRONG><A NAME="item_ut_zip_COLUMN">ut_zip COLUMN</A></STRONG><BR>
+<DD>
+Check/untaint zip codes.
+<P></P>
+<DT><STRONG><A NAME="item_ut_country_COLUMN">ut_country COLUMN</A></STRONG><BR>
+<DD>
+Check/untaint country codes.  Country names are changed to codes, if possible -
+see <A HREF="../Locale/Country.html">the Locale::Country manpage</A>.
+<P></P>
 <DT><STRONG><A NAME="item_ut_anything_COLUMN">ut_anything COLUMN</A></STRONG><BR>
 <DD>
 Untaints arbitrary data.  Be careful.
 <P></P>
+<DT><STRONG><A NAME="item_ut_enum_COLUMN_CHOICES_ARRAYREF">ut_enum COLUMN CHOICES_ARRAYREF</A></STRONG><BR>
+<DD>
+Check/untaint a column, supplying all possible choices, like the ``enum'' type.
+<P></P>
 <DT><STRONG><A NAME="item_fields_%5B_TABLE_%5D">fields [ TABLE ]</A></STRONG><BR>
 <DD>
 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.
 <P></P></DL>
 <P>
 <HR>
-<H1><A NAME="version">VERSION</A></H1>
-<P>$Id: Record.html,v 1.1 2001-07-30 07:36:03 ivan Exp $</P>
-<P>
-<HR>
 <H1><A NAME="bugs">BUGS</A></H1>
 <P>This module should probably be renamed, since much of the functionality is
 of general use.  It is not completely unlike Adapter::DBI (see below).</P>
@@ -323,7 +346,7 @@ true maps to the database (and WHERE clauses) would also help.</P>
 <P>A fallback check method should be provided which uses the dbdef.</P>
 <P>The ut_money method assumes money has two decimal digits.</P>
 <P>The Pg money kludge in the new method only strips `$'.</P>
-<P>The ut_phonen method assumes US-style phone numbers.</P>
+<P>The ut_phonen method only checks US-style phone numbers.</P>
 <P>The _quote function should probably use ut_float instead of a regex.</P>
 <P>All the subroutines probably should be methods, here or elsewhere.</P>
 <P>Probably should borrow/use some dbdef methods where appropriate (like sub
@@ -331,6 +354,7 @@ fields)</P>
 <P>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)</P>
+<P>ut_zip should take an optional country like ut_phone.</P>
 <P>
 <HR>
 <H1><A NAME="see also">SEE ALSO</A></H1>
index 615f35e..0abb2a6 100644 (file)
@@ -83,7 +83,7 @@ optional, but must be correct if specified.
 <P>
 <HR>
 <H1><A NAME="version">VERSION</A></H1>
-<P>$Id: SessionClient.html,v 1.1 2001-07-30 07:36:03 ivan Exp $</P>
+<P>$Id: SessionClient.html,v 1.3 2002-01-29 17:42:46 ivan Exp $</P>
 <P>
 <HR>
 <H1><A NAME="bugs">BUGS</A></H1>
index 844f64f..3438c80 100644 (file)
 <HTML>
 <HEAD>
 <TITLE>FS::SignupClient - Freeside signup client API</TITLE>
-<LINK REV="made" HREF="mailto:none">
+<LINK REV="made" HREF="mailto:perl@packages.debian.org">
 </HEAD>
 
 <BODY>
 
+<A NAME="__index__"></A>
 <!-- INDEX BEGIN -->
 
 <UL>
 
-       <LI><A HREF="#NAME">NAME</A>
-       <LI><A HREF="#SYNOPSIS">SYNOPSIS</A>
-       <LI><A HREF="#DESCRIPTION">DESCRIPTION</A>
-       <LI><A HREF="#SUBROUTINES">SUBROUTINES</A>
-       <LI><A HREF="#VERSION">VERSION</A>
-       <LI><A HREF="#BUGS">BUGS</A>
-       <LI><A HREF="#SEE_ALSO">SEE ALSO</A>
+       <LI><A HREF="#name">NAME</A></LI>
+       <LI><A HREF="#synopsis">SYNOPSIS</A></LI>
+       <LI><A HREF="#description">DESCRIPTION</A></LI>
+       <LI><A HREF="#subroutines">SUBROUTINES</A></LI>
+       <LI><A HREF="#bugs">BUGS</A></LI>
+       <LI><A HREF="#see also">SEE ALSO</A></LI>
 </UL>
 <!-- INDEX END -->
 
 <HR>
 <P>
-<H1><A NAME="NAME">NAME</A></H1>
-<P>
-FS::SignupClient - Freeside signup client API
-
+<H1><A NAME="name">NAME</A></H1>
+<P>FS::SignupClient - Freeside signup client API</P>
 <P>
 <HR>
-<H1><A NAME="SYNOPSIS">SYNOPSIS</A></H1>
-<P>
-<PRE>  use FS::SignupClient qw( signup_info new_customer );
-</PRE>
-<P>
-<PRE>  ( $locales, $packages, $pops ) = signup_info;
-</PRE>
-<P>
-<PRE>  $error = new_customer ( {
-    'first'          =&gt; $first,
-    'last'           =&gt; $last,
-    'ss'             =&gt; $ss,
-    'comapny'        =&gt; $company,
-    'address1'       =&gt; $address1,
-    'address2'       =&gt; $address2,
-    'city'           =&gt; $city,
-    'county'         =&gt; $county,
-    'state'          =&gt; $state,
-    'zip'            =&gt; $zip,
-    'country'        =&gt; $country,
-    'daytime'        =&gt; $daytime,
-    'night'          =&gt; $night,
-    'fax'            =&gt; $fax,
-    'payby'          =&gt; $payby,
-    'payinfo'        =&gt; $payinfo,
-    'paydate'        =&gt; $paydate,
-    'payname'        =&gt; $payname,
-    'invoicing_list' =&gt; $invoicing_list,
-    'pkgpart'        =&gt; $pkgpart,
-    'username'       =&gt; $username,
-    '_password'       =&gt; $password,
-    'popnum'         =&gt; $popnum,
-  } );
-</PRE>
+<H1><A NAME="synopsis">SYNOPSIS</A></H1>
+<PRE>
+  use FS::SignupClient qw( signup_info new_customer );</PRE>
+<PRE>
+  ( $locales, $packages, $pops ) = signup_info;</PRE>
+<PRE>
+  $error = new_customer ( {
+    'first'            =&gt; $first,
+    'last'             =&gt; $last,
+    'ss'               =&gt; $ss,
+    'comapny'          =&gt; $company,
+    'address1'         =&gt; $address1,
+    'address2'         =&gt; $address2,
+    'city'             =&gt; $city,
+    'county'           =&gt; $county,
+    'state'            =&gt; $state,
+    'zip'              =&gt; $zip,
+    'country'          =&gt; $country,
+    'daytime'          =&gt; $daytime,
+    'night'            =&gt; $night,
+    'fax'              =&gt; $fax,
+    'payby'            =&gt; $payby,
+    'payinfo'          =&gt; $payinfo,
+    'paydate'          =&gt; $paydate,
+    'payname'          =&gt; $payname,
+    'invoicing_list'   =&gt; $invoicing_list,
+    'referral_custnum' =&gt; $referral_custnum,
+    'pkgpart'          =&gt; $pkgpart,
+    'username'         =&gt; $username,
+    '_password'        =&gt; $password,
+    'popnum'           =&gt; $popnum,
+  } );</PRE>
 <P>
 <HR>
-<H1><A NAME="DESCRIPTION">DESCRIPTION</A></H1>
-<P>
-This module provides an API for a remote signup server.
-
-<P>
-It needs to be run as the freeside user. Because of this, the program which
-calls these subroutines should be written very carefully.
-
+<H1><A NAME="description">DESCRIPTION</A></H1>
+<P>This module provides an API for a remote signup server.</P>
+<P>It needs to be run as the freeside user.  Because of this, the program which
+calls these subroutines should be written very carefully.</P>
 <P>
 <HR>
-<H1><A NAME="SUBROUTINES">SUBROUTINES</A></H1>
+<H1><A NAME="subroutines">SUBROUTINES</A></H1>
 <DL>
-<DT><STRONG><A NAME="item_signup_info">signup_info</A></STRONG><DD>
-<P>
+<DT><STRONG><A NAME="item_signup_info">signup_info</A></STRONG><BR>
+<DD>
 Returns three array references of hash references.
-
-<P>
-The first set of hash references is of allowable locales. Each hash
-reference has the following keys: taxnum state county country
-
-<P>
-The second set of hash references is of allowable packages. Each hash
-reference has the following keys: pkgpart pkg
-
-<P>
-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
-
-<DT><STRONG><A NAME="item_new_customer">new_customer HASHREF</A></STRONG><DD>
-<P>
-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
-
-<P>
-Returns a scalar error message, or the empty string for success.
-
-</DL>
+<P>The first set of hash references is of allowable locales.  Each hash reference
+has the following keys:
+  taxnum
+  state
+  county
+  country</P>
+<P>The second set of hash references is of allowable packages.  Each hash
+reference has the following keys:
+  pkgpart
+  pkg</P>
+<P>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</P>
+<P></P>
+<DT><STRONG><A NAME="item_new_customer_HASHREF">new_customer HASHREF</A></STRONG><BR>
+<DD>
+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
+<P>Returns a scalar error message, or the empty string for success.</P>
+<P></P></DL>
 <P>
 <HR>
-<H1><A NAME="VERSION">VERSION</A></H1>
-<P>
-$Id: SignupClient.html,v 1.1 2001-07-30 07:36:03 ivan Exp $
-
-<P>
-<HR>
-<H1><A NAME="BUGS">BUGS</A></H1>
+<H1><A NAME="bugs">BUGS</A></H1>
 <P>
 <HR>
-<H1><A NAME="SEE_ALSO">SEE ALSO</A></H1>
-<P>
-<EM>fs_signupd</EM>, <A HREF="./htdocs/docs/man/FS/SignupServer.html">FS::SignupServer</A>, <A HREF="./htdocs/docs/man/FS/cust_main.html">FS::cust_main</A>
-
-
+<H1><A NAME="see also">SEE ALSO</A></H1>
+<P><EM>fs_signupd</EM>, <A HREF="../FS/SignupServer.html">the FS::SignupServer manpage</A>, <A HREF=".././FS/cust_main.html">the FS::cust_main manpage</A></P>
 
 </BODY>
 
index 9f49477..3c28eeb 100644 (file)
@@ -31,7 +31,7 @@
 <H1><A NAME="synopsis">SYNOPSIS</A></H1>
 <PRE>
   use FS::UID qw(adminsuidsetup cgisuidsetup dbh datasrc getotaker
-  checkeuid checkruid swapuid);</PRE>
+  checkeuid checkruid);</PRE>
 <PRE>
   adminsuidsetup $user;</PRE>
 <PRE>
@@ -100,10 +100,6 @@ Returns true if effective UID is that of the freeside user.
 <DD>
 Returns true if the real UID is that of the freeside user.
 <P></P>
-<DT><STRONG><A NAME="item_swapuid">swapuid</A></STRONG><BR>
-<DD>
-Swaps real and effective UIDs.
-<P></P>
 <DT><STRONG><A NAME="item_getsecrets_%5B_USER_%5D">getsecrets [ USER ]</A></STRONG><BR>
 <DD>
 Sets the user to USER, if supplied.
@@ -122,7 +118,7 @@ coderef into the hash %FS::UID::callback :</P>
 <P>
 <HR>
 <H1><A NAME="version">VERSION</A></H1>
-<P>$Id: UID.html,v 1.1 2001-07-30 07:36:03 ivan Exp $</P>
+<P>$Id: UID.html,v 1.3 2002-01-29 17:42:46 ivan Exp $</P>
 <P>
 <HR>
 <H1><A NAME="bugs">BUGS</A></H1>
index 2e2ad37..8bdb87b 100644 (file)
@@ -50,6 +50,8 @@
 <PRE>
   @cust_pay_objects = $cust_bill-&gt;cust_pay;</PRE>
 <PRE>
+  $tax_amount = $record-&gt;tax;</PRE>
+<PRE>
   @lines = $cust_bill-&gt;print_text;
   @lines = $cust_bill-&gt;print_text $time;</PRE>
 <P>
@@ -72,6 +74,8 @@ following fields are currently supported:</P>
 <DT><STRONG><A NAME="item_automatically">printed - how many times this invoice has been printed automatically
 (see <A HREF=".././FS/cust_main.html#collect">collect in the FS::cust_main manpage</A>).</A></STRONG><BR>
 <DD>
+<DT><STRONG><A NAME="item_closed_%2D_books_closed_flag%2C_empty_or_%60Y%27">closed - books closed flag, empty or `Y'</A></STRONG><BR>
+<DD>
 </DL>
 <P>
 <HR>
@@ -117,18 +121,34 @@ Returns the line items (see <A HREF=".././FS/cust_bill_pkg.html">the FS::cust_bi
 <P></P>
 <DT><STRONG><A NAME="item_cust_credit">cust_credit</A></STRONG><BR>
 <DD>
-Returns a list consisting of the total previous credited (see
-<A HREF=".././FS/cust_credit.html">the FS::cust_credit manpage</A>) for this customer, followed by the previous outstanding
-credits (FS::cust_credit objects).
+Depreciated.  See the cust_credited method.
+<PRE>
+ #Returns a list consisting of the total previous credited (see
+ #L&lt;FS::cust_credit&gt;) and unapplied for this customer, followed by the previous
+ #outstanding credits (FS::cust_credit objects).</PRE>
 <P></P>
 <DT><STRONG><A NAME="item_cust_pay">cust_pay</A></STRONG><BR>
 <DD>
-Returns all payments (see <A HREF=".././FS/cust_pay.html">the FS::cust_pay manpage</A>) for this invoice.
+Depreciated.  See the cust_bill_pay method.
+<P>#Returns all payments (see <A HREF=".././FS/cust_pay.html">the FS::cust_pay manpage</A>) for this invoice.</P>
+<P></P>
+<DT><STRONG><A NAME="item_cust_bill_pay">cust_bill_pay</A></STRONG><BR>
+<DD>
+Returns all payment applications (see <A HREF=".././FS/cust_bill_pay.html">the FS::cust_bill_pay manpage</A>) for this invoice.
+<P></P>
+<DT><STRONG><A NAME="item_cust_credited">cust_credited</A></STRONG><BR>
+<DD>
+Returns all applied credits (see <A HREF=".././FS/cust_credit_bill.html">the FS::cust_credit_bill manpage</A>) for this invoice.
+<P></P>
+<DT><STRONG><A NAME="item_tax">tax</A></STRONG><BR>
+<DD>
+Returns the tax amount (see <A HREF=".././FS/cust_bill_pkg.html">the FS::cust_bill_pkg manpage</A>) for this invoice.
 <P></P>
 <DT><STRONG><A NAME="item_owed">owed</A></STRONG><BR>
 <DD>
 Returns the amount owed (still outstanding) on this invoice, which is charged
-minus all payments (see <A HREF=".././FS/cust_pay.html">the FS::cust_pay manpage</A>).
+minus all payment applications (see <A HREF=".././FS/cust_bill_pay.html">the FS::cust_bill_pay manpage</A>) and credit
+applications (see <A HREF=".././FS/cust_credit_bill.html">the FS::cust_credit_bill manpage</A>).
 <P></P>
 <DT><STRONG><A NAME="item_print_text_%5BTIME%5D%3B">print_text [TIME];</A></STRONG><BR>
 <DD>
@@ -141,7 +161,7 @@ It is specified as a UNIX timestamp; see <EM>perlfunc/``time''</EM>.  Also see
 <P>
 <HR>
 <H1><A NAME="version">VERSION</A></H1>
-<P>$Id: cust_bill.html,v 1.1 2001-07-30 07:36:03 ivan Exp $</P>
+<P>$Id: cust_bill.html,v 1.3 2002-01-29 17:42:46 ivan Exp $</P>
 <P>
 <HR>
 <H1><A NAME="bugs">BUGS</A></H1>
@@ -153,8 +173,9 @@ or something similar so the look can be completely customized?)</P>
 <P>
 <HR>
 <H1><A NAME="see also">SEE ALSO</A></H1>
-<P><A HREF=".././FS/Record.html">the FS::Record manpage</A>, <A HREF=".././FS/cust_main.html">the FS::cust_main manpage</A>, <A HREF=".././FS/cust_pay.html">the FS::cust_pay manpage</A>, <A HREF=".././FS/cust_bill_pkg.html">the FS::cust_bill_pkg manpage</A>,
-<A HREF=".././FS/cust_credit.html">the FS::cust_credit manpage</A>, schema.html from the base documentation.</P>
+<P><A HREF=".././FS/Record.html">the FS::Record manpage</A>, <A HREF=".././FS/cust_main.html">the FS::cust_main manpage</A>, <A HREF=".././FS/cust_bill_pay.html">the FS::cust_bill_pay manpage</A>, <EM>FS:;cust_pay</EM>,
+<A HREF=".././FS/cust_bill_pkg.html">the FS::cust_bill_pkg manpage</A>, <A HREF="../FS/cust_bill_credit.html">the FS::cust_bill_credit manpage</A>, schema.html from the base
+documentation.</P>
 
 </BODY>
 
index 16caca6..f302413 100644 (file)
@@ -61,6 +61,8 @@ FS::Record.  The following fields are currently supported:</P>
 <DD>
 <DT><STRONG><A NAME="item_reason_%2D_text">reason - text</A></STRONG><BR>
 <DD>
+<DT><STRONG><A NAME="item_closed_%2D_books_closed_flag%2C_empty_or_%60Y%27">closed - books closed flag, empty or `Y'</A></STRONG><BR>
+<DD>
 </DL>
 <P>
 <HR>
@@ -92,17 +94,28 @@ methods.
 <P></P>
 <DT><STRONG><A NAME="item_cust_refund">cust_refund</A></STRONG><BR>
 <DD>
-Returns all refunds (see <A HREF=".././FS/cust_refund.html">the FS::cust_refund manpage</A>) for this credit.
+Depreciated.  See the cust_credit_refund method.
+<P>#Returns all refunds (see <A HREF=".././FS/cust_refund.html">the FS::cust_refund manpage</A>) for this credit.</P>
+<P></P>
+<DT><STRONG><A NAME="item_cust_credit_refund">cust_credit_refund</A></STRONG><BR>
+<DD>
+Returns all refund applications (see <A HREF=".././FS/cust_credit_refund.html">the FS::cust_credit_refund manpage</A>) for this credit.
+<P></P>
+<DT><STRONG><A NAME="item_cust_credit_bill">cust_credit_bill</A></STRONG><BR>
+<DD>
+Returns all application to invoices (see <A HREF=".././FS/cust_credit_bill.html">the FS::cust_credit_bill manpage</A>) for this
+credit.
 <P></P>
 <DT><STRONG><A NAME="item_credited">credited</A></STRONG><BR>
 <DD>
 Returns the amount of this credit that is still outstanding; which is
-amount minus all refunds (see <A HREF=".././FS/cust_refund.html">the FS::cust_refund manpage</A>).
+amount minus all refund applications (see <A HREF=".././FS/cust_credit_refund.html">the FS::cust_credit_refund manpage</A>) and
+applications to invoices (see <A HREF=".././FS/cust_credit_bill.html">the FS::cust_credit_bill manpage</A>).
 <P></P></DL>
 <P>
 <HR>
 <H1><A NAME="version">VERSION</A></H1>
-<P>$Id: cust_credit.html,v 1.1 2001-07-30 07:36:03 ivan Exp $</P>
+<P>$Id: cust_credit.html,v 1.3 2002-01-29 17:42:46 ivan Exp $</P>
 <P>
 <HR>
 <H1><A NAME="bugs">BUGS</A></H1>
@@ -110,7 +123,8 @@ amount minus all refunds (see <A HREF=".././FS/cust_refund.html">the FS::cust_re
 <P>
 <HR>
 <H1><A NAME="see also">SEE ALSO</A></H1>
-<P><A HREF=".././FS/Record.html">the FS::Record manpage</A>, <A HREF=".././FS/cust_refund.html">the FS::cust_refund manpage</A>, <A HREF=".././FS/cust_bill.html">the FS::cust_bill manpage</A>, schema.html from the base
+<P><A HREF=".././FS/Record.html">the FS::Record manpage</A>, <A HREF=".././FS/cust_credit_refund.html">the FS::cust_credit_refund manpage</A>, <A HREF=".././FS/cust_refund.html">the FS::cust_refund manpage</A>,
+<A HREF=".././FS/cust_credit_bill.html">the FS::cust_credit_bill manpage</A> <A HREF=".././FS/cust_bill.html">the FS::cust_bill manpage</A>, schema.html from the base
 documentation.</P>
 
 </BODY>
index f8e9a8c..86e659a 100644 (file)
@@ -15,6 +15,7 @@
        <LI><A HREF="#synopsis">SYNOPSIS</A></LI>
        <LI><A HREF="#description">DESCRIPTION</A></LI>
        <LI><A HREF="#methods">METHODS</A></LI>
+       <LI><A HREF="#subroutines">SUBROUTINES</A></LI>
        <LI><A HREF="#version">VERSION</A></LI>
        <LI><A HREF="#bugs">BUGS</A></LI>
        <LI><A HREF="#see also">SEE ALSO</A></LI>
@@ -46,6 +47,8 @@
 <PRE>
   @cust_pkg = $record-&gt;ncancelled_pkgs;</PRE>
 <PRE>
+  @cust_pkg = $record-&gt;suspended_pkgs;</PRE>
+<PRE>
   $error = $record-&gt;bill;
   $error = $record-&gt;bill %options;
   $error = $record-&gt;bill 'time' =&gt; $time;</PRE>
@@ -134,6 +137,8 @@ FS::Record.  The following fields are currently supported:</P>
 <DD>
 <DT><STRONG><A NAME="item_taker">otaker - order taker (assigned automatically, see <A HREF=".././FS/UID.html">the FS::UID manpage</A>)</A></STRONG><BR>
 <DD>
+<DT><STRONG><A NAME="item_comments">comments - comments (optional)</A></STRONG><BR>
+<DD>
 </DL>
 <P>
 <HR>
@@ -145,15 +150,15 @@ Creates a new customer.  To add the customer to the database, see <A HREF="#inse
 <P>Note that this stores the hash reference, not a distinct copy of the hash it
 points to.  You can ask the object for a copy with the <EM>hash</EM> method.</P>
 <P></P>
-<DT><STRONG><A NAME="item_insert">insert</A></STRONG><BR>
+<DT><STRONG><A NAME="item_insert_%5B_CUST_PKG_HASHREF_%5B_%2C_INVOICING_LIST">insert [ CUST_PKG_HASHREF [ , INVOICING_LIST_ARYREF ] ]</A></STRONG><BR>
 <DD>
 Adds this customer to the database.  If there is an error, returns the error,
 otherwise returns false.
-<P>There is a special insert mode in which you pass a data structure to the insert
-method containing FS::cust_pkg and FS::svc_<EM>tablename</EM> 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:</P>
+<P>CUST_PKG_HASHREF: If you pass a Tie::RefHash data structure to the insert
+method containing FS::cust_pkg and FS::svc_<EM>tablename</EM> 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:</P>
 <PRE>
   use Tie::RefHash;
   tie %hash, 'Tie::RefHash'; #this part is important
@@ -162,6 +167,14 @@ but until then, here's an example:</P>
     ...
   );
   $cust_main-&gt;insert( \%hash );</PRE>
+<P>INVOICING_LIST_ARYREF: If you pass an arrarref to the insert method, it will
+be set as the invoicing list (see <A HREF="#invoicing_list">invoicing_list</A>).  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:</P>
+<PRE>
+  $cust_main-&gt;insert( {}, [ $email, 'POST' ] );</PRE>
 <P></P>
 <DT><STRONG><A NAME="item_delete_NEW_CUSTNUM">delete NEW_CUSTNUM</A></STRONG><BR>
 <DD>
@@ -170,15 +183,23 @@ returns false.
 <P>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 <A HREF=".././FS/cust_pkg.html#cancel">cancel in the FS::cust_pkg manpage</A>).</P>
-<P>If the customer has any packages, you need to pass a new (valid) customer
-number for those packages to be transferred to.</P>
+<P>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 <A HREF=".././FS/cust_pkg.html#cancel">cancel in the FS::cust_pkg manpage</A>?</P>
 <P>You can't delete a customer with invoices (see <A HREF=".././FS/cust_bill.html">the FS::cust_bill manpage</A>),
-or credits (see <A HREF=".././FS/cust_credit.html">the FS::cust_credit manpage</A>).</P>
+or credits (see <A HREF=".././FS/cust_credit.html">the FS::cust_credit manpage</A>) or payments (see <A HREF=".././FS/cust_pay.html">the FS::cust_pay manpage</A>).</P>
 <P></P>
-<DT><STRONG><A NAME="item_replace_OLD_RECORD">replace OLD_RECORD</A></STRONG><BR>
+<DT><STRONG><A NAME="item_replace_OLD_RECORD_%5B_INVOICING_LIST_ARYREF_%5D">replace OLD_RECORD [ INVOICING_LIST_ARYREF ]</A></STRONG><BR>
 <DD>
 Replaces the OLD_RECORD with this one in the database.  If there is an error,
 returns the error, otherwise returns false.
+<P>INVOICING_LIST_ARYREF: If you pass an arrarref to the insert method, it will
+be set as the invoicing list (see <A HREF="#invoicing_list">invoicing_list</A>).  Errors return as
+expected and rollback the entire transaction; it is not necessary to call 
+check_invoicing_list first.  Here's an example:</P>
+<PRE>
+  $new_cust_main-&gt;replace( $old_cust_main, [ $email, 'POST' ] );</PRE>
 <P></P>
 <DT><STRONG><A NAME="item_check">check</A></STRONG><BR>
 <DD>
@@ -194,14 +215,49 @@ Returns all packages (see <A HREF=".././FS/cust_pkg.html">the FS::cust_pkg manpa
 <DD>
 Returns all non-cancelled packages (see <A HREF=".././FS/cust_pkg.html">the FS::cust_pkg manpage</A>) for this customer.
 <P></P>
+<DT><STRONG><A NAME="item_suspended_pkgs">suspended_pkgs</A></STRONG><BR>
+<DD>
+Returns all suspended packages (see <A HREF=".././FS/cust_pkg.html">the FS::cust_pkg manpage</A>) for this customer.
+<P></P>
+<DT><STRONG><A NAME="item_unflagged_suspended_pkgs">unflagged_suspended_pkgs</A></STRONG><BR>
+<DD>
+Returns all unflagged suspended packages (see <A HREF=".././FS/cust_pkg.html">the FS::cust_pkg manpage</A>) for this
+customer (thouse packages without the `manual_flag' set).
+<P></P>
+<DT><STRONG><A NAME="item_unsuspended_pkgs">unsuspended_pkgs</A></STRONG><BR>
+<DD>
+Returns all unsuspended (and uncancelled) packages (see <A HREF=".././FS/cust_pkg.html">the FS::cust_pkg manpage</A>) for
+this customer.
+<P></P>
+<DT><STRONG><A NAME="item_unsuspend">unsuspend</A></STRONG><BR>
+<DD>
+Unsuspends all unflagged suspended packages (see <A HREF="#unflagged_suspended_pkgs">unflagged_suspended_pkgs</A>
+and <A HREF=".././FS/cust_pkg.html">the FS::cust_pkg manpage</A>) for this customer.  Always returns a list: an empty list
+on success or a list of errors.
+<P></P>
+<DT><STRONG><A NAME="item_suspend">suspend</A></STRONG><BR>
+<DD>
+Suspends all unsuspended packages (see <A HREF=".././FS/cust_pkg.html">the FS::cust_pkg manpage</A>) for this customer.
+Always returns a list: an empty list on success or a list of errors.
+<P></P>
+<DT><STRONG><A NAME="item_cancel">cancel</A></STRONG><BR>
+<DD>
+Cancels all uncancelled packages (see <A HREF=".././FS/cust_pkg.html">the FS::cust_pkg manpage</A>) for this customer.
+Always returns a list: an empty list on success or a list of errors.
+<P></P>
 <DT><STRONG><A NAME="item_bill">bill OPTIONS</A></STRONG><BR>
 <DD>
 Generates invoices (see <A HREF=".././FS/cust_bill.html">the FS::cust_bill manpage</A>) for this customer.  Usually used in
 conjunction with the collect method.
+<P>Options are passed as name-value pairs.</P>
 <P>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
 <EM>perlfunc/``time''</EM>).  Also see <A HREF="../Time/Local.html">the Time::Local manpage</A> and <A HREF="../Date/Parse.html">the Date::Parse manpage</A> for conversion
-functions.</P>
+functions.  For example:</P>
+<PRE>
+ use Date::Parse;
+ ...
+ $cust_main-&gt;bill( 'time' =&gt; str2time('April 20th, 2001') );</PRE>
 <P>If there is an error, returns the error, otherwise returns false.</P>
 <P></P>
 <DT><STRONG><A NAME="item_collect">collect OPTIONS</A></STRONG><BR>
@@ -211,28 +267,66 @@ functions.</P>
 <P>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').</P>
 <P>If there is an error, returns the error, otherwise returns false.</P>
+<P>Options are passed as name-value pairs.</P>
 <P>Currently available options are:</P>
 <P>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 <EM>perlfunc/``time''</EM>).  Also see <A HREF="../Time/Local.html">the Time::Local manpage</A> and <A HREF="../Date/Parse.html">the Date::Parse manpage</A>
 for conversion functions.</P>
-<P>batch_card - Set this true to batch cards (see <A HREF=".././FS/cust_pay_batch.html">the cust_pay_batch manpage</A>).  By
+<P>batch_card - Set this true to batch cards (see <A HREF=".././FS/cust_pay_batch.html">the FS::cust_pay_batch manpage</A>).  By
 default, cards are processed immediately, which will generate an error if
 CyberCash is not installed.</P>
 <P>report_badcard - Set this true if you want bad card transactions to
 return an error.  By default, they don't.</P>
+<P>force_print - force printing even if invoice has been printed more than once
+every 30 days, and don't increment the `printed' field.</P>
 <P></P>
 <DT><STRONG><A NAME="item_total_owed">total_owed</A></STRONG><BR>
 <DD>
 Returns the total owed for this customer on all invoices
-(see <A HREF=".././FS/cust_bill.html">the FS::cust_bill manpage</A>).
+(see <A HREF=".././FS/cust_bill.html#owed">owed in the FS::cust_bill manpage</A>).
+<P></P>
+<DT><STRONG><A NAME="item_total_owed_date_TIME">total_owed_date TIME</A></STRONG><BR>
+<DD>
+Returns the total owed for this customer on all invoices with date earlier than
+TIME.  TIME is specified as a UNIX timestamp; see <EM>perlfunc/``time''</EM>).  Also
+see <A HREF="../Time/Local.html">the Time::Local manpage</A> and <A HREF="../Date/Parse.html">the Date::Parse manpage</A> for conversion functions.
+<P></P>
+<DT><STRONG><A NAME="item_apply_credits">apply_credits</A></STRONG><BR>
+<DD>
+Applies (see <A HREF=".././FS/cust_credit_bill.html">the FS::cust_credit_bill manpage</A>) unapplied credits (see <A HREF=".././FS/cust_credit.html">the FS::cust_credit manpage</A>)
+to outstanding invoice balances in chronological order and returns the value
+of any remaining unapplied credits available for refund
+(see <A HREF=".././FS/cust_refund.html">the FS::cust_refund manpage</A>).
+<P></P>
+<DT><STRONG><A NAME="item_apply_payments">apply_payments</A></STRONG><BR>
+<DD>
+Applies (see <A HREF=".././FS/cust_bill_pay.html">the FS::cust_bill_pay manpage</A>) unapplied payments (see <A HREF=".././FS/cust_pay.html">the FS::cust_pay manpage</A>)
+to outstanding invoice balances in chronological order.
+<PRE>
+ #and returns the value of any remaining unapplied payments.</PRE>
 <P></P>
 <DT><STRONG><A NAME="item_total_credited">total_credited</A></STRONG><BR>
 <DD>
-Returns the total credits (see <A HREF=".././FS/cust_credit.html">the FS::cust_credit manpage</A>) for this customer.
+Returns the total outstanding credit (see <A HREF=".././FS/cust_credit.html">the FS::cust_credit manpage</A>) for this
+customer.  See <A HREF=".././FS/cust_credit.html#credited">credited in the FS::cust_credit manpage</A>.
+<P></P>
+<DT><STRONG><A NAME="item_total_unapplied_payments">total_unapplied_payments</A></STRONG><BR>
+<DD>
+Returns the total unapplied payments (see <A HREF=".././FS/cust_pay.html">the FS::cust_pay manpage</A>) for this customer.
+See <A HREF=".././FS/cust_pay.html#unapplied">unapplied in the FS::cust_pay manpage</A>.
 <P></P>
 <DT><STRONG><A NAME="item_balance">balance</A></STRONG><BR>
 <DD>
-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).
+<P></P>
+<DT><STRONG><A NAME="item_balance_date_TIME">balance_date TIME</A></STRONG><BR>
+<DD>
+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
+<EM>perlfunc/``time''</EM>).  Also see <A HREF="../Time/Local.html">the Time::Local manpage</A> and <A HREF="../Date/Parse.html">the Date::Parse manpage</A> for conversion
+functions.
 <P></P>
 <DT><STRONG><A NAME="item_invoicing_list_%5B_ARRAYREF_%5D">invoicing_list [ ARRAYREF ]</A></STRONG><BR>
 <DD>
@@ -248,11 +342,58 @@ check it without disturbing anything by passing nothing.</P>
 <DD>
 Checks these arguements as valid input for the invoicing_list method.  If there
 is an error, returns the error, otherwise returns false.
+<P></P>
+<DT><STRONG><A NAME="item_default_invoicing_list">default_invoicing_list</A></STRONG><BR>
+<DD>
+Sets the invoicing list to all accounts associated with this customer.
+<P></P>
+<DT><STRONG><A NAME="item_invoicing_list_addpost">invoicing_list_addpost</A></STRONG><BR>
+<DD>
+Adds postal invoicing to this customer.  If this customer is already configured
+to receive postal invoices, does nothing.
+<P></P>
+<DT><STRONG><A NAME="item_referral_cust_main_%5B_DEPTH_%5B_EXCLUDE_HASHREF_%">referral_cust_main [ DEPTH [ EXCLUDE_HASHREF ] ]</A></STRONG><BR>
+<DD>
+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).
+<P></P>
+<DT><STRONG><A NAME="item_referral_cust_pkg_%5B_DEPTH_%5D">referral_cust_pkg [ DEPTH ]</A></STRONG><BR>
+<DD>
+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).
+<P></P>
+<DT><STRONG><A NAME="item_credit">credit AMOUNT, REASON</A></STRONG><BR>
+<DD>
+Applies a credit to this customer.  If there is an error, returns the error,
+otherwise returns false.
+<P></P>
+<DT><STRONG><A NAME="item_charge">charge AMOUNT PKG COMMENT</A></STRONG><BR>
+<DD>
+Creates a one-time charge for this customer.  If there is an error, returns
+the error, otherwise returns false.
 <P></P></DL>
 <P>
 <HR>
+<H1><A NAME="subroutines">SUBROUTINES</A></H1>
+<DL>
+<DT><STRONG><A NAME="item_check_and_rebuild_fuzzyfiles">check_and_rebuild_fuzzyfiles</A></STRONG><BR>
+<DD>
+<DT><STRONG><A NAME="item_rebuild_fuzzyfiles">rebuild_fuzzyfiles</A></STRONG><BR>
+<DD>
+<DT><STRONG><A NAME="item_all_last">all_last</A></STRONG><BR>
+<DD>
+<DT><STRONG><A NAME="item_all_company">all_company</A></STRONG><BR>
+<DD>
+<DT><STRONG><A NAME="item_append_fuzzyfiles_LASTNAME_COMPANY">append_fuzzyfiles LASTNAME COMPANY</A></STRONG><BR>
+<DD>
+</DL>
+<P>
+<HR>
 <H1><A NAME="version">VERSION</A></H1>
-<P>$Id: cust_main.html,v 1.1 2001-07-30 07:36:03 ivan Exp $</P>
+<P>$Id: cust_main.html,v 1.2 2002-01-29 16:33:15 ivan Exp $</P>
 <P>
 <HR>
 <H1><A NAME="bugs">BUGS</A></H1>
@@ -264,7 +405,6 @@ list.</P>
 <P>CyberCash v2 forces us to define some variables in package main.</P>
 <P>There should probably be a configuration file with a list of allowed credit
 card types.</P>
-<P>CyberCash is the only processor.</P>
 <P>No multiple currency support (probably a larger project than just this module).</P>
 <P>
 <HR>
index 6ab7fa2..a7929a9 100644 (file)
@@ -100,7 +100,7 @@ Returns the literal email address for this record (or `POST').
 <P>
 <HR>
 <H1><A NAME="version">VERSION</A></H1>
-<P>$Id: cust_main_invoice.html,v 1.1 2001-07-30 07:36:03 ivan Exp $</P>
+<P>$Id: cust_main_invoice.html,v 1.3 2002-01-29 17:42:46 ivan Exp $</P>
 <P>
 <HR>
 <H1><A NAME="bugs">BUGS</A></H1>
index 8033762..ce057f0 100644 (file)
@@ -50,7 +50,7 @@ currently supported:</P>
 <DL>
 <DT><STRONG><A NAME="item_key">paynum - primary key (assigned automatically for new payments)</A></STRONG><BR>
 <DD>
-<DT><STRONG><A NAME="item_Invoice">invnum - Invoice (see <A HREF=".././FS/cust_bill.html">the FS::cust_bill manpage</A>)</A></STRONG><BR>
+<DT><STRONG><A NAME="item_customer">custnum - customer (see <A HREF=".././FS/cust_main.html">the FS::cust_main manpage</A>)</A></STRONG><BR>
 <DD>
 <DT><STRONG><A NAME="item_paid_%2D_Amount_of_this_payment">paid - Amount of this payment</A></STRONG><BR>
 <DD>
@@ -59,10 +59,12 @@ currently supported:</P>
 <DD>
 <DT><STRONG><A NAME="item_payby_%2D_%60CARD%27_%28credit_cards%29%2C_%60BILL">payby - `CARD' (credit cards), `BILL' (billing), or `COMP' (free)</A></STRONG><BR>
 <DD>
-<DT><STRONG><A NAME="item_issuer">payinfo - card number, P.O.#, or comp issuer (4-8 lowercase alphanumerics; think username)</A></STRONG><BR>
+<DT><STRONG><A NAME="item_issuer">payinfo - card number, check #, or comp issuer (4-8 lowercase alphanumerics; think username), respectively</A></STRONG><BR>
 <DD>
 <DT><STRONG><A NAME="item_paybatch_%2D_text_field_for_tracking_card_processi">paybatch - text field for tracking card processing</A></STRONG><BR>
 <DD>
+<DT><STRONG><A NAME="item_closed_%2D_books_closed_flag%2C_empty_or_%60Y%27">closed - books closed flag, empty or `Y'</A></STRONG><BR>
+<DD>
 </DL>
 <P>
 <HR>
@@ -74,8 +76,10 @@ Creates a new payment.  To add the payment to the databse, see <A HREF="#insert"
 <P></P>
 <DT><STRONG><A NAME="item_insert">insert</A></STRONG><BR>
 <DD>
-Adds this payment to the databse, and updates the invoice (see
-<A HREF=".././FS/cust_bill.html">the FS::cust_bill manpage</A>).
+Adds this payment to the database.
+<P>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.</P>
 <P></P>
 <DT><STRONG><A NAME="item_delete">delete</A></STRONG><BR>
 <DD>
@@ -89,11 +93,21 @@ Currently unimplemented (accounting reasons).
 <DD>
 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.
+<P></P>
+<DT><STRONG><A NAME="item_cust_bill_pay">cust_bill_pay</A></STRONG><BR>
+<DD>
+Returns all applications to invoices (see <A HREF=".././FS/cust_bill_pay.html">the FS::cust_bill_pay manpage</A>) for this
+payment.
+<P></P>
+<DT><STRONG><A NAME="item_unapplied">unapplied</A></STRONG><BR>
+<DD>
+Returns the amount of this payment that is still unapplied; which is
+paid minus all payment applications (see <A HREF=".././FS/cust_bill_pay.html">the FS::cust_bill_pay manpage</A>).
 <P></P></DL>
 <P>
 <HR>
 <H1><A NAME="version">VERSION</A></H1>
-<P>$Id: cust_pay.html,v 1.1 2001-07-30 07:36:03 ivan Exp $</P>
+<P>$Id: cust_pay.html,v 1.2 2002-01-29 16:33:15 ivan Exp $</P>
 <P>
 <HR>
 <H1><A NAME="bugs">BUGS</A></H1>
@@ -101,7 +115,8 @@ returns the error, otherwise returns false.  Called by the insert method.
 <P>
 <HR>
 <H1><A NAME="see also">SEE ALSO</A></H1>
-<P><A HREF=".././FS/Record.html">the FS::Record manpage</A>, <A HREF=".././FS/cust_bill.html">the FS::cust_bill manpage</A>, schema.html from the base documentation.</P>
+<P><A HREF=".././FS/cust_bill_pay.html">the FS::cust_bill_pay manpage</A>, <A HREF=".././FS/cust_bill.html">the FS::cust_bill manpage</A>, <A HREF=".././FS/Record.html">the FS::Record manpage</A>, schema.html from the
+base documentation.</P>
 
 </BODY>
 
index c1c73c3..052ccac 100644 (file)
@@ -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:</P>
 <DL>
-<DT><STRONG><A NAME="item_trancode_%2D_77_for_charges">trancode - 77 for charges</A></STRONG><BR>
+<DT><STRONG><A NAME="item_key">paybatchnum - primary key (automatically assigned)</A></STRONG><BR>
 <DD>
 <DT><STRONG><A NAME="item_cardnum">cardnum</A></STRONG><BR>
 <DD>
@@ -116,7 +116,7 @@ and repalce methods.
 <P>
 <HR>
 <H1><A NAME="version">VERSION</A></H1>
-<P>$Id: cust_pay_batch.html,v 1.1 2001-07-30 07:36:03 ivan Exp $</P>
+<P>$Id: cust_pay_batch.html,v 1.3 2002-01-29 17:42:46 ivan Exp $</P>
 <P>
 <HR>
 <H1><A NAME="bugs">BUGS</A></H1>
index 459d129..9f1005d 100644 (file)
@@ -53,6 +53,8 @@
 <PRE>
   @labels = $record-&gt;labels;</PRE>
 <PRE>
+  $seconds = $record-&gt;seconds_since($timestamp);</PRE>
+<PRE>
   $error = FS::cust_pkg::order( $custnum, \@pkgparts );
   $error = FS::cust_pkg::order( $custnum, \@pkgparts, \@remove_pkgnums ] );</PRE>
 <P>
@@ -79,6 +81,9 @@ inherits from FS::Record.  The following fields are currently supported:</P>
 <DD>
 <DT><STRONG><A NAME="item_taker">otaker - order taker (assigned automatically if null, see <A HREF=".././FS/UID.html">the FS::UID manpage</A>)</A></STRONG><BR>
 <DD>
+<DT><STRONG><A NAME="item_manual_flag_%2D_If_this_field_is_set_to_1%2C_disab">manual_flag - If this field is set to 1, disables the automatic
+unsuspension of this package when using the <STRONG>unsuspendauto</STRONG> config file.</A></STRONG><BR>
+<DD>
 </DL>
 <P>Note: setup, bill, susp, expire and cancel are specified as UNIX timestamps;
 see <EM>perlfunc/``time''</EM>.  Also see <A HREF="../Time/Local.html">the Time::Local manpage</A> and <A HREF="../Date/Parse.html">the Date::Parse manpage</A> for
@@ -95,26 +100,12 @@ Create a new billing item.  To add the item to the database, see <A HREF="#inser
 <DD>
 Adds this billing item to the database (``Orders'' the item).  If there is an
 error, returns the error, otherwise returns false.
-<P>sub insert {
-  my $self = shift;</P>
-<PRE>
-  # custnum might not have have been defined in sub check (for one-shot new
-  # customers), so check it here instead</PRE>
-<PRE>
-  my $error = $self-&gt;ut_number('custnum');
-  return $error if $error</PRE>
-<PRE>
-  return &quot;Unknown customer&quot;
-    unless qsearchs( 'cust_main', { 'custnum' =&gt; $self-&gt;custnum } );</PRE>
-<PRE>
-  $self-&gt;SUPER::insert;</PRE>
-<P>}</P>
 <P></P>
 <DT><STRONG><A NAME="item_delete">delete</A></STRONG><BR>
 <DD>
-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.
+<P>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.</P>
 <P></P>
 <DT><STRONG><A NAME="item_replace_OLD_RECORD">replace OLD_RECORD</A></STRONG><BR>
 <DD>
@@ -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
 <A HREF=".././FS/part_pkg.html">the FS::part_pkg manpage</A>).
 <P></P>
+<DT><STRONG><A NAME="item_cust_svc">cust_svc</A></STRONG><BR>
+<DD>
+Returns the services for this package, as FS::cust_svc objects (see
+<A HREF=".././FS/cust_svc.html">the FS::cust_svc manpage</A>)
+<P></P>
 <DT><STRONG><A NAME="item_labels">labels</A></STRONG><BR>
 <DD>
 Returns a list of lists, calling the label method for all services
 (see <A HREF=".././FS/cust_svc.html">the FS::cust_svc manpage</A>) of this billing item.
+<P></P>
+<DT><STRONG><A NAME="item_cust_main">cust_main</A></STRONG><BR>
+<DD>
+Returns the parent customer object (see <A HREF=".././FS/cust_main.html">the FS::cust_main manpage</A>).
+<P></P>
+<DT><STRONG><A NAME="item_seconds_since_TIMESTAMP">seconds_since TIMESTAMP</A></STRONG><BR>
+<DD>
+Returns the number of seconds all accounts (see <A HREF=".././FS/svc_acct.html">the FS::svc_acct manpage</A>) in this
+package have been online since TIMESTAMP.
+<P>TIMESTAMP is specified as a UNIX timestamp; see <EM>perlfunc/``time''</EM>.  Also see
+<A HREF="../Time/Local.html">the Time::Local manpage</A> and <A HREF="../Date/Parse.html">the Date::Parse manpage</A> for conversion functions.</P>
 <P></P></DL>
 <P>
 <HR>
 <H1><A NAME="subroutines">SUBROUTINES</A></H1>
 <DL>
-<DT><STRONG><A NAME="item_order_CUSTNUM%2C_PKGPARTS_ARYREF%2C_%5B_REMOVE_PKG">order CUSTNUM, PKGPARTS_ARYREF, [ REMOVE_PKGNUMS_ARYREF ]</A></STRONG><BR>
+<DT><STRONG><A NAME="item_order_CUSTNUM%2C_PKGPARTS_ARYREF%2C_%5B_REMOVE_PKG">order CUSTNUM, PKGPARTS_ARYREF, [ REMOVE_PKGNUMS_ARYREF [ RETURN_CUST_PKG_ARRAYREF ] ]</A></STRONG><BR>
 <DD>
 CUSTNUM is a customer (see <A HREF=".././FS/cust_main.html">the FS::cust_main manpage</A>)
 <P>PKGPARTS is a list of pkgparts specifying the the billing item definitions (see
@@ -176,12 +183,15 @@ permitted.</P>
 <P>REMOVE_PKGNUMS is an optional list of pkgnums specifying the billing items to
 remove for this customer.  The services (see <A HREF=".././FS/cust_svc.html">the FS::cust_svc manpage</A>) are moved to the
 new billing items.  An error is returned if this is not possible (see
-<A HREF=".././FS/pkg_svc.html">the FS::pkg_svc manpage</A>).</P>
+<A HREF=".././FS/pkg_svc.html">the FS::pkg_svc manpage</A>).  An empty arrayref is equivalent to not specifying this
+parameter.</P>
+<P>RETURN_CUST_PKG_ARRAYREF, if specified, will be filled in with the
+newly-created cust_pkg objects.</P>
 <P></P></DL>
 <P>
 <HR>
 <H1><A NAME="version">VERSION</A></H1>
-<P>$Id: cust_pkg.html,v 1.1 2001-07-30 07:36:03 ivan Exp $</P>
+<P>$Id: cust_pkg.html,v 1.2 2002-01-29 16:33:15 ivan Exp $</P>
 <P>
 <HR>
 <H1><A NAME="bugs">BUGS</A></H1>
@@ -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.</P>
+<P>Now that things are transactional should the check in the insert method be
+moved to check ?</P>
 <P>
 <HR>
 <H1><A NAME="see also">SEE ALSO</A></H1>
-<P><A HREF=".././FS/Record.html">the FS::Record manpage</A>, <A HREF=".././FS/cust_main.html">the FS::cust_main manpage</A>, <A HREF=".././FS/part_pkg.html">the FS::part_pkg manpage</A>, <A HREF=".././FS/cust_svc.html">the FS::cust_svc manpage</A>
-<A HREF=".././FS/pkg_svc.html">the FS::pkg_svc manpage</A>, schema.html from the base documentation</P>
+<P><A HREF=".././FS/Record.html">the FS::Record manpage</A>, <A HREF=".././FS/cust_main.html">the FS::cust_main manpage</A>, <A HREF=".././FS/part_pkg.html">the FS::part_pkg manpage</A>, <A HREF=".././FS/cust_svc.html">the FS::cust_svc manpage</A>,
+<A HREF=".././FS/pkg_svc.html">the FS::pkg_svc manpage</A>, schema.html from the base documentation</P>
 
 </BODY>
 
index 39ed14d..93bb07b 100644 (file)
@@ -50,7 +50,7 @@ inherits from FS::Record.  The following fields are currently supported:</P>
 <DL>
 <DT><STRONG><A NAME="item_key">refundnum - primary key (assigned automatically for new refunds)</A></STRONG><BR>
 <DD>
-<DT><STRONG><A NAME="item_Credit">crednum - Credit (see <A HREF=".././FS/cust_credit.html">the FS::cust_credit manpage</A>)</A></STRONG><BR>
+<DT><STRONG><A NAME="item_customer">custnum - customer (see <A HREF=".././FS/cust_main.html">the FS::cust_main manpage</A>)</A></STRONG><BR>
 <DD>
 <DT><STRONG><A NAME="item_refund_%2D_Amount_of_the_refund">refund - Amount of the refund</A></STRONG><BR>
 <DD>
@@ -61,8 +61,12 @@ inherits from FS::Record.  The following fields are currently supported:</P>
 <DD>
 <DT><STRONG><A NAME="item_issuer">payinfo - card number, P.O.#, or comp issuer (4-8 lowercase alphanumerics; think username)</A></STRONG><BR>
 <DD>
+<DT><STRONG><A NAME="item_paybatch_%2D_text_field_for_tracking_card_processi">paybatch - text field for tracking card processing</A></STRONG><BR>
+<DD>
 <DT><STRONG><A NAME="item_taker">otaker - order taker (assigned automatically, see <A HREF=".././FS/UID.html">the FS::UID manpage</A>)</A></STRONG><BR>
 <DD>
+<DT><STRONG><A NAME="item_closed_%2D_books_closed_flag%2C_empty_or_%60Y%27">closed - books closed flag, empty or `Y'</A></STRONG><BR>
+<DD>
 </DL>
 <P>
 <HR>
@@ -74,8 +78,10 @@ Creates a new refund.  To add the refund to the database, see <A HREF="#insert">
 <P></P>
 <DT><STRONG><A NAME="item_insert">insert</A></STRONG><BR>
 <DD>
-Adds this refund to the database, and updates the credit (see
-<A HREF=".././FS/cust_credit.html">the FS::cust_credit manpage</A>).
+Adds this refund to the database.
+<P>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.</P>
 <P></P>
 <DT><STRONG><A NAME="item_delete">delete</A></STRONG><BR>
 <DD>
@@ -93,7 +99,7 @@ returns the error, otherwise returns false.  Called by the insert method.
 <P>
 <HR>
 <H1><A NAME="version">VERSION</A></H1>
-<P>$Id: cust_refund.html,v 1.1 2001-07-30 07:36:03 ivan Exp $</P>
+<P>$Id: cust_refund.html,v 1.3 2002-01-29 17:42:46 ivan Exp $</P>
 <P>
 <HR>
 <H1><A NAME="bugs">BUGS</A></H1>
index c1ca2d7..97a299c 100644 (file)
@@ -64,7 +64,7 @@ The following fields are currently supported:</P>
 <DD>
 Creates a new service.  To add the refund to the database, see <A HREF="#insert">insert</A>.
 Services are normally created by creating FS::svc_ objects (see
-<A HREF=".././FS/svc_acct.html">the FS::svc_acct manpage</A>, <A HREF=".././FS/svc_domain.html">the FS::svc_domain manpage</A>, and <A HREF=".././FS/svc_acct_sm.html">the FS::svc_acct_sm manpage</A>, among others).
+<A HREF=".././FS/svc_acct.html">the FS::svc_acct manpage</A>, <A HREF=".././FS/svc_domain.html">the FS::svc_domain manpage</A>, and <A HREF=".././FS/svc_forward.html">the FS::svc_forward manpage</A>, among others).
 <P></P>
 <DT><STRONG><A NAME="item_insert">insert</A></STRONG><BR>
 <DD>
@@ -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.
 <P></P>
+<DT><STRONG><A NAME="item_part_svc">part_svc</A></STRONG><BR>
+<DD>
+Returns the definition for this service, as a FS::part_svc object (see
+<A HREF=".././FS/part_svc.html">the FS::part_svc manpage</A>).
+<P></P>
+<DT><STRONG><A NAME="item_cust_pkg">cust_pkg</A></STRONG><BR>
+<DD>
+Returns the definition for this service, as a FS::part_svc object (see
+<A HREF=".././FS/part_svc.html">the FS::part_svc manpage</A>).
+<P></P>
 <DT><STRONG><A NAME="item_label">label</A></STRONG><BR>
 <DD>
 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
+<P></P>
+<DT><STRONG><A NAME="item_svc_x">svc_x</A></STRONG><BR>
+<DD>
+Returns the FS::svc_XXX object for this service (i.e. an FS::svc_acct object or
+FS::svc_domain object, etc.)
+<P></P>
+<DT><STRONG><A NAME="item_seconds_since_TIMESTAMP">seconds_since TIMESTAMP</A></STRONG><BR>
+<DD>
+See <A HREF=".././FS/svc_acct.html#seconds_since">seconds_since in the FS::svc_acct manpage</A>.  Equivalent to
+$cust_svc-&gt;svc_x-&gt;seconds_since, but more efficient.  Meaningless for records
+where <STRONG>svcdb</STRONG> is not ``svc_acct''.
 <P></P></DL>
 <P>
 <HR>
 <H1><A NAME="version">VERSION</A></H1>
-<P>$Id: cust_svc.html,v 1.1 2001-07-30 07:36:03 ivan Exp $</P>
+<P>$Id: cust_svc.html,v 1.2 2002-01-29 16:33:16 ivan Exp $</P>
 <P>
 <HR>
 <H1><A NAME="bugs">BUGS</A></H1>
index 7a1bf3e..0349f7b 100644 (file)
@@ -18,7 +18,6 @@
        <LI><A HREF="#version">VERSION</A></LI>
        <LI><A HREF="#bugs">BUGS</A></LI>
        <LI><A HREF="#see also">SEE ALSO</A></LI>
-       <LI><A HREF="#history">HISTORY</A></LI>
 </UL>
 <!-- INDEX END -->
 
@@ -95,7 +94,7 @@ and replace methods.
 <P>
 <HR>
 <H1><A NAME="version">VERSION</A></H1>
-<P>$Id: domain_record.html,v 1.1 2001-07-30 07:36:03 ivan Exp $</P>
+<P>$Id: domain_record.html,v 1.3 2002-01-29 17:42:46 ivan Exp $</P>
 <P>
 <HR>
 <H1><A NAME="bugs">BUGS</A></H1>
@@ -107,17 +106,6 @@ course, it's still better than editing the zone files directly.  :)</P>
 <HR>
 <H1><A NAME="see also">SEE ALSO</A></H1>
 <P><A HREF=".././FS/Record.html">the FS::Record manpage</A>, schema.html from the base documentation.</P>
-<P>
-<HR>
-<H1><A NAME="history">HISTORY</A></H1>
-<P>$Log: domain_record.html,v $
-<P>Revision 1.1  2001-07-30 07:36:03  ivan
-<P>templates!!!
-<P>
-Revision 1.2  2001/05/18 14:08:55  ivan
-tyop</P>
-<P>Revision 1.1  2000/02/03 05:16:52  ivan
-beginning of DNS and Apache support</P>
 
 </BODY>
 
index 9aeaa3d..e1e96b5 100644 (file)
@@ -60,11 +60,21 @@ inherits from FS::Record.  The following fields are currently supported:</P>
 <DD>
 <DT><STRONG>comment - Text name of this billing item definition (non-customer-viewable)</STRONG><BR>
 <DD>
-<DT><STRONG><A NAME="item_setup_%2D_Setup_fee">setup - Setup fee</A></STRONG><BR>
+<DT><STRONG><A NAME="item_setup_%2D_Setup_fee_expression">setup - Setup fee expression</A></STRONG><BR>
 <DD>
 <DT><STRONG><A NAME="item_freq_%2D_Frequency_of_recurring_fee">freq - Frequency of recurring fee</A></STRONG><BR>
 <DD>
-<DT><STRONG><A NAME="item_recur_%2D_Recurring_fee">recur - Recurring fee</A></STRONG><BR>
+<DT><STRONG><A NAME="item_recur_%2D_Recurring_fee_expression">recur - Recurring fee expression</A></STRONG><BR>
+<DD>
+<DT><STRONG><A NAME="item_setuptax_%2D_Setup_fee_tax_exempt_flag%2C_empty_or">setuptax - Setup fee tax exempt flag, empty or `Y'</A></STRONG><BR>
+<DD>
+<DT><STRONG><A NAME="item_recurtax_%2D_Recurring_fee_tax_exempt_flag%2C_empt">recurtax - Recurring fee tax exempt flag, empty or `Y'</A></STRONG><BR>
+<DD>
+<DT><STRONG><A NAME="item_plan_%2D_Price_plan">plan - Price plan</A></STRONG><BR>
+<DD>
+<DT><STRONG><A NAME="item_plandata_%2D_Price_plan_data">plandata - Price plan data</A></STRONG><BR>
+<DD>
+<DT><STRONG><A NAME="item_disabled_%2D_Disabled_flag%2C_empty_or_%60Y%27">disabled - Disabled flag, empty or `Y'</A></STRONG><BR>
 <DD>
 </DL>
 <P>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,
 <P>
 <HR>
 <H1><A NAME="version">VERSION</A></H1>
-<P>$Id: part_pkg.html,v 1.1 2001-07-30 07:36:03 ivan Exp $</P>
+<P>$Id: part_pkg.html,v 1.3 2002-01-29 17:42:46 ivan Exp $</P>
 <P>
 <HR>
 <H1><A NAME="bugs">BUGS</A></H1>
index ca0a5dc..0f5126f 100644 (file)
@@ -31,8 +31,8 @@
 <PRE>
   use FS::part_svc;</PRE>
 <PRE>
-  $record = new FS::part_referral \%hash
-  $record = new FS::part_referral { 'column' =&gt; 'value' };</PRE>
+  $record = new FS::part_svc \%hash
+  $record = new FS::part_svc { 'column' =&gt; 'value' };</PRE>
 <PRE>
   $error = $record-&gt;insert;</PRE>
 <PRE>
@@ -52,11 +52,9 @@ FS::Record.  The following fields are currently supported:</P>
 <DT><STRONG><A NAME="item_svc_%2D_text_name_of_this_service_definition">svc - text name of this service definition</A></STRONG><BR>
 <DD>
 <DT><STRONG><A NAME="item_svcdb_%2D_table_used_for_this_service%2E_See_FS%3A">svcdb - table used for this service.  See <A HREF=".././FS/svc_acct.html">the FS::svc_acct manpage</A>,
-<A HREF=".././FS/svc_domain.html">the FS::svc_domain manpage</A>, and <A HREF=".././FS/svc_acct_sm.html">the FS::svc_acct_sm manpage</A>, among others.</A></STRONG><BR>
+<A HREF=".././FS/svc_domain.html">the FS::svc_domain manpage</A>, and <A HREF=".././FS/svc_forward.html">the FS::svc_forward manpage</A>, among others.</A></STRONG><BR>
 <DD>
-<DT><STRONG><A NAME="item_svcdb__field_%2D_Default_or_fixed_value_for_field_"><EM>svcdb</EM>__<EM>field</EM> - Default or fixed value for <EM>field</EM> in <EM>svcdb</EM>.</A></STRONG><BR>
-<DD>
-<DT><STRONG><A NAME="item_svcdb__field_flag_%2D_defines_svcdb__field_action%"><EM>svcdb</EM>__<EM>field</EM>_flag - defines <EM>svcdb</EM>__<EM>field</EM> action: null, `D' for default, or `F' for fixed</A></STRONG><BR>
+<DT><STRONG><A NAME="item_disabled_%2D_Disabled_flag%2C_empty_or_%60Y%27">disabled - Disabled flag, empty or `Y'</A></STRONG><BR>
 <DD>
 </DL>
 <P>
@@ -73,6 +71,10 @@ database, see <A HREF="#insert">insert</A>.
 Adds this service definition to the database.  If there is an error, returns
 the error, otherwise returns false.
 <P></P>
+<DT><STRONG><A NAME="item_svcdb__field_%2D_Default_or_fixed_value_for_field_"><EM>svcdb</EM>__<EM>field</EM> - Default or fixed value for <EM>field</EM> in <EM>svcdb</EM>.</A></STRONG><BR>
+<DD>
+<DT><STRONG><A NAME="item_svcdb__field_flag_%2D_defines_svcdb__field_action%"><EM>svcdb</EM>__<EM>field</EM>_flag - defines <EM>svcdb</EM>__<EM>field</EM> action: null, `D' for default, or `F' for fixed</A></STRONG><BR>
+<DD>
 <DT><STRONG><A NAME="item_delete">delete</A></STRONG><BR>
 <DD>
 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.
-<P></P></DL>
+<P></P>
+<DT><STRONG><A NAME="item_part_svc_column_COLUMNNAME">part_svc_column COLUMNNAME</A></STRONG><BR>
+<DD>
+Returns the part_svc_column object (see <A HREF=".././FS/part_svc_column.html">the FS::part_svc_column manpage</A>) for the given
+COLUMNNAME, or a new part_svc_column object if none exists.
+<P></P>
+<DT><STRONG><A NAME="item_all_part_svc_column">all_part_svc_column</A></STRONG><BR>
+<DD>
+</DL>
 <P>
 <HR>
 <H1><A NAME="version">VERSION</A></H1>
-<P>$Id: part_svc.html,v 1.1 2001-07-30 07:36:03 ivan Exp $</P>
+<P>$Id: part_svc.html,v 1.3 2002-01-29 17:42:46 ivan Exp $</P>
 <P>
 <HR>
 <H1><A NAME="bugs">BUGS</A></H1>
@@ -101,9 +111,9 @@ should be fixed.</P>
 <P>
 <HR>
 <H1><A NAME="see also">SEE ALSO</A></H1>
-<P><A HREF=".././FS/Record.html">the FS::Record manpage</A>, <A HREF=".././FS/part_pkg.html">the FS::part_pkg manpage</A>, <A HREF=".././FS/pkg_svc.html">the FS::pkg_svc manpage</A>, <A HREF=".././FS/cust_svc.html">the FS::cust_svc manpage</A>,
-<A HREF=".././FS/svc_acct.html">the FS::svc_acct manpage</A>, <A HREF=".././FS/svc_acct_sm.html">the FS::svc_acct_sm manpage</A>, <A HREF=".././FS/svc_domain.html">the FS::svc_domain manpage</A>, schema.html from the
-base documentation.</P>
+<P><A HREF=".././FS/Record.html">the FS::Record manpage</A>, <A HREF=".././FS/part_svc_column.html">the FS::part_svc_column manpage</A>, <A HREF=".././FS/part_pkg.html">the FS::part_pkg manpage</A>, <A HREF=".././FS/pkg_svc.html">the FS::pkg_svc manpage</A>,
+<A HREF=".././FS/cust_svc.html">the FS::cust_svc manpage</A>, <A HREF=".././FS/svc_acct.html">the FS::svc_acct manpage</A>, <A HREF=".././FS/svc_forward.html">the FS::svc_forward manpage</A>, <A HREF=".././FS/svc_domain.html">the FS::svc_domain manpage</A>,
+schema.html from the base documentation.</P>
 
 </BODY>
 
index 4e77897..bb0c281 100644 (file)
@@ -18,7 +18,6 @@
        <LI><A HREF="#version">VERSION</A></LI>
        <LI><A HREF="#bugs">BUGS</A></LI>
        <LI><A HREF="#see also">SEE ALSO</A></LI>
-       <LI><A HREF="#history">HISTORY</A></LI>
 </UL>
 <!-- INDEX END -->
 
@@ -93,7 +92,7 @@ and replace methods.
 <P>
 <HR>
 <H1><A NAME="version">VERSION</A></H1>
-<P>$Id: prepay_credit.html,v 1.1 2001-07-30 07:36:03 ivan Exp $</P>
+<P>$Id: prepay_credit.html,v 1.3 2002-01-29 17:42:46 ivan Exp $</P>
 <P>
 <HR>
 <H1><A NAME="bugs">BUGS</A></H1>
@@ -101,17 +100,6 @@ and replace methods.
 <HR>
 <H1><A NAME="see also">SEE ALSO</A></H1>
 <P><A HREF=".././FS/Record.html">the FS::Record manpage</A>, schema.html from the base documentation.</P>
-<P>
-<HR>
-<H1><A NAME="history">HISTORY</A></H1>
-<P>$Log: prepay_credit.html,v $
-<P>Revision 1.1  2001-07-30 07:36:03  ivan
-<P>templates!!!
-<P>
-Revision 1.2  2000/02/02 20:22:18  ivan
-bugfix prepayment in signup server</P>
-<P>Revision 1.1  2000/01/31 05:22:23  ivan
-prepaid ``internet cards''</P>
 
 </BODY>
 
index 100aee8..ccac5ef 100644 (file)
@@ -64,6 +64,11 @@ Sets all fields to their defaults (see <A HREF=".././FS/part_svc.html">the FS::p
 current values.  If there is an error, returns the error, otherwise returns
 the FS::part_svc object (use <CODE>ref()</CODE> to test the return).
 <P></P>
+<DT><STRONG><A NAME="item_cust_svc">cust_svc</A></STRONG><BR>
+<DD>
+Returns the cust_svc record associated with this svc_ record, as a FS::cust_svc
+object (see <A HREF=".././FS/cust_svc.html">the FS::cust_svc manpage</A>).
+<P></P>
 <DT><STRONG><A NAME="item_suspend">suspend</A></STRONG><BR>
 <DD>
 <DT><STRONG><A NAME="item_unsuspend">unsuspend</A></STRONG><BR>
@@ -76,13 +81,11 @@ methods.  Called by the cancel method of FS::cust_pkg (see <A HREF=".././FS/cust
 <P>
 <HR>
 <H1><A NAME="version">VERSION</A></H1>
-<P>$Id: svc_Common.html,v 1.1 2001-07-30 07:36:03 ivan Exp $</P>
+<P>$Id: svc_Common.html,v 1.3 2002-01-29 17:42:46 ivan Exp $</P>
 <P>
 <HR>
 <H1><A NAME="bugs">BUGS</A></H1>
 <P>The setfixed method return value.</P>
-<P>The new method should set defaults from part_svc (like the check method
-sets fixed values)?</P>
 <P>
 <HR>
 <H1><A NAME="see also">SEE ALSO</A></H1>
index 81bc118..9c41db3 100644 (file)
   $error = $record-&gt;cancel;</PRE>
 <PRE>
   %hash = $record-&gt;radius;</PRE>
+<PRE>
+  %hash = $record-&gt;radius_reply;</PRE>
+<PRE>
+  %hash = $record-&gt;radius_check;</PRE>
+<PRE>
+  $domain = $record-&gt;domain;</PRE>
+<PRE>
+  $svc_domain = $record-&gt;svc_domain;</PRE>
+<PRE>
+  $email = $record-&gt;email;</PRE>
+<PRE>
+  $seconds_since = $record-&gt;seconds_since($timestamp);</PRE>
 <P>
 <HR>
 <H1><A NAME="description">DESCRIPTION</A></H1>
@@ -77,8 +89,14 @@ FS::svc_Common.  The following fields are currently supported:</P>
 <DD>
 <DT><STRONG><A NAME="item_slipip_%2D_IP_address">slipip - IP address</A></STRONG><BR>
 <DD>
+<DT><STRONG><A NAME="item_seconds_%2D">seconds -</A></STRONG><BR>
+<DD>
+<DT><STRONG><A NAME="item_domsvc_%2D_svcnum_from_svc_domain">domsvc - svcnum from svc_domain</A></STRONG><BR>
+<DD>
 <DT><STRONG><A NAME="item_radius_Radius_Attribute_%2D_Radius%2DAttribute">radius_<EM>Radius_Attribute</EM> - <EM>Radius-Attribute</EM></A></STRONG><BR>
 <DD>
+<DT><STRONG><A NAME="item_domsvc_%2D_service_number_of_svc_domain_with_which">domsvc - service number of svc_domain with which to associate</A></STRONG><BR>
+<DD>
 </DL>
 <P>
 <HR>
@@ -96,7 +114,8 @@ otherwise returns false.
 defined.  An FS::cust_svc record will be created and inserted.</P>
 <P>If the configuration value (see <A HREF=".././FS/Conf.html">the FS::Conf manpage</A>) shellmachine exists, and the 
 username, uid, and dir fields are defined, the <CODE>command(s)</CODE> specified in
-the shellmachine-useradd configuration are exectued on shellmachine via ssh.
+the shellmachine-useradd configuration are added to the job queue (see
+<A HREF=".././FS/queue.html">the FS::queue manpage</A> and <A HREF=".././bin/freeside-queued.html">the freeside-queued manpage</A>) 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,</P>
 <PRE>
@@ -108,6 +127,7 @@ it empty,</P>
 <P>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.</P>
+<P>(TODOC: cyrus config file, <A HREF=".././FS/queue.html">the FS::queue manpage</A> and <A HREF=".././bin/freeside-queued.html">the freeside-queued manpage</A>)</P>
 <P></P>
 <DT><STRONG><A NAME="item_delete">delete</A></STRONG><BR>
 <DD>
@@ -116,7 +136,8 @@ error, otherwise returns false.
 <P>The corresponding FS::cust_svc record will be deleted as well.</P>
 <P>If the configuration value (see <A HREF=".././FS/Conf.html">the FS::Conf manpage</A>) shellmachine exists, the
 <CODE>command(s)</CODE> 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 <A HREF=".././FS/queue.html">the FS::queue manpage</A> and <A HREF=".././bin/freeside-queued.html">the freeside-queued manpage</A>) 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,</P>
 <PRE>
@@ -128,6 +149,7 @@ is empty,</P>
 <P>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.</P>
+<P>(TODOC: cyrus config file)</P>
 <P></P>
 <DT><STRONG><A NAME="item_replace_OLD_RECORD">replace OLD_RECORD</A></STRONG><BR>
 <DD>
@@ -135,9 +157,10 @@ Replaces OLD_RECORD with this one in the database.  If there is an error,
 returns the error, otherwise returns false.
 <P>If the configuration value (see <A HREF=".././FS/Conf.html">the FS::Conf manpage</A>) shellmachine exists, and the 
 dir field has changed, the <CODE>command(s)</CODE> 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 <A HREF=".././FS/queue.html">the FS::queue manpage</A> and
+<A HREF=".././bin/freeside-queued.html">the freeside-queued manpage</A>) 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, :</P>
+shellmachine-userdel configuration file does not exist or is empty,</P>
 <PRE>
   [ -d $old_dir ] &amp;&amp; mv $old_dir $new_dir || (
     chmod u+t $old_dir;
@@ -148,8 +171,8 @@ shellmachine-userdel configuration file does not exist or is empty, :</P>
     chown -R $uid.$gid $new_dir;
     rm -rf $old_dir
   )</PRE>
-<P>is executed on shellmachine via ssh.  This behaviour can be surpressed by
-setting $FS::svc_acct::nossh_hack true.</P>
+<P>is the default.  This behaviour can be surpressed by setting
+$FS::svc_acct::nossh_hack true.</P>
 <P></P>
 <DT><STRONG><A NAME="item_suspend">suspend</A></STRONG><BR>
 <DD>
@@ -193,11 +216,42 @@ Returns key/value pairs, suitable for assigning to a hash, for any RADIUS
 check attributes of this record.
 <P>Accessing RADIUS attributes directly is not supported and will break in the
 future.</P>
-<P></P></DL>
+<P></P>
+<DT><STRONG><A NAME="item_domain">domain</A></STRONG><BR>
+<DD>
+Returns the domain associated with this account.
+<P></P>
+<DT><STRONG><A NAME="item_svc_domain">svc_domain</A></STRONG><BR>
+<DD>
+Returns the FS::svc_domain record for this account's domain (see
+<A HREF=".././FS/svc_domain.html">the FS::svc_domain manpage</A>.
+<P></P>
+<DT><STRONG><A NAME="item_cust_svc">cust_svc</A></STRONG><BR>
+<DD>
+Returns the FS::cust_svc record for this account (see <A HREF=".././FS/cust_svc.html">the FS::cust_svc manpage</A>).
+<P>sub cust_svc {
+  my $self = shift;
+  qsearchs( 'cust_svc', { 'svcnum' =&gt; $self-&gt;svcnum } );
+}</P>
+<P></P>
+<DT><STRONG><A NAME="item_email">email</A></STRONG><BR>
+<DD>
+Returns an email address associated with the account.
+<P></P>
+<DT><STRONG><A NAME="item_seconds_since_TIMESTAMP">seconds_since TIMESTAMP</A></STRONG><BR>
+<DD>
+Returns the number of seconds this account has been online since TIMESTAMP.
+See <A HREF=".././FS/session.html">the FS::session manpage</A>
+<P>TIMESTAMP is specified as a UNIX timestamp; see <EM>perlfunc/``time''</EM>.  Also see
+<A HREF="../Time/Local.html">the Time::Local manpage</A> and <A HREF="../Date/Parse.html">the Date::Parse manpage</A> for conversion functions.</P>
+<P></P>
+<DT><STRONG><A NAME="item_ssh">ssh</A></STRONG><BR>
+<DD>
+</DL>
 <P>
 <HR>
 <H1><A NAME="version">VERSION</A></H1>
-<P>$Id: svc_acct.html,v 1.1 2001-07-30 07:36:03 ivan Exp $</P>
+<P>$Id: svc_acct.html,v 1.2 2002-01-29 16:33:16 ivan Exp $</P>
 <P>
 <HR>
 <H1><A NAME="bugs">BUGS</A></H1>
@@ -210,8 +264,10 @@ counterintuitive.</P>
 <P>
 <HR>
 <H1><A NAME="see also">SEE ALSO</A></H1>
-<P><A HREF=".././FS/svc_Common.html">the FS::svc_Common manpage</A>, <A HREF=".././FS/Record.html">the FS::Record manpage</A>, <A HREF=".././FS/Conf.html">the FS::Conf manpage</A>, <A HREF=".././FS/cust_svc.html">the FS::cust_svc manpage</A>,
-<A HREF=".././FS/part_svc.html">the FS::part_svc manpage</A>, <A HREF=".././FS/cust_pkg.html">the FS::cust_pkg manpage</A>, <A HREF="../Net/SSH.html">the Net::SSH manpage</A>, <EM>ssh</EM>, <A HREF=".././FS/svc_acct_pop.html">the FS::svc_acct_pop manpage</A>,
+<P><A HREF=".././FS/svc_Common.html">the FS::svc_Common manpage</A>, edit/part_svc.cgi from an installed web interface,
+export.html from the base documentation, <A HREF=".././FS/Record.html">the FS::Record manpage</A>, <A HREF=".././FS/Conf.html">the FS::Conf manpage</A>,
+<A HREF=".././FS/cust_svc.html">the FS::cust_svc manpage</A>, <A HREF=".././FS/part_svc.html">the FS::part_svc manpage</A>, <A HREF=".././FS/cust_pkg.html">the FS::cust_pkg manpage</A>, <A HREF=".././FS/queue.html">the FS::queue manpage</A>,
+<A HREF=".././bin/freeside-queued.html">the freeside-queued manpage</A>), <A HREF="../Net/SSH.html">the Net::SSH manpage</A>, <A HREF="#item_ssh">ssh</A>, <A HREF=".././FS/svc_acct_pop.html">the FS::svc_acct_pop manpage</A>,
 schema.html from the base documentation.</P>
 
 </BODY>
index d65ca57..8090062 100644 (file)
@@ -15,6 +15,7 @@
        <LI><A HREF="#synopsis">SYNOPSIS</A></LI>
        <LI><A HREF="#description">DESCRIPTION</A></LI>
        <LI><A HREF="#methods">METHODS</A></LI>
+       <LI><A HREF="#subroutines">SUBROUTINES</A></LI>
        <LI><A HREF="#version">VERSION</A></LI>
        <LI><A HREF="#bugs">BUGS</A></LI>
        <LI><A HREF="#see also">SEE ALSO</A></LI>
@@ -41,6 +42,8 @@
   $error = $record-&gt;delete;</PRE>
 <PRE>
   $error = $record-&gt;check;</PRE>
+<PRE>
+  $html = FS::svc_acct_pop::popselector( $popnum, $state );</PRE>
 <P>
 <HR>
 <H1><A NAME="description">DESCRIPTION</A></H1>
@@ -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.
+<P></P>
+<DT><STRONG><A NAME="item_text">text</A></STRONG><BR>
+<DD>
+Returns:
+<P>``$city, $state ($ac)/$exch''</P>
 <P></P></DL>
 <P>
 <HR>
+<H1><A NAME="subroutines">SUBROUTINES</A></H1>
+<DL>
+<DT><STRONG><A NAME="item_popselector_%5B_POPNUM_%5B_STATE_%5D_%5D">popselector [ POPNUM [ STATE ] ]</A></STRONG><BR>
+<DD>
+</DL>
+<P>
+<HR>
 <H1><A NAME="version">VERSION</A></H1>
-<P>$Id: svc_acct_pop.html,v 1.1 2001-07-30 07:36:03 ivan Exp $</P>
+<P>$Id: svc_acct_pop.html,v 1.3 2002-01-29 17:42:46 ivan Exp $</P>
 <P>
 <HR>
 <H1><A NAME="bugs">BUGS</A></H1>
 <P>It should be renamed to part_pop.</P>
+<P>popselector?  putting web ui components in here?  they should probably live
+somewhere else...</P>
 <P>
 <HR>
 <H1><A NAME="see also">SEE ALSO</A></H1>
-<P><A HREF=".././FS/Record.html">the FS::Record manpage</A>, <A HREF=".././FS/svc_acct.html">the svc_acct manpage</A>, schema.html from the base documentation.</P>
+<P><A HREF=".././FS/Record.html">the FS::Record manpage</A>, <A HREF=".././FS/svc_acct.html">the FS::svc_acct manpage</A>, <A HREF=".././FS/part_pop_local.html">the FS::part_pop_local manpage</A>, schema.html from the
+base documentation.</P>
 
 </BODY>
 
index ca50e72..86c7b8b 100644 (file)
@@ -13,6 +13,7 @@
 
        <LI><A HREF="#name">NAME</A></LI>
        <LI><A HREF="#synopsis">SYNOPSIS</A></LI>
+       <LI><A HREF="#warning">WARNING</A></LI>
        <LI><A HREF="#description">DESCRIPTION</A></LI>
        <LI><A HREF="#methods">METHODS</A></LI>
        <LI><A HREF="#version">VERSION</A></LI>
   $error = $record-&gt;cancel;</PRE>
 <P>
 <HR>
+<H1><A NAME="warning">WARNING</A></H1>
+<P>FS::svc_acct_sm is <STRONG>depreciated</STRONG>.  This class is only included for migration
+purposes.  See <A HREF=".././FS/svc_forward.html">the FS::svc_forward manpage</A>.</P>
+<P>
+<HR>
 <H1><A NAME="description">DESCRIPTION</A></H1>
-<P>An FS::svc_acct object represents a virtual mail alias.  FS::svc_acct inherits
-from FS::Record.  The following fields are currently supported:</P>
+<P>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:</P>
 <DL>
 <DT><STRONG><A NAME="item_key">svcnum - primary key (assigned automatcially for new accounts)</A></STRONG><BR>
 <DD>
@@ -77,15 +83,17 @@ Adds this virtual mail alias to the database.  If there is an error, returns
 the error, otherwise returns false.
 <P>The additional fields pkgnum and svcpart (see <A HREF=".././FS/cust_svc.html">the FS::cust_svc manpage</A>) should be 
 defined.  An FS::cust_svc record will be created and inserted.</P>
-<P>If the configuration values (see <A HREF=".././FS/Conf.html">the FS::Conf manpage</A>) shellmachine and qmailmachines
-exist, and domuser is `*' (meaning a catch-all mailbox), the command:</P>
 <PRE>
-  [ -e $dir/.qmail-$qdomain-default ] || {
-    touch $dir/.qmail-$qdomain-default;
-    chown $uid:$gid $dir/.qmail-$qdomain-default;
-  }</PRE>
-<P>is executed on shellmachine via ssh (see <EM>dot-qmail/``EXTENSION ADDRESSES''</EM>).
-This behaviour can be surpressed by setting $FS::svc_acct_sm::nossh_hack true.</P>
+ #If the configuration values (see L&lt;FS::Conf&gt;) 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&lt;dot-qmail/&quot;EXTENSION ADDRESSES&quot;&gt;).
+ #This behaviour can be surpressed by setting $FS::svc_acct_sm::nossh_hack true.</PRE>
 <P></P>
 <DT><STRONG><A NAME="item_delete">delete</A></STRONG><BR>
 <DD>
@@ -123,7 +131,7 @@ replace methods.
 <P>
 <HR>
 <H1><A NAME="version">VERSION</A></H1>
-<P>$Id: svc_acct_sm.html,v 1.1 2001-07-30 07:36:03 ivan Exp $</P>
+<P>$Id: svc_acct_sm.html,v 1.3 2002-01-29 17:42:46 ivan Exp $</P>
 <P>
 <HR>
 <H1><A NAME="bugs">BUGS</A></H1>
@@ -132,6 +140,7 @@ replace methods.
 <P>
 <HR>
 <H1><A NAME="see also">SEE ALSO</A></H1>
+<P><A HREF=".././FS/svc_forward.html">the FS::svc_forward manpage</A></P>
 <P><A HREF=".././FS/Record.html">the FS::Record manpage</A>, <A HREF=".././FS/Conf.html">the FS::Conf manpage</A>, <A HREF=".././FS/cust_svc.html">the FS::cust_svc manpage</A>, <A HREF=".././FS/part_svc.html">the FS::part_svc manpage</A>, <A HREF=".././FS/cust_pkg.html">the FS::cust_pkg manpage</A>,
 <A HREF=".././FS/svc_acct.html">the FS::svc_acct manpage</A>, <A HREF=".././FS/svc_domain.html">the FS::svc_domain manpage</A>, <A HREF="../Net/SSH.html">the Net::SSH manpage</A>, <EM>ssh</EM>, <EM>dot-qmail</EM>,
 schema.html from the base documentation.</P>
index ace3de1..266e0b3 100644 (file)
@@ -57,6 +57,8 @@ FS::svc_Common.  The following fields are currently supported:</P>
 <DD>
 <DT><STRONG><A NAME="item_domain">domain</A></STRONG><BR>
 <DD>
+<DT><STRONG><A NAME="item_catchall_%2D_optional_svcnum_of_an_svc_acct_record">catchall - optional svcnum of an svc_acct record, designating an email catchall account.</A></STRONG><BR>
+<DD>
 </DL>
 <P>
 <HR>
@@ -86,9 +88,18 @@ the domain_record table (see &lt;FS::domain_record&gt;).</P>
 records are added to the domain_record table (see <A HREF=".././FS/domain_record.html">the FS::domain_record manpage</A>).</P>
 <P>If any machines are defined in the <EM>mxmachines</EM> configuration file, MX
 records are added to the domain_record table (see <A HREF=".././FS/domain_record.html">the FS::domain_record manpage</A>).</P>
-<P>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.</P>
+<P>If a machine is defined in the <EM>shellmachine</EM> configuration value, the
+<EM>qmailmachines</EM> configuration file exists, and the <EM>catchall</EM> field points
+to an an account with a home directory (see <A HREF=".././FS/svc_acct.html">the FS::svc_acct manpage</A>), the command:</P>
+<PRE>
+  [ -e $dir/.qmail-$qdomain-defualt ] || {
+    touch $dir/.qmail-$qdomain-default;
+    chown $uid:$gid $dir/.qmail-$qdomain-default;
+  }</PRE>
+<P>is executed on shellmachine via ssh (see <EM>dot-qmail/``EXTENSION ADDRESSES''</EM>).
+This behaviour can be supressed by setting $FS::svc_domain::nossh_hack true.</P>
+<P>a machine is defined
+in the</P>
 <P></P>
 <DT><STRONG><A NAME="item_delete">delete</A></STRONG><BR>
 <DD>
@@ -140,7 +151,7 @@ Submits a registration email for this domain.
 <P>
 <HR>
 <H1><A NAME="version">VERSION</A></H1>
-<P>$Id: svc_domain.html,v 1.1 2001-07-30 07:36:03 ivan Exp $</P>
+<P>$Id: svc_domain.html,v 1.3 2002-01-29 17:42:46 ivan Exp $</P>
 <P>
 <HR>
 <H1><A NAME="bugs">BUGS</A></H1>
index e72b219..0e7f4f1 100644 (file)
@@ -18,7 +18,6 @@
        <LI><A HREF="#version">VERSION</A></LI>
        <LI><A HREF="#bugs">BUGS</A></LI>
        <LI><A HREF="#see also">SEE ALSO</A></LI>
-       <LI><A HREF="#history">HISTORY</A></LI>
 </UL>
 <!-- INDEX END -->
 
@@ -120,7 +119,7 @@ and repalce methods.
 <P>
 <HR>
 <H1><A NAME="version">VERSION</A></H1>
-<P>$Id: svc_www.html,v 1.1 2001-07-30 07:36:03 ivan Exp $</P>
+<P>$Id: svc_www.html,v 1.3 2002-01-29 17:42:46 ivan Exp $</P>
 <P>
 <HR>
 <H1><A NAME="bugs">BUGS</A></H1>
@@ -129,21 +128,6 @@ and repalce methods.
 <H1><A NAME="see also">SEE ALSO</A></H1>
 <P><A HREF=".././FS/svc_Common.html">the FS::svc_Common manpage</A>, <A HREF=".././FS/Record.html">the FS::Record manpage</A>, <A HREF=".././FS/domain_record.html">the FS::domain_record manpage</A>, <A HREF=".././FS/cust_svc.html">the FS::cust_svc manpage</A>,
 <A HREF=".././FS/part_svc.html">the FS::part_svc manpage</A>, <A HREF=".././FS/cust_pkg.html">the FS::cust_pkg manpage</A>, schema.html from the base documentation.</P>
-<P>
-<HR>
-<H1><A NAME="history">HISTORY</A></H1>
-<P>$Log: svc_www.html,v $
-<P>Revision 1.1  2001-07-30 07:36:03  ivan
-<P>templates!!!
-<P>
-Revision 1.4  2001/04/22 01:56:15  ivan
-get rid of FS::SSH.pm (became Net::SSH and Net::SCP on CPAN)</P>
-<P>Revision 1.3  2000/11/22 23:30:51  ivan
-tyop</P>
-<P>Revision 1.2  2000/03/01 08:13:59  ivan
-compilation bugfixes</P>
-<P>Revision 1.1  2000/02/03 05:16:52  ivan
-beginning of DNS and Apache support</P>
 
 </BODY>
 
diff --git a/httemplate/edit/part_bill_event.cgi b/httemplate/edit/part_bill_event.cgi
new file mode 100755 (executable)
index 0000000..41d6666
--- /dev/null
@@ -0,0 +1,131 @@
+<!-- $Id: part_bill_event.cgi,v 1.1 2002-01-29 16:33:16 ivan Exp $ -->
+
+<%
+
+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!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'),
+      "</FONT>"
+  if $cgi->param('error');
+
+print '<FORM ACTION="', popurl(1), 'process/part_bill_event.cgi" METHOD=POST>';
+
+print "Invoice Event #", $hashref->{eventpart} ? $hashref->{eventpart} : "(NEW)";
+
+print ntable("#cccccc",2), <<END;
+<TR><TD ALIGN="right">Payby</TD><TD><SELECT NAME="payby">
+END
+
+for (qw(CARD BILL COMP)) {
+  print qq!<OPTION VALUE="$_"!;
+  if ($part_bill_event->payby eq $_) {
+    print " SELECTED> $_</OPTION>";
+  } else {
+    print ">$_</OPTION>";
+  }
+}
+
+my $days = $hashref->{seconds}/3600;
+
+print <<END;
+</SELECT></TD></TR>
+<TR><TD ALIGN="right">Event</TD><TD><INPUT TYPE="text" NAME="event" VALUE="$hashref->{event}"></TD></TR>
+<TR><TD ALIGN="right">After</TD><TD><INPUT TYPE="text" NAME="days" VALUE="$days"> days</TD></TR>
+END
+
+print '<TR><TD ALIGN="right">Disabled</TD><TD>';
+print '<INPUT TYPE="checkbox" NAME="disabled" VALUE="Y"';
+print ' CHECKED' if $hashref->{disabled} eq "Y";
+print '>';
+print '</TD></TR>';
+
+print '<TR><TD ALIGN="right">Action</TD><TD>';
+
+#print ntable();
+
+#this is pretty kludgy right here.
+tie my %events, 'Tie::IxHash',
+
+  'Charge a fee' => {
+    'code' => '$cust_main->charge( %%%charge%%%, \'%%%reason%%%\' );',
+    'html' => 'Amount <INPUT TYPE="text" SIZE="7" NAME="charge"><BR>'.
+              'Reason <INPUT TYPE="text" NAME="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!<TR><TD><INPUT TYPE="radio" NAME="eventcode" VALUE="!.
+        encode_entities($events{$event}{code}). qq!">$event</TD>!;
+  print '<TD>'. $events{$event}{html}. '</TD>' if exists $events{$event}{html};
+  print qq!</TR>!;
+  print '</TABLE>';
+}
+
+#print '</TABLE>';
+
+print <<END;
+</TD></TR>
+</TABLE>
+END
+
+print qq!<INPUT TYPE="submit" VALUE="!,
+      $hashref->{pkgpart} ? "Apply changes" : "Add invoice event",
+      qq!">!;
+%>
+
+    </FORM>
+  </BODY>
+</HTML>
+
index 735f4f2..ea3f62a 100755 (executable)
@@ -1,4 +1,4 @@
-<!-- $Id: part_pkg.cgi,v 1.8 2001-12-28 14:40:35 ivan Exp $ -->
+<!-- $Id: part_pkg.cgi,v 1.9 2002-01-29 16:33:16 ivan Exp $ -->
 
 <%
 
@@ -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 }
+                     ) {
+%>
 <TR><TD ALIGN="right"><%= $href->{$field}{'name'} %></TD>
 <TD><INPUT TYPE="text" NAME="<%= $field %>" VALUE="<%= exists($plandata{$field}) ? $plandata{$field} : $href->{$field}{'default'} %>" onChange="fchanged(this)"></TD></TR>
 <% } %>
 </TABLE>
 <INPUT TYPE="hidden" NAME="plandata" VALUE="<%= join(',', keys %{ $href } ) %>">
-<FONT SIZE="1">
 <BR><BR>
-Setup expression<BR><INPUT TYPE="text" NAME="setup" SIZE="160" VALUE="<%= $hashref->{setup} %>" onLoad="fchanged(this)"><BR>
-Recurring espression<BR><INPUT TYPE="text" NAME="recur" SIZE="160" VALUE="<%= $hashref->{recur} %>" onLoad="fchanged(this)"><BR>
-</FONT>
 
 <%
-print qq!<BR><INPUT TYPE="submit" VALUE="!,
+print qq!<INPUT TYPE="submit" VALUE="!,
       $hashref->{pkgpart} ? "Apply changes" : "Add package",
       qq!" onClick="fchanged(this)">!;
 %>
 
+<BR><BR>don't edit this unless you know what you're doing <INPUT TYPE="button" VALUE="refresh expressions" onClick="fchanged(this)"><%= ntable("#cccccc",2) %><TR><TD>
+<FONT SIZE="1">Setup expression<BR><INPUT TYPE="text" NAME="setup" SIZE="160" VALUE="<%= $hashref->{setup} %>" onLoad="fchanged(this)"></FONT><BR>
+<FONT SIZE="1">Recurring espression<BR><INPUT TYPE="text" NAME="recur" SIZE="160" VALUE="<%= $hashref->{recur} %>" onLoad="fchanged(this)"></FONT>
+</TR></TD>
+</TABLE>
+
 </FORM>
 
 <SCRIPT>
diff --git a/httemplate/edit/process/part_bill_event.cgi b/httemplate/edit/process/part_bill_event.cgi
new file mode 100755 (executable)
index 0000000..eb7c53e
--- /dev/null
@@ -0,0 +1,32 @@
+<%
+
+my $eventpart = $cgi->param('eventpart');
+
+my $old = qsearchs('part_bill_event',{'eventpart'=>$eventpart}) if $eventpart;
+
+#s/days/seconds/
+$cgi->param('seconds', $cgi->param('days') * 3600 );
+
+my $new = new FS::part_bill_event ( {
+  map {
+    $_, scalar($cgi->param($_));
+  } fields('part_bill_event'),
+} );
+
+my $error;
+if ( $eventpart ) {
+  $error = $new->replace($old);
+} else {
+  $error = $new->insert;
+  $eventpart = $new->getfield('eventpart');
+}
+
+if ( $error ) {
+  $cgi->param('error', $error);
+  print $cgi->redirect(popurl(2). "part_bill_event.cgi?". $cgi->query_string );
+} else {
+  print $cgi->redirect(popurl(3)."browse/part_bill_event.cgi");
+}
+
+%>
+
index d1abd0d..35ba8e8 100644 (file)
@@ -93,6 +93,7 @@
               into counties and assign different tax rates to each.
           <LI><A HREF="browse/svc_acct_pop.cgi">View/Edit POPs</A>
             - Points of Presence 
+          <LI><A HREF="browse/part_bill_event.cgi">View/Edit invoice events</A> - Actions for overdue invoices
         </ul>
       </ul>
   </BODY>