From 1aa750eba2b9b73b4f09f28b9acd748ee3669bd4 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 28 Jan 2002 06:57:23 +0000 Subject: [PATCH] book closing schema changes --- FS/FS/cust_bill.pm | 9 +++++++-- FS/FS/cust_credit.pm | 11 ++++++++--- FS/FS/cust_pay.pm | 9 +++++++-- FS/FS/cust_refund.pm | 9 +++++++-- FS/FS/part_pkg.pm | 18 +++++------------- FS/FS/part_svc.pm | 6 ++---- README.1.4.0pre4567-8 | 5 +++++ bin/fs-setup | 6 +++++- httemplate/docs/schema.html | 4 ++++ httemplate/docs/upgrade8.html | 4 ++++ 10 files changed, 54 insertions(+), 27 deletions(-) diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index fbccff1ff..8b326a56f 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -91,6 +91,8 @@ L and L for conversion functions. =item printed - how many times this invoice has been printed automatically (see L). +=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 diff --git a/FS/FS/cust_credit.pm b/FS/FS/cust_credit.pm index 3044af7ea..0ce5ac614 100644 --- a/FS/FS/cust_credit.pm +++ b/FS/FS/cust_credit.pm @@ -58,6 +58,8 @@ L and L 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 diff --git a/FS/FS/cust_pay.pm b/FS/FS/cust_pay.pm index 8f790a61a..3f811357a 100644 --- a/FS/FS/cust_pay.pm +++ b/FS/FS/cust_pay.pm @@ -61,6 +61,8 @@ L and L 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 diff --git a/FS/FS/cust_refund.pm b/FS/FS/cust_refund.pm index 2f7b3af4f..3dbd4ef39 100644 --- a/FS/FS/cust_refund.pm +++ b/FS/FS/cust_refund.pm @@ -55,6 +55,8 @@ L and L for conversion functions. =item otaker - order taker (assigned automatically, see L) +=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 diff --git a/FS/FS/part_pkg.pm b/FS/FS/part_pkg.pm index be2ad935f..29257c0cb 100644 --- a/FS/FS/part_pkg.pm +++ b/FS/FS/part_pkg.pm @@ -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 diff --git a/FS/FS/part_svc.pm b/FS/FS/part_svc.pm index 446d88c7e..41ee21d31 100644 --- a/FS/FS/part_svc.pm +++ b/FS/FS/part_svc.pm @@ -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 diff --git a/README.1.4.0pre4567-8 b/README.1.4.0pre4567-8 index 57474fed0..1f7878395 100644 --- a/README.1.4.0pre4567-8 +++ b/README.1.4.0pre4567-8 @@ -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 diff --git a/bin/fs-setup b/bin/fs-setup index 5b82eaf86..e3dd8b0ea 100755 --- a/bin/fs-setup +++ b/bin/fs-setup @@ -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' => [ [] ], diff --git a/httemplate/docs/schema.html b/httemplate/docs/schema.html index 3e9189b30..21da3ecf6 100644 --- a/httemplate/docs/schema.html +++ b/httemplate/docs/schema.html @@ -24,6 +24,7 @@
  • _date
  • charged - amount of this invoice
  • printed - how many times this invoice has been printed automatically +
  • closed - books closed flag, empty or `Y'
  • cust_bill_event - Invoice event history
      @@ -58,6 +59,7 @@
    • _date
    • otaker - order taker
    • reason +
    • closed - books closed flag, empty or `Y'
  • cust_credit_bill - Credit invoice application. Links a credit to an invoice.
      @@ -132,6 +134,7 @@
    • payby - CARD, BILL, or COMP
    • payinfo - card number, P.O.#, or comp issuer
    • paybatch - text field for tracking card processor batches +
    • closed - books closed flag, empty or `Y'
  • cust_bill_pay - Applicaton of a payment to a specific invoice.
      @@ -181,6 +184,7 @@
    • payby - CARD, BILL or COMP
    • payinfo - card number, P.O.#, or comp issuer
    • otaker - order taker +
    • closed - books closed flag, empty or `Y'
  • cust_credit_refund - Applicaton of a refund to a specific credit.
      diff --git a/httemplate/docs/upgrade8.html b/httemplate/docs/upgrade8.html index 144242b6a..bbb528cda 100644 --- a/httemplate/docs/upgrade8.html +++ b/httemplate/docs/upgrade8.html @@ -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 ); -- 2.11.0