From ae8bf6273ecd32319946cf37749dbf3dd2ae45dc Mon Sep 17 00:00:00 2001 From: erickson Date: Wed, 25 Apr 2007 13:32:05 +0000 Subject: [PATCH] more cleanup fixed some syntax errors git-svn-id: svn://svn.open-ils.org/ILS/trunk@7161 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/javascript/backend/circ/circ_duration.js | 2 +- .../src/javascript/backend/circ/circ_item_config.js | 8 ++++---- Open-ILS/src/javascript/backend/circ/circ_lib.js | 10 ++++++++++ .../src/javascript/backend/circ/circ_permit_hold.js | 15 +++++++++++++++ .../src/javascript/backend/circ/circ_permit_patron.js | 17 ++++++++++++++++- 5 files changed, 46 insertions(+), 6 deletions(-) diff --git a/Open-ILS/src/javascript/backend/circ/circ_duration.js b/Open-ILS/src/javascript/backend/circ/circ_duration.js index b4f129fe47..55468ab128 100644 --- a/Open-ILS/src/javascript/backend/circ/circ_duration.js +++ b/Open-ILS/src/javascript/backend/circ/circ_duration.js @@ -28,7 +28,7 @@ if( config ) { log_debug("circ_duration found a config for the copy"); result.durationRule = config.durationRule; result.recurringFinesRule = config.recurringFinesRule; - result.maxFine = config.maxFine; + result.maxFine = config.maxFine; } else { diff --git a/Open-ILS/src/javascript/backend/circ/circ_item_config.js b/Open-ILS/src/javascript/backend/circ/circ_item_config.js index 27a0e0c808..cc0795123f 100644 --- a/Open-ILS/src/javascript/backend/circ/circ_item_config.js +++ b/Open-ILS/src/javascript/backend/circ/circ_item_config.js @@ -26,8 +26,8 @@ var MARC_ITEM_TYPE_MAP = { a : { /* Language material [Books] */ SIPMediaType : '001', magneticMedia : 'f', - durationRule : 'default' - recurringFinesRule : 'default' + durationRule : 'default', + recurringFinesRule : 'default', maxFine : 'default' }, /* add more MARC item type configs as needed... */ @@ -41,8 +41,8 @@ var CIRC_MOD_MAP = { 'bestseller' : { SIPMediaType : '001', magneticMedia : 'f', - durationRule : 'default' - recurringFinesRule : 'default' + durationRule : 'default', + recurringFinesRule : 'default', maxFine : 'default' }, } diff --git a/Open-ILS/src/javascript/backend/circ/circ_lib.js b/Open-ILS/src/javascript/backend/circ/circ_lib.js index e7de3de019..acf80aa727 100644 --- a/Open-ILS/src/javascript/backend/circ/circ_lib.js +++ b/Open-ILS/src/javascript/backend/circ/circ_lib.js @@ -41,6 +41,7 @@ var isPrecat = environment.isPrecat; var currentLocation = environment.location; var holdRequestLib = environment.requestLib; var holdPickupLib = environment.pickupLib; /* hold pickup lib */ +var requestor = environment.requestor || patron; @@ -145,6 +146,12 @@ function isGroupDescendant( parent, child ) { groupList[child]); } +function isGroupDescendantId( parentName, childId ) { + log_debug("checking descendant ID p="+parentName + " c=" + childId); + return __isGroupDescendant( + groupList[parentName], + groupIDList[childId]); +} /** @@ -226,6 +233,9 @@ function log_vars( prefix ) { } catch(e) {} } + if(requestor.id != patron.id) + str+= ' Requestor='+requestor.usrname; + if(copy) { str += ', Copy=' + copy.id; str += ', Copy_Barcode=' + copy.barcode; diff --git a/Open-ILS/src/javascript/backend/circ/circ_permit_hold.js b/Open-ILS/src/javascript/backend/circ/circ_permit_hold.js index 8de1cd0333..2474a5e808 100644 --- a/Open-ILS/src/javascript/backend/circ/circ_permit_hold.js +++ b/Open-ILS/src/javascript/backend/circ/circ_permit_hold.js @@ -4,6 +4,7 @@ load_lib('circ/circ_lib.js'); log_vars('circ_permit_hold'); + if( isTrue(patron.barred) ) result.events.push('PATRON_BARRED'); @@ -14,6 +15,20 @@ if( !isTrue(copy.circulate) ) result.events.push('ITEM_NOT_HOLDABLE'); +var config = findGroupConfig(patronProfile); + +if( config ) { + + /* see if they have too many items out */ + var limit = config.maxHolds; + var count = userHoldCount(patron.id); + if( limit >= 0 && count >= limit ) { + log_info("patron has " + count + " open holds"); + result.events.push('MAX_HOLDS'); + } +} + + } go(); diff --git a/Open-ILS/src/javascript/backend/circ/circ_permit_patron.js b/Open-ILS/src/javascript/backend/circ/circ_permit_patron.js index 3ea5ddbd6d..da6f71917e 100644 --- a/Open-ILS/src/javascript/backend/circ/circ_permit_patron.js +++ b/Open-ILS/src/javascript/backend/circ/circ_permit_patron.js @@ -9,7 +9,22 @@ if( isTrue(patron.barred) ) result.events.push('PATRON_BARRED'); var config = findGroupConfig(patronProfile); -/* inspect the config too see if this patron should be allowed */ + +if( config ) { + + var limit = config.maxItemsOut; + if( limit >= 0 ) { + log_info('patron items out = ' + patronItemsOut +' limit = ' + limit); + if( !isTrue(isRenewal) && patronItemsOut >= limit ) { + result.events.push('PATRON_EXCEEDS_CHECKOUT_COUNT'); + } + } + +} else { + + log_warn("** profile has no configured information: " + patronProfile); +} + } go(); -- 2.11.0