on renewals, the itemsOut threshold is treated differently
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 28 Jul 2006 12:54:52 +0000 (12:54 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 28 Jul 2006 12:54:52 +0000 (12:54 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@5146 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/javascript/backend/circ/circ_permit_patron.js

index 2015228..989f32e 100644 (file)
@@ -16,8 +16,20 @@ if( isTrue(patron.barred) )
 var config = findGroupConfig(patronProfile);
 if( config ) {
        
-       if( (config.maxItemsOut >= 0) && (patronItemsOut >= config.maxItemsOut) ) {
-               result.events.push('PATRON_EXCEEDS_CHECKOUT_COUNT');
+       var limit = config.maxItemsOut;
+       if( limit >= 0 ) {
+
+               /* a renewal does not add to the itemsOut, so just make
+                       sure they are not already over the items out limit */
+               if( isTrue(isRenewal) ) {
+                       if( patronItemsOut > limit ) {
+                               result.events.push('PATRON_EXCEEDS_CHECKOUT_COUNT');
+                       }
+               } else {
+                       if( patronItemsOut >= limit ) {
+                               result.events.push('PATRON_EXCEEDS_CHECKOUT_COUNT');
+                       }
+               }
        }
 
 } else {