fixed up default copy price handling on mark-lost
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 16 Aug 2006 21:33:06 +0000 (21:33 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 16 Aug 2006 21:33:06 +0000 (21:33 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@5546 dcc99617-32d9-48b4-a31d-7c20da2025e4

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

index 7ff72f5..5441d77 100644 (file)
@@ -295,23 +295,25 @@ sub _set_circ_lost {
 
        # if the copy has a price defined and/or a processing fee, bill the patron
 
-       my $copy_price = $copy->price || 0;
+       # if the location that owns the copy has a processing fee, charge the user
+       my $owner = $U->fetch_copy_owner($copy->id);
+       $logger->info("circ fetching org settings for $owner ".
+               "to determine processing fee and default copy price");
 
-       $logger->debug("lost copy has a price of $copy_price");
+       my $settings = $U->simplereq(
+               'open-ils.actor', 'open-ils.actor.org_unit.settings.retrieve', $owner );
+       my $fee = $settings->{'circ.lost_materials_processing_fee'} || 0;
 
        # If the copy has a price configured, charge said price to the user
+       my $s = OILS_SETTING_DEF_ITEM_PRICE;
+       my $copy_price = $copy->price || 0;
+       $copy_price = $settings->{$s} unless $copy_price and $copy_price > 0;
        if($copy_price and $copy_price > 0) {
+               $logger->debug("lost copy has a price of $copy_price");
                $evt = _make_bill($session, $copy_price, 'Lost Materials', $circ->id);
                return $evt if $evt;
        }
 
-       # if the location that owns the copy has a processing fee, charge the user
-       my $owner = $U->fetch_copy_owner($copy->id);
-       $logger->info("circ fetching org settings for $owner to determine processing fee");
-
-       my $settings = $U->simplereq(
-               'open-ils.actor', 'open-ils.actor.org_unit.settings.retrieve', $owner );
-       my $fee = $settings->{'circ.lost_materials_processing_fee'} || 0;
 
        if( $fee ) {
                $evt = _make_bill($session, $fee, 'Lost Materials Processing Fee', $circ->id);