finishing up mbts thingy
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 12 Sep 2006 00:03:54 +0000 (00:03 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 12 Sep 2006 00:03:54 +0000 (00:03 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@6068 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI.pm
Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/money.pm

index 97c6686..8603475 100644 (file)
@@ -572,8 +572,8 @@ sub modify_from_fieldmapper {
        actor::org_unit->has_many( checkins => 'action::circulation' => 'checkin_lib' );
 
        money::billable_transaction->has_a( usr => 'actor::user' );
-       money::billable_transaction->might_have( circulation => 'action::circulation' );
-       money::billable_transaction->might_have( grocery => 'money::grocery' );
+       #money::billable_transaction->might_have( circulation => 'action::circulation' );
+       #money::billable_transaction->might_have( grocery => 'money::grocery' );
        actor::user->has_many( billable_transactions => 'action::circulation' => 'usr' );
        
        
@@ -612,6 +612,9 @@ sub modify_from_fieldmapper {
        metabib::metarecord->has_many( source_records => [ 'metabib::metarecord_source_map' => 'source'] );
        biblio::record_entry->has_many( metarecords => [ 'metabib::metarecord_source_map' => 'metarecord'] );
 
+       money::billing->has_a( xact => 'money::billable_transaction' );
+       money::payment->has_a( xact => 'money::billable_transaction' );
+
        money::billable_transaction->has_many( billings => 'money::billing' );
        money::billable_transaction->has_many( payments => 'money::payment' );
 
@@ -634,8 +637,6 @@ sub modify_from_fieldmapper {
        money::grocery->has_many( payments => 'money::payment' => 'xact' );
        #money::grocery->might_have( billable_transaction => 'money::billable_transaction' );
 
-       money::billing->has_a( xact => 'money::billable_transaction' );
-       money::payment->has_a( xact => 'money::billable_transaction' );
        #money::payment->might_have( cash_payment => 'money::cash_payment' );
        #money::payment->might_have( check_payment => 'money::check_payment' );
        #money::payment->might_have( credit_card_payment => 'money::credit_card_payment' );
index c2818b4..cce232b 100644 (file)
@@ -18,7 +18,7 @@ sub _make_mbts {
                 my $to = 0;
                 my $lb = undef;
                 for my $b ($x->billings) {
-                        next if ($U->is_true($b->voided));
+                        next if ($b->voided);
                         $to += int($b->amount * 100);
                         $lb ||= $b->billing_ts;
                         if ($b->billing_ts ge $lb) {
@@ -34,7 +34,7 @@ sub _make_mbts {
                 my $tp = 0;
                 my $lp = undef;
                 for my $p ($x->payments) {
-                        next if ($U->is_true($p->voided));
+                        next if ($p->voided);
                         $tp += int($p->amount * 100);
                         $lp ||= $p->payment_ts;
                         if ($p->payment_ts ge $lp) {
@@ -48,8 +48,8 @@ sub _make_mbts {
 
                 $s->balance_owed( sprintf('%0.2f', int($to - $tp) / 100) );
 
-                $s->xact_type( 'grocery' ) if ($x->grocery);
-                $s->xact_type( 'circulation' ) if ($x->circulation);
+                $s->xact_type( 'grocery' ) if (money::grocery->retrieve($x->id));
+                $s->xact_type( 'circulation' ) if (action::circulation->retrieve($x->id));
 
                 push @mbts, $s;
         }
@@ -62,7 +62,7 @@ sub search_mbts {
        my $client = shift;
        my $search = shift;
 
-       my @xacts = money::billable_xact->search_where( $search );
+       my @xacts = money::billable_transaction->search_where( $search );
        $client->respond( $_ ) for (_make_mbts(@xacts));
 
        return undef;