book closing schema changes
authorivan <ivan>
Mon, 28 Jan 2002 06:57:23 +0000 (06:57 +0000)
committerivan <ivan>
Mon, 28 Jan 2002 06:57:23 +0000 (06:57 +0000)
FS/FS/cust_bill.pm
FS/FS/cust_credit.pm
FS/FS/cust_pay.pm
FS/FS/cust_refund.pm
FS/FS/part_pkg.pm
FS/FS/part_svc.pm
README.1.4.0pre4567-8
bin/fs-setup
httemplate/docs/schema.html
httemplate/docs/upgrade8.html

index fbccff1..8b326a5 100644 (file)
@@ -91,6 +91,8 @@ L<Time::Local> and L<Date::Parse> for conversion functions.
 =item printed - how many times this invoice has been printed automatically
 (see L<FS::cust_main/"collect">).
 
+=item closed - books closed flag, empty or `Y'
+
 =back
 
 =head1 METHODS
@@ -120,7 +122,9 @@ no record you ever posted this invoice (which is bad, no?)
 =cut
 
 sub delete {
-  return "Can't remove invoice!"
+  my $self = shift;
+  return "Can't delete closed invoice" if $self->closed =~ /^Y/i;
+  $self->SUPER::delete(@_);
 }
 
 =item replace OLD_RECORD
@@ -160,6 +164,7 @@ sub check {
     || $self->ut_numbern('_date')
     || $self->ut_money('charged')
     || $self->ut_numbern('printed')
+    || $self->ut_enum('closed', [ '', 'Y' ])
   ;
   return $error if $error;
 
@@ -495,7 +500,7 @@ sub print_text {
 
 =head1 VERSION
 
-$Id: cust_bill.pm,v 1.14 2001-12-21 21:40:24 ivan Exp $
+$Id: cust_bill.pm,v 1.15 2002-01-28 06:57:23 ivan Exp $
 
 =head1 BUGS
 
index 3044af7..0ce5ac6 100644 (file)
@@ -58,6 +58,8 @@ L<Time::Local> and L<Date::Parse> for conversion functions.
 
 =item reason - text
 
+=item closed - books closed flag, empty or `Y'
+
 =back
 
 =head1 METHODS
@@ -126,7 +128,9 @@ Currently unimplemented.
 =cut
 
 sub delete {
-  return "Can't remove credit!"
+  my $self = shift;
+  return "Can't delete closed credit" if $self->closed =~ /^Y/i;
+  $self->SUPER::delete(@_);
 }
 
 =item replace OLD_RECORD
@@ -156,7 +160,8 @@ sub check {
     || $self->ut_number('custnum')
     || $self->ut_numbern('_date')
     || $self->ut_money('amount')
-    || $self->ut_textn('reason');
+    || $self->ut_textn('reason')
+    || $self->ut_enum('closed', [ '', 'Y' ])
   ;
   return $error if $error;
 
@@ -237,7 +242,7 @@ sub credited {
 
 =head1 VERSION
 
-$Id: cust_credit.pm,v 1.14 2002-01-24 16:58:47 ivan Exp $
+$Id: cust_credit.pm,v 1.15 2002-01-28 06:57:23 ivan Exp $
 
 =head1 BUGS
 
index 8f790a6..3f81135 100644 (file)
@@ -61,6 +61,8 @@ L<Time::Local> and L<Date::Parse> for conversion functions.
 
 =item paybatch - text field for tracking card processing
 
+=item closed - books closed flag, empty or `Y'
+
 =back
 
 =head1 METHODS
@@ -208,7 +210,9 @@ Currently unimplemented (accounting reasons).
 =cut
 
 sub delete {
-  return "Can't (yet?) delete cust_pay records!";
+  my $self = shift;
+  return "Can't delete closed payment" if $self->closed =~ /^Y/i;
+  $self->SUPER::delete(@_);
 }
 
 =item replace OLD_RECORD
@@ -237,6 +241,7 @@ sub check {
     || $self->ut_money('paid')
     || $self->ut_numbern('_date')
     || $self->ut_textn('paybatch')
+    || $self->ut_enum('closed', [ '', 'Y' ])
   ;
   return $error if $error;
 
@@ -307,7 +312,7 @@ sub unapplied {
 
 =head1 VERSION
 
-$Id: cust_pay.pm,v 1.13 2002-01-24 16:58:47 ivan Exp $
+$Id: cust_pay.pm,v 1.14 2002-01-28 06:57:23 ivan Exp $
 
 =head1 BUGS
 
index 2f7b3af..3dbd4ef 100644 (file)
@@ -55,6 +55,8 @@ L<Time::Local> and L<Date::Parse> for conversion functions.
 
 =item otaker - order taker (assigned automatically, see L<FS::UID>)
 
+=item closed - books closed flag, empty or `Y'
+
 =back
 
 =head1 METHODS
@@ -189,7 +191,9 @@ Currently unimplemented (accounting reasons).
 =cut
 
 sub delete {
-  return "Can't (yet?) delete cust_refund records!";
+  my $self = shift;
+  return "Can't delete closed refund" if $self->closed =~ /^Y/i;
+  $self->SUPER::delete(@_);
 }
 
 =item replace OLD_RECORD
@@ -218,6 +222,7 @@ sub check {
     || $self->ut_money('refund')
     || $self->ut_numbern('_date')
     || $self->ut_textn('paybatch')
+    || $self->ut_enum('closed', [ '', 'Y' ])
   ;
   return $error if $error;
 
@@ -261,7 +266,7 @@ sub check {
 
 =head1 VERSION
 
-$Id: cust_refund.pm,v 1.14 2002-01-24 16:58:47 ivan Exp $
+$Id: cust_refund.pm,v 1.15 2002-01-28 06:57:23 ivan Exp $
 
 =head1 BUGS
 
index be2ad93..29257c0 100644 (file)
@@ -132,7 +132,7 @@ insert and replace methods.
 sub check {
   my $self = shift;
 
-  my $error = $self->ut_numbern('pkgpart')
+  $self->ut_numbern('pkgpart')
     || $self->ut_text('pkg')
     || $self->ut_text('comment')
     || $self->ut_anything('setup')
@@ -140,19 +140,11 @@ sub check {
     || $self->ut_anything('recur')
     || $self->ut_alphan('plan')
     || $self->ut_anything('plandata')
+    || $self->ut_enum('setuptax', [ '', 'Y' ] )
+    || $self->ut_enum('recurtax', [ '', 'Y' ] )
+    || $self->ut_enum('disabled', [ '', 'Y' ] )
   ;
-  return $error if $error;
 
-  $self->setuptax =~ /^(Y?)$/ or return "Illegal setuptax: ". $self->setuptax;
-  $self->setuptax($1);
-
-  $self->recurtax =~ /^(Y?)$/ or return "Illegal recrutax: ". $self->recurtax;
-  $self->recurtax($1);
-
-  $self->disabled =~ /^(Y?)$/ or return "Illegal disabled: ". $self->disabled;
-  $self->disabled($1);
-
-  '';
 }
 
 =item pkg_svc
@@ -190,7 +182,7 @@ sub svcpart {
 
 =head1 VERSION
 
-$Id: part_pkg.pm,v 1.5 2001-12-27 09:26:13 ivan Exp $
+$Id: part_pkg.pm,v 1.6 2002-01-28 06:57:23 ivan Exp $
 
 =head1 BUGS
 
index 446d88c..41ee21d 100644 (file)
@@ -231,6 +231,7 @@ sub check {
     $self->ut_numbern('svcpart')
     || $self->ut_text('svc')
     || $self->ut_alpha('svcdb')
+    || $self->ut_enum('disabled', [ '', 'Y' ] )
   ;
   return $error if $error;
 
@@ -262,9 +263,6 @@ sub check {
 #    }
 #  }
 
-  $self->disabled =~ /^(Y?)$/ or return "Illegal disabled: ". $self->disabled;
-  $self->disabled($1);
-
   ''; #no error
 }
 
@@ -301,7 +299,7 @@ sub all_part_svc_column {
 
 =head1 VERSION
 
-$Id: part_svc.pm,v 1.8 2002-01-22 14:55:25 ivan Exp $
+$Id: part_svc.pm,v 1.9 2002-01-28 06:57:23 ivan Exp $
 
 =head1 BUGS
 
index 57474fe..1f78783 100644 (file)
@@ -51,6 +51,11 @@ CREATE INDEX part_export_option (
 CREATE INDEX part_export_option1 ON part_export ( exportnum );
 CREATE INDEX part_export_option2 ON part_export ( option );
 
+ALTER TABLE cust_bill ADD closed char(1) NULL;
+ALTER TABLE cust_pay ADD closed char(1) NULL;
+ALTER TABLE cust_credit ADD closed char(1) NULL;
+ALTER TABLE cust_refund ADD closed char(1) NULL;
+
 Run bin/dbdef-create
 
 Restart Apache and freeside-queued
index 5b82eaf..e3dd8b0 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -Tw
 #
-# $Id: fs-setup,v 1.70 2002-01-28 05:15:28 ivan Exp $
+# $Id: fs-setup,v 1.71 2002-01-28 06:57:23 ivan Exp $
 
 #to delay loading dbdef until we're ready
 BEGIN { $FS::Record::setup_hack = 1; }
@@ -293,6 +293,7 @@ sub tables_hash_hack {
         '_date',     @date_type,
         'charged',   @money_type,
         'printed',   'int',  '', '',
+        'closed',    'char', 'NULL', 1,
       ],
       'primary_key' => 'invnum',
       'unique' => [ [] ],
@@ -347,6 +348,7 @@ sub tables_hash_hack {
         'amount',   @money_type,
         'otaker',   'varchar', '', 8,
         'reason',   'text', 'NULL', '',
+        'closed',    'char', 'NULL', 1,
       ],
       'primary_key' => 'crednum',
       'unique' => [ [] ],
@@ -455,6 +457,7 @@ sub tables_hash_hack {
                                          # payment type table.
         'payinfo',  'varchar',   'NULL', 16,  #see cust_main above
         'paybatch', 'varchar',   'NULL', $char_d, #for auditing purposes.
+        'closed',    'char', 'NULL', 1,
       ],
       'primary_key' => 'paynum',
       'unique' => [ [] ],
@@ -531,6 +534,7 @@ sub tables_hash_hack {
                                              # into payment type table.
         'payinfo',      'varchar',   'NULL', 16,  #see cust_main above
         'paybatch',     'varchar',   'NULL', $char_d,
+        'closed',    'char', 'NULL', 1,
       ],
       'primary_key' => 'refundnum',
       'unique' => [ [] ],
index 3e9189b..21da3ec 100644 (file)
@@ -24,6 +24,7 @@
         <li>_date
         <li>charged - amount of this invoice
         <li>printed - how many times this invoice has been printed automatically
+        <li>closed - books closed flag, empty or `Y'
       </ul>
     <li><a name="cust_bill_event" href="man/FS/cust_bill_event.html">cust_bill_event</a> - Invoice event history
       <ul>
@@ -58,6 +59,7 @@
         <li>_date
         <li>otaker - order taker
         <li>reason
+        <li>closed - books closed flag, empty or `Y'
       </ul>
     <li><a name="cust_credit_bill" href="man/FS/cust_credit_bill.html">cust_credit_bill</a> - Credit invoice application.  Links a credit to an invoice.
       <ul>
         <li>payby - CARD, BILL, or COMP
         <li>payinfo - card number, P.O.#, or comp issuer
         <li>paybatch - text field for tracking card processor batches
+        <li>closed - books closed flag, empty or `Y'
       </ul>
     <li><a name="cust_bill_pay" href="man/FS/cust_bill_pay.html">cust_bill_pay</a> - Applicaton of a payment to a specific invoice.
       <ul>
         <li>payby - CARD, BILL or COMP
         <li>payinfo - card number, P.O.#, or comp issuer
         <li>otaker - order taker
+        <li>closed - books closed flag, empty or `Y'
       </ul>
     <li><a name="cust_credit_refund" href="man/FS/cust_credit_refund.html">cust_credit_refund</a> - Applicaton of a refund to a specific credit.
       <ul>
index 144242b..bbb528c 100644 (file)
@@ -175,6 +175,10 @@ ALTER TABLE part_pkg ADD setuptax char(1) NULL;
 ALTER TABLE part_pkg ADD recurtax char(1) NULL;
 ALTER TABLE part_pkg ADD disabled char(1) NULL;
 ALTER TABLE part_svc ADD disabled char(1) NULL;
+ALTER TABLE cust_bill ADD closed char(1) NULL;
+ALTER TABLE cust_pay ADD closed char(1) NULL;
+ALTER TABLE cust_credit ADD closed char(1) NULL;
+ALTER TABLE cust_refund ADD closed char(1) NULL;
 CREATE INDEX cust_main3 ON cust_main ( referral_custnum );
 CREATE INDEX cust_credit_bill1 ON cust_credit_bill ( crednum );
 CREATE INDEX cust_credit_bill2 ON cust_credit_bill ( invnum );