From 89ae42a6149ee13ca261e0ded6d1126aec02480e Mon Sep 17 00:00:00 2001 From: miker Date: Thu, 17 Nov 2005 20:22:02 +0000 Subject: [PATCH 1/1] "grocery" catchall billing git-svn-id: svn://svn.open-ils.org/ILS/trunk@2060 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../src/perlmods/OpenILS/Application/Storage/CDBI.pm | 3 +++ .../perlmods/OpenILS/Application/Storage/CDBI/money.pm | 10 ++++++++-- .../OpenILS/Application/Storage/Driver/Pg/dbi.pm | 6 ++++++ Open-ILS/src/perlmods/OpenILS/Utils/Fieldmapper.pm | 1 + Open-ILS/src/sql/Pg/080.schema.money.sql | 5 +++++ 5 files changed, 23 insertions(+), 2 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI.pm b/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI.pm index 657af02de1..5c2dec843d 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI.pm @@ -553,6 +553,9 @@ sub modify_from_fieldmapper { money::billable_transaction->has_many( billings => 'money::billing' ); money::billable_transaction->has_many( payments => 'money::payment' ); + money::grocery->has_many( billings => 'money::billing' ); + money::grocery->has_many( payments => 'money::payment' ); + money::billing->has_a( xact => 'money::billable_transaction' ); money::payment->has_a( xact => 'money::billable_transaction' ); diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/money.pm b/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/money.pm index 6661bacd80..70e7cb324e 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/money.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/money.pm @@ -10,8 +10,14 @@ package money::billable_transaction; use base qw/money/; __PACKAGE__->table('money_billable_xact'); __PACKAGE__->columns(Primary => 'id'); -__PACKAGE__->columns(Essential => qw/xact_start usr/); -__PACKAGE__->columns(Others => qw/xact_finish/); +__PACKAGE__->columns(Essential => qw/xact_start usr xact_finish/); +#------------------------------------------------------------------------------- + +package money::grocery; +use base qw/money/; +__PACKAGE__->table('money_grocery'); +__PACKAGE__->columns(Primary => 'id'); +__PACKAGE__->columns(Essential => qw/xact_start usr billing_location note xact_finish/); #------------------------------------------------------------------------------- package money::open_user_summary; diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/dbi.pm b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/dbi.pm index 7a0886e769..65ab7defaa 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/dbi.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/dbi.pm @@ -1,4 +1,10 @@ { + #--------------------------------------------------------------------- + package money::grocery; + + money::grocery->table( 'money.grocery' ); + money::grocery->sequence( 'money.billable_xact_id_seq' ); + #--------------------------------------------------------------------- package money::billable_transaction; diff --git a/Open-ILS/src/perlmods/OpenILS/Utils/Fieldmapper.pm b/Open-ILS/src/perlmods/OpenILS/Utils/Fieldmapper.pm index 86e9702097..174e98c33a 100644 --- a/Open-ILS/src/perlmods/OpenILS/Utils/Fieldmapper.pm +++ b/Open-ILS/src/perlmods/OpenILS/Utils/Fieldmapper.pm @@ -143,6 +143,7 @@ sub _init { 'Fieldmapper::money::billing' => { hint => 'mb' }, 'Fieldmapper::money::billable_transaction' => { hint => 'mbt' }, + 'Fieldmapper::money::grocery' => { hint => 'mg' }, 'Fieldmapper::money::open_user_summary' => { hint => 'mous', readonly => 1 }, diff --git a/Open-ILS/src/sql/Pg/080.schema.money.sql b/Open-ILS/src/sql/Pg/080.schema.money.sql index 14cab101cb..4655150c25 100644 --- a/Open-ILS/src/sql/Pg/080.schema.money.sql +++ b/Open-ILS/src/sql/Pg/080.schema.money.sql @@ -12,6 +12,11 @@ CREATE TABLE money.billable_xact ( ); CREATE INDEX m_b_x_open_xacts_idx ON money.billable_xact (usr) WHERE xact_finish IS NULL; +CREATE TABLE money.grocery ( -- Catchall table for local billing + billing_location INT NOT NULL, -- library creating transaction + note TEXT +) INHERITS (money.billable_xact); + CREATE TABLE money.billing ( id BIGSERIAL PRIMARY KEY, xact BIGINT NOT NULL, -- money.billable_xact.id -- 2.43.2