[open-ils-commits] r11389 - in trunk/Open-ILS: examples src/perlmods/OpenILS/Application src/perlmods/OpenILS/Application/Circ src/perlmods/OpenILS/Application/Storage/CDBI src/perlmods/OpenILS/Application/Storage/Publisher src/sql/Pg
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Dec 3 12:04:25 EST 2008
Author: miker
Date: 2008-12-03 12:04:22 -0500 (Wed, 03 Dec 2008)
New Revision: 11389
Modified:
trunk/Open-ILS/examples/fm_IDL.xml
trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm
trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
trunk/Open-ILS/src/perlmods/OpenILS/Application/Collections.pm
trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/money.pm
trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm
trunk/Open-ILS/src/sql/Pg/080.schema.money.sql
trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql
Log:
add in-db billing type support
Modified: trunk/Open-ILS/examples/fm_IDL.xml
===================================================================
--- trunk/Open-ILS/examples/fm_IDL.xml 2008-12-03 16:36:37 UTC (rev 11388)
+++ trunk/Open-ILS/examples/fm_IDL.xml 2008-12-03 17:04:22 UTC (rev 11389)
@@ -3385,17 +3385,19 @@
<field name="isdeleted" oils_obj:array_position="2" oils_persist:virtual="true" />
<field reporter:label="Amount" name="amount" oils_obj:array_position="3" oils_persist:virtual="false" reporter:datatype="money" />
<field reporter:label="Billing Timestamp" name="billing_ts" oils_obj:array_position="4" oils_persist:virtual="false" reporter:datatype="timestamp"/>
- <field reporter:label="Billing Type" name="billing_type" oils_obj:array_position="5" oils_persist:virtual="false" reporter:datatype="text"/>
+ <field reporter:label="Legacy Billing Type" name="billing_type" oils_obj:array_position="5" oils_persist:virtual="false" reporter:datatype="text"/>
<field reporter:label="Billing ID" name="id" oils_obj:array_position="6" oils_persist:virtual="false" reporter:datatype="id" />
<field reporter:label="Note" name="note" oils_obj:array_position="7" oils_persist:virtual="false" reporter:datatype="text"/>
<field reporter:label="Void Timestamp" name="void_time" oils_obj:array_position="8" oils_persist:virtual="false" reporter:datatype="timestamp"/>
<field reporter:label="Voided?" name="voided" oils_obj:array_position="9" oils_persist:virtual="false" reporter:datatype="bool"/>
<field reporter:label="Voiding Staff Member" name="voider" oils_obj:array_position="10" oils_persist:virtual="false" reporter:datatype="link"/>
<field reporter:label="Transaction" name="xact" oils_obj:array_position="11" oils_persist:virtual="false" reporter:datatype="link"/>
+ <field reporter:label="Type" name="btype" oils_obj:array_position="12" oils_persist:virtual="false" reporter:datatype="link"/>
</fields>
<links>
<link field="xact" reltype="has_a" key="id" map="" class="mbt"/>
<link field="voider" reltype="has_a" key="id" map="" class="au"/>
+ <link field="btype" reltype="has_a" key="id" map="" class="cbt"/>
</links>
</class>
<class id="pugm" controller="open-ils.cstore" oils_obj:fieldmapper="permission::usr_grp_map" oils_persist:tablename="permission.usr_grp_map">
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm 2008-12-03 16:36:37 UTC (rev 11388)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm 2008-12-03 17:04:22 UTC (rev 11389)
@@ -1194,12 +1194,15 @@
my $bill = Fieldmapper::money::billing->new;
my $amount = $copy->deposit_amount;
my $billing_type;
+ my $btype;
if($self->is_deposit) {
$billing_type = OILS_BILLING_TYPE_DEPOSIT;
+ $btype = 5;
$self->deposit_billing($bill);
} else {
$billing_type = OILS_BILLING_TYPE_RENTAL;
+ $btype = 6;
$self->rental_billing($bill);
}
@@ -1207,6 +1210,7 @@
$bill->amount($amount);
$bill->note(OILS_BILLING_NOTE_SYSTEM);
$bill->billing_type($billing_type);
+ $bill->btype($btype);
$self->editor->create_money_billing($bill) or $self->bail_on_events($self->editor->event);
$logger->info("circulator: charged $amount on checkout with billing type $billing_type");
@@ -1758,7 +1762,7 @@
my $self = shift;
return unless $self->circ;
my $deposit = $self->editor->search_money_billing(
- { billing_type => OILS_BILLING_TYPE_DEPOSIT,
+ { btype => 5,
xact => $self->circ->id,
voided => 'f'
}, {idlist => 1})->[0];
@@ -2139,7 +2143,7 @@
{
billing_ts => { '>=' => $bd },
xact => $self->circ->id,
- billing_type => OILS_BILLING_TYPE_OVERDUE_MATERIALS
+ btype => 1
}
);
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm 2008-12-03 16:36:37 UTC (rev 11388)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm 2008-12-03 17:04:22 UTC (rev 11389)
@@ -293,14 +293,14 @@
my $price = $U->get_copy_price($e, $copy, $copy->call_number);
if( $price > 0 ) {
- my $evt = create_bill($e, $price, 'Lost Materials', $circ->id);
+ my $evt = create_bill($e, $price, 3, 'Lost Materials', $circ->id);
return $evt if $evt;
}
# ---------------------------------------------------------------------
# if there is a processing fee, charge that too
if( $proc_fee > 0 ) {
- my $evt = create_bill($e, $proc_fee, 'Lost Materials Processing Fee', $circ->id);
+ my $evt = create_bill($e, $proc_fee, 4, 'Lost Materials Processing Fee', $circ->id);
return $evt if $evt;
}
@@ -347,7 +347,7 @@
sub create_bill {
- my( $e, $amount, $type, $xactid ) = @_;
+ my( $e, $amount, $btype, $type, $xactid ) = @_;
$logger->info("The system is charging $amount [$type] on xact $xactid");
@@ -357,6 +357,7 @@
$bill->xact($xactid);
$bill->amount($amount);
$bill->billing_type($type);
+ $bill->btype($btype);
$bill->note('SYSTEM GENERATED');
$e->create_money_billing($bill) or return $e->die_event;
@@ -374,7 +375,7 @@
my $bill_search = {
xact => $circ->id,
- billing_type => OILS_BILLING_TYPE_OVERDUE_MATERIALS
+ btype => 1
};
if( $backdate ) {
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Collections.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Collections.pm 2008-12-03 16:36:37 UTC (rev 11388)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Collections.pm 2008-12-03 17:04:22 UTC (rev 11389)
@@ -435,6 +435,7 @@
my $bill = Fieldmapper::money::billing->new;
$bill->note($fee_note);
$bill->xact($xact->id);
+ $bill->btype(2);
$bill->billing_type(OILS_BILLING_TYPE_COLLECTION_FEE);
$bill->amount($fee_amount);
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/money.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/money.pm 2008-12-03 16:36:37 UTC (rev 11388)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/money.pm 2008-12-03 17:04:22 UTC (rev 11389)
@@ -79,7 +79,8 @@
use base qw/money/;
__PACKAGE__->table('money_billing');
__PACKAGE__->columns(Primary => 'id');
-__PACKAGE__->columns(Essential => qw/xact amount billing_ts billing_type note voided voider void_time/);
+__PACKAGE__->columns(Essential => qw/xact amount billing_ts billing_type note
+ voided voider void_time btype/);
#-------------------------------------------------------------------------------
package money::payment;
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm 2008-12-03 16:36:37 UTC (rev 11388)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm 2008-12-03 17:04:22 UTC (rev 11389)
@@ -640,7 +640,7 @@
my @fines = money::billing->search_where(
{ xact => $c->id,
- billing_type => 'Overdue materials',
+ btype => 1,
billing_ts => { '>' => $c->due_date } },
{ order_by => 'billing_ts DESC'}
);
@@ -752,6 +752,7 @@
{ xact => ''.$c->id,
note => "System Generated Overdue Fine",
billing_type => "Overdue materials",
+ btype => 1,
amount => sprintf('%0.2f', $recuring_fine/100),
billing_ts => $timestamptz,
}
Modified: trunk/Open-ILS/src/sql/Pg/080.schema.money.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/080.schema.money.sql 2008-12-03 16:36:37 UTC (rev 11388)
+++ trunk/Open-ILS/src/sql/Pg/080.schema.money.sql 2008-12-03 17:04:22 UTC (rev 11389)
@@ -56,6 +56,7 @@
void_time TIMESTAMP WITH TIME ZONE,
amount NUMERIC(6,2) NOT NULL,
billing_type TEXT NOT NULL,
+ btype INT NOT NULL REFERENCES config.billing_type (id) ON DELETE RESTRICT,
note TEXT
);
CREATE INDEX m_b_xact_idx ON money.billing (xact);
Modified: trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql 2008-12-03 16:36:37 UTC (rev 11388)
+++ trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql 2008-12-03 17:04:22 UTC (rev 11389)
@@ -805,6 +805,21 @@
oils_i18n_gettext(5, 'Your Bookmobile', 'aout', 'opac_label'), 3, 3 );
SELECT SETVAL('actor.org_unit_type_id_seq'::TEXT, 100);
+INSERT INTO config.billing_type (id, name, owner) VALUES
+ ( 1, oils_i18n_gettext(1, 'Overdue Materials', 'cbt', 'name'), 1);
+INSERT INTO config.billing_type (id, name, owner) VALUES
+ ( 2, oils_i18n_gettext(2, 'Long Overdue Collection Fee', 'cbt', 'name'), 1);
+INSERT INTO config.billing_type (id, name, owner) VALUES
+ ( 3, oils_i18n_gettext(3, 'Lost Materials', 'cbt', 'name'), 1);
+INSERT INTO config.billing_type (id, name, owner) VALUES
+ ( 4, oils_i18n_gettext(4, 'Lost Materials Processing Fee', 'cbt', 'name'), 1);
+INSERT INTO config.billing_type (id, name, owner) VALUES
+ ( 5, oils_i18n_gettext(5, 'System: Deposit', 'cbt', 'name'), 1);
+INSERT INTO config.billing_type (id, name, owner) VALUES
+ ( 6, oils_i18n_gettext(6, 'System: Rental', 'cbt', 'name'), 1);
+
+SELECT SETVAL('config.billing_type_id_seq'::TEXT, 100);
+
INSERT INTO actor.org_unit (id, parent_ou, ou_type, shortname, name) VALUES
(1, NULL, 1, 'CONS', oils_i18n_gettext(1, 'Example Consortium', 'aou', 'name'));
INSERT INTO actor.org_unit (id, parent_ou, ou_type, shortname, name) VALUES
More information about the open-ils-commits
mailing list