stripping $ in money blobs to be safe
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 24 Aug 2006 17:01:48 +0000 (17:01 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 24 Aug 2006 17:01:48 +0000 (17:01 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@5655 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Cat.pm
Open-ILS/src/perlmods/OpenILS/Application/Circ/Money.pm

index a0b6109..0eec958 100644 (file)
@@ -1031,6 +1031,13 @@ sub update_fleshed_copies {
        return undef;
 }
 
+sub fix_copy_price {
+       my $copy = shift;
+       my $p = $copy->price || 0;
+       $p =~ s/\$//og;
+       $copy->price($p);
+}
+
 
 sub update_copy {
        my( $editor, $override, $vol, $copy ) = @_;
@@ -1041,6 +1048,8 @@ sub update_copy {
 
        $copy->editor($editor->requestor->id);
        $copy->edit_date('now');
+
+       fix_copy_price($copy);
        return $editor->event unless
                $editor->update_asset_copy( 
                        $copy, {checkperm=>1, permorg=>$vol->owning_lib});
@@ -1120,6 +1129,7 @@ sub create_copy {
        $copy->clear_id;
        $copy->creator($editor->requestor->id);
        $copy->create_date('now');
+       fix_copy_price($copy);
 
        $editor->create_asset_copy(
                $copy, {checkperm=>1, permorg=>$vol->owning_lib})
index 8af6fd8..d8bac45 100644 (file)
@@ -79,6 +79,8 @@ sub make_payments {
 
                my $transid = $pay->[0];
                my $amount = $pay->[1];
+               $amount =~ s/\$//og; # just to be safe
+
                ($trans, $evt) = $apputils->fetch_open_billable_transaction($transid);
                return $evt if $evt;
 
@@ -138,12 +140,6 @@ sub make_payments {
                        if( !$circ || $circ->stop_fines ) {
 
                                $trans->xact_finish("now");
-
-                               use Data::Dumper;
-                               warn Dumper($trans);
-
-                               warn "calling open-ils.storage.direct.money.billable_transaction.update\n";
-
                                my $s = $session->request(
                                        "open-ils.storage.direct.money.billable_transaction.update", $trans )->gather(1);
        
@@ -293,8 +289,6 @@ sub create_grocery_bill {
        
        $apputils->commit_db_session($session);
 
-
-
        return $transid;
 }
 
@@ -351,6 +345,10 @@ sub billing_items_create {
                        or return $e->event;
        }
 
+       my $amt = $billing->amount;
+       $amt =~ s/\$//og;
+       $billing->amount($amt);
+
        $e->create_money_billing($billing) or return $e->event;
        $e->commit;