backend support for marking unrecovered debt
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 28 Sep 2008 19:24:46 +0000 (19:24 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 28 Sep 2008 19:24:46 +0000 (19:24 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@10717 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/examples/fm_IDL.xml
Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/money.pm
Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/money.pm
Open-ILS/src/sql/Pg/080.schema.money.sql

index 310fdd1..fd7274b 100644 (file)
@@ -2503,12 +2503,13 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                        <field reporter:label="User" name="usr" oils_obj:array_position="4" oils_persist:virtual="false" reporter:datatype="link"/>
                        <field reporter:label="Transaction Finish Date/Time" name="xact_finish" oils_obj:array_position="5" oils_persist:virtual="false" reporter:datatype="timestamp"/>
                        <field reporter:label="Transaction Start Date/Time" name="xact_start" oils_obj:array_position="6" oils_persist:virtual="false" reporter:datatype="timestamp"/>
-                       <field reporter:label="Grocery Billing link" name="grocery" oils_obj:array_position="7" oils_persist:virtual="true" reporter:datatype="link"/>
-                       <field reporter:label="Circulation Billing link" name="circulation" oils_obj:array_position="8" oils_persist:virtual="true" reporter:datatype="link"/>
-                       <field reporter:label="Billing Line Items" name="billings" oils_obj:array_position="9" oils_persist:virtual="true" reporter:datatype="link"/>
-                       <field reporter:label="Payment Line Items" name="payments" oils_obj:array_position="10" oils_persist:virtual="true" reporter:datatype="link"/>
-                       <field reporter:label="Billing Totals" name="billing_total" oils_obj:array_position="11" oils_persist:virtual="true" reporter:datatype="money"/>
-                       <field reporter:label="Payment Totals" name="payment_total" oils_obj:array_position="12" oils_persist:virtual="true" reporter:datatype="money"/>
+                       <field reporter:label="Unrecovered Debt" name="unrecovered" oils_obj:array_position="7" oils_persist:virtual="false" reporter:datatype="bool"/>
+                       <field reporter:label="Grocery Billing link" name="grocery" oils_obj:array_position="8" oils_persist:virtual="true" reporter:datatype="link"/>
+                       <field reporter:label="Circulation Billing link" name="circulation" oils_obj:array_position="9" oils_persist:virtual="true" reporter:datatype="link"/>
+                       <field reporter:label="Billing Line Items" name="billings" oils_obj:array_position="10" oils_persist:virtual="true" reporter:datatype="link"/>
+                       <field reporter:label="Payment Line Items" name="payments" oils_obj:array_position="11" oils_persist:virtual="true" reporter:datatype="link"/>
+                       <field reporter:label="Billing Totals" name="billing_total" oils_obj:array_position="12" oils_persist:virtual="true" reporter:datatype="money"/>
+                       <field reporter:label="Payment Totals" name="payment_total" oils_obj:array_position="13" oils_persist:virtual="true" reporter:datatype="money"/>
                </fields>
                <links>
                        <link field="grocery" reltype="might_have" key="id" map="" class="mg"/>
index e458bc7..5e32636 100644 (file)
@@ -17,7 +17,7 @@ package money::billable_transaction;
 use base qw/money/;
 __PACKAGE__->table('money_billable_xact');
 __PACKAGE__->columns(Primary => 'id');
-__PACKAGE__->columns(Essential => qw/xact_start usr xact_finish/);
+__PACKAGE__->columns(Essential => qw/xact_start usr xact_finish unrecovered/);
 #-------------------------------------------------------------------------------
 
 package money::grocery;
index b8cbe08..b049a0a 100644 (file)
@@ -513,5 +513,19 @@ __PACKAGE__->register_method(
        argc            => 3,
 );
 
+sub mark_unrecovered {
+       my $self = shift;
+       my $xact = shift;
+
+    my $x = money::billable_xact->retrieve($xact);
+    $x->unrecovered( 't' );
+    return $x->update;
+}
+__PACKAGE__->register_method(
+       method          => 'mark_unrecovered',
+       api_name        => 'open-ils.storage.money.billable_xact.mark_unrecovered',
+       argc            => 1,
+);
+
 
 1;
index b0da2da..acebaca 100644 (file)
@@ -31,10 +31,11 @@ CREATE TABLE money.collections_tracker (
 CREATE UNIQUE INDEX m_c_t_usr_collector_location_once_idx ON money.collections_tracker (usr, collector, location);
 
 CREATE TABLE money.billable_xact (
-       id              BIGSERIAL                       PRIMARY KEY,
-       usr             INT                             NOT NULL, -- actor.usr.id
-       xact_start      TIMESTAMP WITH TIME ZONE        NOT NULL DEFAULT NOW(),
-       xact_finish     TIMESTAMP WITH TIME ZONE
+       id          BIGSERIAL                   PRIMARY KEY,
+       usr         INT                         NOT NULL, -- actor.usr.id
+       xact_start  TIMESTAMP WITH TIME ZONE    NOT NULL DEFAULT NOW(),
+       xact_finish TIMESTAMP WITH TIME ZONE,
+    unrecovered BOOL
 );
 CREATE INDEX m_b_x_open_xacts_idx ON money.billable_xact (usr);