[open-ils-commits] r14701 - trunk/Open-ILS/src/perlmods/OpenILS/Application (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Fri Oct 30 10:34:45 EDT 2009


Author: erickson
Date: 2009-10-30 10:34:43 -0400 (Fri, 30 Oct 2009)
New Revision: 14701

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm
Log:
added support for overrideing the amount to charge the patron when an item is marked as damaged

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm	2009-10-30 13:46:41 UTC (rev 14700)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm	2009-10-30 14:34:43 UTC (rev 14701)
@@ -1079,6 +1079,9 @@
     my $apply = $args->{apply_fines} || '';
     return undef if $apply eq 'noapply';
 
+    my $new_amount = $args->{override_amount};
+    my $new_btype = $args->{override_btype};
+
     # grab the last circulation
     my $circ = $e->search_action_circulation([
         {   target_copy => $copy->id}, 
@@ -1107,16 +1110,30 @@
 
     if($apply) {
         
-        if($charge_price and $copy_price) {
+        if($new_amount and $new_btype) {
+
+            # Allow staff to override the amount to charge for a damaged item
+            # Consider the case where the item is only partially damaged
+            # This value is meant to take the place of the item price and
+            # optional processing fee.
+
             my $evt = OpenILS::Application::Circ::CircCommon->create_bill(
-                $e, $copy_price, 7, 'Damaged Item', $circ->id);
+                $e, $new_amount, $new_btype, 'Damaged Item Override', $circ->id);
             return $evt if $evt;
-        }
 
-        if($proc_fee) {
-            my $evt = OpenILS::Application::Circ::CircCommon->create_bill(
-                $e, $proc_fee, 8, 'Damaged Item Processing Fee', $circ->id);
-            return $evt if $evt;
+        } else {
+
+            if($charge_price and $copy_price) {
+                my $evt = OpenILS::Application::Circ::CircCommon->create_bill(
+                    $e, $copy_price, 7, 'Damaged Item', $circ->id);
+                return $evt if $evt;
+            }
+
+            if($proc_fee) {
+                my $evt = OpenILS::Application::Circ::CircCommon->create_bill(
+                    $e, $proc_fee, 8, 'Damaged Item Processing Fee', $circ->id);
+                return $evt if $evt;
+            }
         }
 
         # the assumption is that you would not void the overdues unless you 



More information about the open-ils-commits mailing list