From 40f69792d5d78ea35be5dccdab8836515d878080 Mon Sep 17 00:00:00 2001 From: erickson Date: Mon, 12 Mar 2007 00:21:26 +0000 Subject: [PATCH] removed some unused circ scripts made these circ scripts more generic and simple for default installations git-svn-id: svn://svn.open-ils.org/ILS/trunk@7055 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../javascript/backend/circ/circ_duration.js | 66 +-- .../javascript/backend/circ/circ_groups.js | 129 +---- .../backend/circ/circ_item_config.js | 453 +----------------- .../src/javascript/backend/circ/circ_lib.js | 55 ++- .../javascript/backend/circ/circ_max_fines.js | 12 - .../backend/circ/circ_permit_copy.js | 7 - .../backend/circ/circ_permit_hold.js | 64 +-- .../backend/circ/circ_permit_patron.js | 21 +- .../backend/circ/circ_permit_renew.js | 8 - .../backend/circ/circ_recurring_fines.js | 20 - 10 files changed, 81 insertions(+), 754 deletions(-) delete mode 100644 Open-ILS/src/javascript/backend/circ/circ_max_fines.js delete mode 100644 Open-ILS/src/javascript/backend/circ/circ_recurring_fines.js diff --git a/Open-ILS/src/javascript/backend/circ/circ_duration.js b/Open-ILS/src/javascript/backend/circ/circ_duration.js index d535e613a8..b4f129fe47 100644 --- a/Open-ILS/src/javascript/backend/circ/circ_duration.js +++ b/Open-ILS/src/javascript/backend/circ/circ_duration.js @@ -7,10 +7,9 @@ log_vars('circ_duration'); /* treat pre-cat copies like vanilla books */ if( isTrue(isPrecat) ) { log_info("pre-cat copy getting duration defaults..."); - result.durationRule = '14_days_2_renew'; - result.recurringFinesRule = '10_cent_per_day'; - result.maxFine = 'overdue_mid'; - checkDurationExceptions(); + result.durationRule = 'default'; + result.recurringFinesRule = 'default'; + result.maxFine = 'default' return; } @@ -33,66 +32,17 @@ if( config ) { } else { - result.durationRule = '14_days_2_renew'; - result.recurringFinesRule = "10_cent_per_day"; - result.maxFine = "overdue_mid"; + result.durationRule = 'default'; + result.recurringFinesRule = 'default'; + result.maxFine = 'default'; } - -/* ----------------------------------------------------------------------------- - Add custom rules here. - ----------------------------------------------------------------------------- */ - -var circMod = (copy.circ_modifier) ? copy.circ_modifier.toLowerCase() : ''; - -if( isOrgDescendent('STATELIB', copy.circ_lib.id) ) { - if( circMod == 'book' ) - result.durationRule = '35_days_1_renew'; - if(isTrue(copy.ref)) - result.durationRule = '14_days_2_renew'; - -} else if( isOrgDescendent('NCLS', copy.circ_lib.id) && ( circMod == 'dvd' || circMod == 'video' ) ) - result.recurringFinesRule = '10_cent_per_day'; - -/* -else if( isOrgDescendent('LEE', copy.circ_lib.id) && circMod == 'video' ) - result.recurringFinesRule = '50_cent_per_day'; - -else if( isOrgDescendent('ECGR', copy.circ_lib.id) && circMod == 'video' ) - result.recurringFinesRule = '50_cent_per_day'; - -else if( isOrgDescendent('OHOOP', copy.circ_lib.id) && circMod == 'video' ) - result.recurringFinesRule = '50_cent_per_day'; - -else if( isOrgDescendent('ARL', copy.circ_lib.id) && circMod == 'video' ) - result.recurringFinesRule = '50_cent_per_day'; - */ - - - -checkDurationExceptions(); - -log_info('final duration results: ' + result.durationRule + ' : ' + result.recurringFinesRule + ' : ' + result.maxFine ); +log_info('final duration results: ' + + result.durationRule + ' : ' + result.recurringFinesRule + ' : ' + result.maxFine ); } go(); -function checkDurationExceptions() { - log_debug("Checking duration rule exceptions for profile "+patronProfile); - - if( isGroupDescendant('Staff', patronProfile) || - isGroupDescendant('Trustee', patronProfile) || - isGroupDescendant('Outreach', patronProfile) ) { - - result.recurringFinesRule = "staff"; - result.maxFine = "staff"; - } - - if( isGroupDescendant('Outreach', patronProfile) ) { - log_info("Outreach user found, setting duration to 2 months"); - result.durationRule = '2_months_2_renew'; - } -} diff --git a/Open-ILS/src/javascript/backend/circ/circ_groups.js b/Open-ILS/src/javascript/backend/circ/circ_groups.js index fdfdf24de6..036d56e0f1 100644 --- a/Open-ILS/src/javascript/backend/circ/circ_groups.js +++ b/Open-ILS/src/javascript/backend/circ/circ_groups.js @@ -12,131 +12,10 @@ --------------------------------------------------------------------- */ var GROUP_CONFIG = { - 'Patron' : { - maxItemsOut : 50, - fineThreshold : 10, - overdueThreshold : 10, - maxHolds : -1 - }, - - 'Class' : { - maxItemsOut : 50, - fineThreshold : 10, - overdueThreshold : 10, - maxHolds : 15 - }, - - 'Friend' : { - maxItemsOut : 50, - fineThreshold : 10, - overdueThreshold : 10, - maxHolds : -1 + maxItemsOut : 50, + fineThreshold : 10, + overdueThreshold : 10, + maxHolds : -1 }, - - 'NonResident' : { - maxItemsOut : 50, - fineThreshold : 10, - overdueThreshold : 10, - maxHolds : -1 - }, - - 'OutOfState' : { - maxItemsOut : 50, - fineThreshold : 10, - overdueThreshold : 10, - maxHolds : -1 - }, - - 'Outreach' : { - maxItemsOut : -1, - fineThreshold : -1, - overdueThreshold : -1, - maxHolds : 15 - }, - - - 'Restricted' : { - maxItemsOut : 2, - fineThreshold : 0.01, - overdueThreshold : 1, - maxHolds : 5 - }, - - 'Temp' : { - maxItemsOut : 5, - fineThreshold : .01, - overdueThreshold : 1, - maxHolds : 5 - }, - - 'TempRes6' : { - maxItemsOut : 50, - fineThreshold : 10, - overdueThreshold : 10, - maxHolds : -1 - }, - - 'tempRes12' : { - maxItemsOut : 50, - fineThreshold : 10, - overdueThreshold : 10, - maxHolds : -1 - }, - - 'Trustee' : { - maxItemsOut : 50, - fineThreshold : 10, - overdueThreshold : 10, - maxHolds : 10 - }, - - - 'Vendor' : { - maxItemsOut : 0, - fineThreshold : 0.01, - overdueThreshold : 1, - maxHolds : 0 - }, - - 'Staff' : { - maxItemsOut : 50, - fineThreshold : -1, - overdueThreshold : -1, - maxHolds : -1 - }, - -}; - - - -/** - * Returns config information for the requested group. If - * no config info exists for the requested group, then this - * function searches up the tree to find the config info - * for the nearest ancestor - * @param The name of the group who's config info to return - */ -function findGroupConfig(name) { - if(!name) return null; - var node = groupList[name]; - do { - if( GROUP_CONFIG[node.name] ) { - debugGroupConfig(name, node.name, GROUP_CONFIG[node.name]); - return GROUP_CONFIG[node.name]; - } - } while( (node = groupIDList[node.parent]) ); - return null; -} - -function debugGroupConfig(name, foundName, config) { - if(!config) return; - var str = "findGroupConfig('"+name+"'): returning config info for '"+ foundName +"': "; - for( var i in config ) - str += i + '=' + config[i] + ' '; - log_debug(str); } - - - - 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 87207f06b6..27a0e0c808 100644 --- a/Open-ILS/src/javascript/backend/circ/circ_item_config.js +++ b/Open-ILS/src/javascript/backend/circ/circ_item_config.js @@ -18,470 +18,69 @@ log_debug('loading circ_item_config.js ...'); /* ----------------------------------------------------------------------------- Configure the duration rules for the various item types and circ modifiers - MARC Fixed Field info: http://www.oclc.org/bibformats/en/fixedfield/ - ----------------------------------------------------------------------------- */ var MARC_ITEM_TYPE_MAP = { - a : { /* Language material [Books] */ SIPMediaType : '001', magneticMedia : 'f', - durationRule : '14_days_2_renew', - recurringFinesRule : '10_cent_per_day', - maxFine : 'overdue_mid' - }, - - t : { /* Manuscript language material [Books] */ - SIPMediaType : '001', - magneticMedia : 'f', - durationRule : '14_days_2_renew', - recurringFinesRule : '10_cent_per_day', - maxFine : 'overdue_mid' - }, - - g : { /* Projected medium [Videos, etc.] */ - SIPMediaType : '005', - magneticMedia : 'f', - durationRule : '7_days_0_renew', - recurringFinesRule : '10_cent_per_day', - maxFine : 'overdue_mid' - }, - - k : { /* Two-dimensional nonprojectable graphic [Card, charts, etc.] */ - SIPMediaType : '001', - magneticMedia : 'f', - durationRule : '3_month_0_renew', - recurringFinesRule : '10_cent_per_day', - maxFine : 'overdue_mid' - }, - - r : { /* Three-dimensional artifact or naturally occurring object [Models, games, etc.] */ - SIPMediaType : '001', - magneticMedia : 'f', - durationRule : '14_days_2_renew', - recurringFinesRule : '10_cent_per_day', - maxFine : 'overdue_mid' - }, - - o : { /* Kit [Mixture of item types] */ - SIPMediaType : '001', - magneticMedia : 'f', - durationRule : '14_days_2_renew', - recurringFinesRule : '10_cent_per_day', - maxFine : 'overdue_mid' - }, - - p : { /* Mixed materials [Mixture of item types] */ - SIPMediaType : '001', - magneticMedia : 'f', - durationRule : '14_days_2_renew', - recurringFinesRule : '10_cent_per_day', - maxFine : 'overdue_mid' - }, - - e : { /* Cartographic material [Map] */ - SIPMediaType : '001', - magneticMedia : 'f', - durationRule : '7_days_2_renew', - recurringFinesRule : '50_cent_per_day', - maxFine : 'overdue_mid' - }, - - f : { /* Manuscript cartographic material [Map] */ - SIPMediaType : '001', - magneticMedia : 'f', - durationRule : '3_days_1_renew', - recurringFinesRule : '50_cent_per_day', - maxFine : 'overdue_mid' - }, - - c : { /* Notated music [Printed music] */ - SIPMediaType : '001', - magneticMedia : 'f', - durationRule : '14_days_2_renew', - recurringFinesRule : '10_cent_per_day', - maxFine : 'overdue_mid' - }, - - d : { /* Manuscript notated music [Printed music] */ - SIPMediaType : '001', - magneticMedia : 'f', - durationRule : '14_days_2_renew', - recurringFinesRule : '10_cent_per_day', - maxFine : 'overdue_mid' - }, - - i : { /* Nonmusical sound recording [Audiobooks, sound effects, etc.] */ - SIPMediaType : '001', - magneticMedia : 'f', - durationRule : '14_days_2_renew', - recurringFinesRule : '10_cent_per_day', - maxFine : 'overdue_mid' - }, - - j : { /* Musical sound recording [Music] */ - SIPMediaType : '001', - magneticMedia : 'f', - durationRule : '14_days_2_renew', - recurringFinesRule : '10_cent_per_day', - maxFine : 'overdue_mid' + durationRule : 'default' + recurringFinesRule : 'default' + maxFine : 'default' }, - - m : { /* Computer file */ - SIPMediaType : '001', - magneticMedia : 'f', - durationRule : '14_days_2_renew', - recurringFinesRule : '10_cent_per_day', - maxFine : 'overdue_mid' - } + /* add more MARC item type configs as needed... */ } +/* make 't' and 'a' share the same config info */ +MARC_ITEM_TYPE_MAP.t = MARC_ITEM_TYPE_MAP.a; -var CIRC_MOD_MAP = { - - 'art' : { - SIPMediaType : '000', - magneticMedia : 'f', - durationRule : '3_month_1_renew', - recurringFinesRule : '10_cent_per_day', - maxFine : 'overdue_mid' - }, - - 'atlas' : { - SIPMediaType : '000', - magneticMedia : 'f', - durationRule : '7_days_2_renew', - recurringFinesRule : '50_cent_per_day', - maxFine : 'overdue_mid' - }, - - 'audiobook' : { - SIPMediaType : '004', - magneticMedia : 'f', - durationRule : '14_days_2_renew', - recurringFinesRule : '10_cent_per_day', - maxFine : 'overdue_mid' - }, - - 'av' : { - SIPMediaType : '005', - magneticMedia : 'f', - durationRule : '7_days_2_renew', - recurringFinesRule : '50_cent_per_day', - maxFine : 'overdue_mid' - }, - - 'new-av' : { - SIPMediaType : '005', - magneticMedia : 'f', - durationRule : '3_days_1_renew', - recurringFinesRule : '50_cent_per_day', - maxFine : 'overdue_mid' - }, +var CIRC_MOD_MAP = { 'bestseller' : { SIPMediaType : '001', magneticMedia : 'f', - durationRule : '7_days_2_renew', - recurringFinesRule : '50_cent_per_day', - maxFine : 'overdue_mid' - }, - - 'bestsellernh' : { - SIPMediaType : '001', - magneticMedia : 'f', - durationRule : '7_days_2_renew', - recurringFinesRule : '50_cent_per_day', - maxFine : 'overdue_mid' - }, - - 'book' : { - SIPMediaType : '001', - magneticMedia : 'f', - durationRule : '14_days_2_renew', - recurringFinesRule : '10_cent_per_day', - maxFine : 'overdue_mid' + durationRule : 'default' + recurringFinesRule : 'default' + maxFine : 'default' }, - - 'cd' : { - SIPMediaType : '006', - magneticMedia : 'f', - durationRule : '14_days_2_renew', - recurringFinesRule : '10_cent_per_day', - maxFine : 'overdue_mid' - }, - - 'dvd' : { - SIPMediaType : '006', - magneticMedia : 'f', - durationRule : '7_days_0_renew', - recurringFinesRule : '50_cent_per_day', - maxFine : 'overdue_mid' - }, - - 'dvd-long' : { - SIPMediaType : '006', - magneticMedia : 'f', - durationRule : '14_days_2_renew', - recurringFinesRule : '10_cent_per_day', - maxFine : 'overdue_mid' - }, - - 'e-book' : { - SIPMediaType : '001', - magneticMedia : 'f', - durationRule : '3_days_1_renew', - recurringFinesRule : '50_cent_per_day', - maxFine : 'overdue_mid' - }, - - 'equipment' : { - SIPMediaType : '000', - magneticMedia : 'f', - durationRule : '1_day_0_renew', /* make me 1 day, 0 renewal when possible */ - recurringFinesRule : '50_cent_per_day', - maxFine : 'overdue_mid' - }, - - 'equip-long' : { - SIPMediaType : '000', - magneticMedia : 'f', - durationRule : '3_days_1_renew', - recurringFinesRule : '50_cent_per_day', - maxFine : 'overdue_mid' - }, - - 'filmstrip' : { - SIPMediaType : '000', - magneticMedia : 'f', - durationRule : '14_days_2_renew', - recurringFinesRule : '10_cent_per_day', - maxFine : 'overdue_mid' - }, - - 'kit' : { - SIPMediaType : '000', - magneticMedia : 'f', - durationRule : '14_days_2_renew', - recurringFinesRule : '10_cent_per_day', - maxFine : 'overdue_mid' - }, - - 'magazine' : { - SIPMediaType : '002', - magneticMedia : 'f', - durationRule : '14_days_2_renew', - recurringFinesRule : '10_cent_per_day', - maxFine : 'overdue_mid' - }, - - 'map' : { - SIPMediaType : '000', - magneticMedia : 'f', - durationRule : '3_days_1_renew', - recurringFinesRule : '50_cent_per_day', - maxFine : 'overdue_mid' - }, - - 'microform' : { - SIPMediaType : '000', - magneticMedia : 'f', - durationRule : '14_days_2_renew', - recurringFinesRule : '10_cent_per_day', - maxFine : 'overdue_mid' - }, - - 'music' : { - SIPMediaType : '004', - magneticMedia : 'f', - durationRule : '14_days_2_renew', - recurringFinesRule : '10_cent_per_day', - maxFine : 'overdue_mid' - }, - - 'record' : { - SIPMediaType : '000', - magneticMedia : 'f', - durationRule : '14_days_2_renew', - recurringFinesRule : '10_cent_per_day', - maxFine : 'overdue_mid' - }, - - 'software' : { - SIPMediaType : '006', - magneticMedia : 'f', - durationRule : '7_days_2_renew', - recurringFinesRule : '10_cent_per_day', - maxFine : 'overdue_mid' - }, - - 'softwrlong' : { - SIPMediaType : '006', - magneticMedia : 'f', - durationRule : '14_days_2_renew', - recurringFinesRule : '10_cent_per_day', - maxFine : 'overdue_mid' - }, - - 'talking book' : { - SIPMediaType : '006', - magneticMedia : 'f', - durationRule : 'unlimited', - }, - - 'toy' : { - SIPMediaType : '000', - magneticMedia : 'f', - durationRule : '14_days_2_renew', - recurringFinesRule : '10_cent_per_day', - maxFine : 'overdue_mid' - }, - - 'video' : { - SIPMediaType : '005', - magneticMedia : 'f', - durationRule : '7_days_0_renew', - recurringFinesRule : '50_cent_per_day', - maxFine : 'overdue_mid' - }, - - 'video-long' : { - SIPMediaType : '005', - magneticMedia : 'f', - durationRule : '14_days_2_renew', - recurringFinesRule : '10_cent_per_day', - maxFine : 'overdue_mid' - }, - - 'facbestslr' : { - SIPMediaType : '001', - magneticMedia : 'f', - durationRule : '7_days_2_renew', - recurringFinesRule : '10_cent_per_day', - maxFine : 'overdue_mid' - }, - } -/* Set up rules for legacy types */ -CIRC_MOD_MAP['DEPOSIT'] = CIRC_MOD_MAP['book']; -CIRC_MOD_MAP['E-AUDIO'] = CIRC_MOD_MAP['book']; -CIRC_MOD_MAP['FACNEWBK'] = CIRC_MOD_MAP['book']; -CIRC_MOD_MAP['MAG-CIRC'] = CIRC_MOD_MAP['book']; -CIRC_MOD_MAP['MAG-NOCIRC'] = CIRC_MOD_MAP['book']; -CIRC_MOD_MAP['NEW-BOOK'] = CIRC_MOD_MAP['book']; -CIRC_MOD_MAP['NEWSPAPER'] = CIRC_MOD_MAP['book']; -CIRC_MOD_MAP['OUTREACH'] = CIRC_MOD_MAP['book']; -CIRC_MOD_MAP['PAMPHLET'] = CIRC_MOD_MAP['book']; -CIRC_MOD_MAP['PAPERBACK'] = CIRC_MOD_MAP['book']; -CIRC_MOD_MAP['RESERVE'] = CIRC_MOD_MAP['book']; -CIRC_MOD_MAP['STATE-BOOK'] = { - SIPMediaType : '001', - magneticMedia : 'f', - durationRule : '35_days_1_renew', - recurringFinesRule : "10_cent_per_day", - maxFine : "overdue_mid" -}; -CIRC_MOD_MAP['STATE-MFRM'] = { - SIPMediaType : '001', - magneticMedia : 'f', - durationRule : '14_days_2_renew', - recurringFinesRule : "10_cent_per_day", - maxFine : "overdue_mid" -}; - - - - /* this will set defaults even if no one asked for them */ log_debug("Calling getItemConfig() to force defaults.."); getItemConfig(); -log_debug("getItemConfig() set magneticMedia to "+result.magneticMedia); function getItemConfig() { - /* ----------------------------------------------------------------------------------- - If a circ_modifier is defined on the copy and we have config info for the - provided circ_modifier, use that config. Otherwise fall back on the MARC item type - ----------------------------------------------------------------------------------- */ + var config = null; var marcType = getMARCItemType(); - var itemForm = (marcXMLDoc) ? extractFixedField(marcXMLDoc,'Form') : ""; - //var circMod = (copy.circ_modifier) ? copy.circ_modifier.toLowerCase() : ''; var circMod = copy.circ_modifier; - - var config = null; - if( circMod ) { - config = CIRC_MOD_MAP[circMod]; - if(!config) - config = CIRC_MOD_MAP[circMod.toLowerCase()] - if(config) - log_info("a circ_mod config exists for the copy with mod: " + circMod); - } + if( circMod ) { + config = CIRC_MOD_MAP[circMod]; + if(!config) + config = CIRC_MOD_MAP[circMod.toLowerCase()] + } - if(!config) { - /* otherwise, fall back on the MARC item type */ - if( circMod ) - log_info("no circ_mod config found for " +circMod+", falling back to MARC"); + if(!config) config = MARC_ITEM_TYPE_MAP[marcType]; - } - - /* if no config could be found, default to 'book' */ - if(!config) { - log_warn("item_config found no circ_mod OR MARC config, defaulting to 'book'"); - config = CIRC_MOD_MAP['book']; - } - - config.maxFine = setMaxFineByCircLocation(); - /* go ahead and set some default result - data (which may be overidden) */ - for( var i in config ) { - log_debug("item_config setting result defaults: "+i+" = " +config[i]); - result[i] = config[i]; - } + if(!config) { + config = {}; + config.SIPMediaType = '001'; + config.magneticMedia = 'f'; + config.durationRule = 'default'; + config.recurringFinesRule = 'default'; + config.maxFine = 'default'; + } - return config; + return config } -function setMaxFineByCircLocation() { - var max_libs = [ 'ARL', 'DTRL', 'SJRLS' ]; - var mid_libs = [ 'CHRL', 'ECGR', 'FRRLS', 'HCLS', 'OCRL', 'OHOOP', 'OKRL', 'PMRLS', 'PPL', 'STRL' ]; - - var cl = (volume && volume.id != -1) ? volume.owning_lib : currentLocation.id; - var max_fine = null; - - for( var i = 0; i < max_libs.length; i++ ) { - var org = max_libs[i]; - if( isOrgDescendent(org, cl) ) { - log_debug("found max-fine ancestor org "+org); - max_fine = 'overdue_max'; - break; - } - } - if(!max_fine) { - for( var i = 0; i < mid_libs.length; i++ ) { - var org = mid_libs[i]; - if( isOrgDescendent(org, cl) ) { - log_debug("found mid-fine ancestor org "+org); - max_fine = 'overdue_mid'; - break; - } - } - } - - if(!max_fine) max_fine = 'overdue_min'; - - log_info("setMaxFineByCircLocation() set max_fine to "+ max_fine); - - return max_fine; -} diff --git a/Open-ILS/src/javascript/backend/circ/circ_lib.js b/Open-ILS/src/javascript/backend/circ/circ_lib.js index 28639e77a8..e7de3de019 100644 --- a/Open-ILS/src/javascript/backend/circ/circ_lib.js +++ b/Open-ILS/src/javascript/backend/circ/circ_lib.js @@ -40,6 +40,7 @@ var isRenewal = environment.isRenewal; var isPrecat = environment.isPrecat; var currentLocation = environment.location; var holdRequestLib = environment.requestLib; +var holdPickupLib = environment.pickupLib; /* hold pickup lib */ @@ -163,7 +164,6 @@ function __isGroupDescendant( parent, child ) { function getMARCItemType() { - if( copy && copy.circ_as_type && copy.circ_as_type != 'undef' ) @@ -208,15 +208,6 @@ function die(msg) { -/* -- at some point we should add a library of objects that map -codes to names (item_form, item_type, etc.) -load_lib('item_form_map.js'); -var form_name = item_form_map[env.record_descriptor.item_form]; -*/ - - - /* logs a load of info */ function log_vars( prefix ) { var str = prefix + ' : '; @@ -224,10 +215,10 @@ function log_vars( prefix ) { if(patron) { str += ' Patron=' + patron.id; str += ', Patron_Username='+ patron.usrname; - str += ', Patron_Profile Group='+ patronProfile; + str += ', Patron_Profile_Group='+ patronProfile; str += ', Patron_Fines=' + patronFines; str += ', Patron_OverdueCount=' + patronOverdueCount; - str += ', Patron_Items Out=' + patronItemsOut; + str += ', Patron_Items_Out=' + patronItemsOut; try { str += ', Patron_Barcode=' + patron.card.barcode; @@ -247,8 +238,12 @@ function log_vars( prefix ) { } catch(e) {} } - if(volume) str += ', Volume=' + volume.id; - if(title) str += ', Record=' + title.id; + if(volume) { + str += ', Item_Owning_lib=' + volume.owning_lib; + str += ', Volume=' + volume.id; + } + + if(title) str += ', Record=' + title.id; if(recDescriptor) { str += ', Record_Descriptor=' + recDescriptor.id; @@ -261,8 +256,40 @@ function log_vars( prefix ) { str += ', Is_Renewal: ' + ( (isTrue(isRenewal)) ? "yes" : "no" ); str += ', Is_Precat: ' + ( (isTrue(isPrecat)) ? "yes" : "no" ); str += (holdRequestLib) ? ', Hold_request_lib=' + holdRequestLib.shortname : ''; + str += (holdPickupLib) ? ', Hold_Pickup_Lib=' + holdPickupLib : ''; log_info(str); } + +/** + * Returns config information for the requested group. If + * no config info exists for the requested group, then this + * function searches up the tree to find the config info + * for the nearest ancestor + * @param The name of the group who's config info to return + */ +function findGroupConfig(name) { + if(!name) return null; + var node = groupList[name]; + do { + if( GROUP_CONFIG[node.name] ) { + debugGroupConfig(name, node.name, GROUP_CONFIG[node.name]); + return GROUP_CONFIG[node.name]; + } + } while( (node = groupIDList[node.parent]) ); + return null; +} + + +/** prints out the settings for the given group config **/ +function debugGroupConfig(name, foundName, config) { + if(!config) return; + var str = "findGroupConfig('"+name+"'): returning config info for '"+ foundName +"': "; + for( var i in config ) + str += i + '=' + config[i] + ' '; + log_debug(str); +} + + diff --git a/Open-ILS/src/javascript/backend/circ/circ_max_fines.js b/Open-ILS/src/javascript/backend/circ/circ_max_fines.js deleted file mode 100644 index c5d8d67d8e..0000000000 --- a/Open-ILS/src/javascript/backend/circ/circ_max_fines.js +++ /dev/null @@ -1,12 +0,0 @@ -/** XXX DEPRECATED */ - -function go() { - -/* load the lib script */ -load_lib('circ/circ_lib.js'); -log_vars('circ_max_fine'); - - -return result.maxFine = "books"; - -} go(); diff --git a/Open-ILS/src/javascript/backend/circ/circ_permit_copy.js b/Open-ILS/src/javascript/backend/circ/circ_permit_copy.js index edb48accf4..a08e897438 100644 --- a/Open-ILS/src/javascript/backend/circ/circ_permit_copy.js +++ b/Open-ILS/src/javascript/backend/circ/circ_permit_copy.js @@ -9,13 +9,6 @@ if( ! isTrue(copy.circulate) ) result.events.push('COPY_CIRC_NOT_ALLOWED'); -if( ! isOrgDescendent( 'STATELIB', copy.circ_lib.id ) ) { - if( isTrue(copy.ref) ) - result.events.push('COPY_IS_REFERENCE'); -} - - - if( ! isTrue(isRenewal) ) { if(copyStatus != 'Available' && copyStatus != 'On holds shelf' && copyStatus != 'Reshelving' ) { 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 179982a29e..8de1cd0333 100644 --- a/Open-ILS/src/javascript/backend/circ/circ_permit_hold.js +++ b/Open-ILS/src/javascript/backend/circ/circ_permit_hold.js @@ -4,16 +4,6 @@ load_lib('circ/circ_lib.js'); log_vars('circ_permit_hold'); - -/* non-staff members are allowed 50 open holds at most */ -if( ! isGroupDescendant('Staff', patronProfile) ) { - var count = userHoldCount(patron.id); - log_info("patron has " + count + " open holds"); - if( count >= 50 ) - result.events.push('MAX_HOLDS'); -} - - if( isTrue(patron.barred) ) result.events.push('PATRON_BARRED'); @@ -23,60 +13,8 @@ if( isTrue(copy.ref) ) if( !isTrue(copy.circulate) ) result.events.push('ITEM_NOT_HOLDABLE'); -/* all STATELIB items are holdable regardless of type */ -if( isOrgDescendent('STATELIB', copy.circ_lib.id) ) return; - -var mod = (copy.circ_modifier) ? copy.circ_modifier.toLowerCase() : ""; - -log_info("circ-modifier = "+mod); - -if( mod == 'bestsellernh' ) - result.events.push('ITEM_NOT_HOLDABLE'); - -var marcItemType = getMARCItemType(); -var isAnc; -if( ( marcItemType == 'g' || - marcItemType == 'i' || - marcItemType == 'j' || - mod == 'softwrlong' || - mod == 'music' || - mod == 'audiobook' || - mod == 'av' || - mod == 'new-av' || - mod == 'cd' || - mod == 'kit' || - mod == 'dvd' || - mod == 'deposit' || - mod == 'atlas' || - mod == 'magazine' || - mod == 'equipment' || - mod == 'equip-long' || - mod == 'microform' || - mod == 'record' || - isTrue(copy.deposit) || - mod == 'video-long' || - mod == 'video' ) ) { - - isAnc = hasCommonAncestor( copy.circ_lib.id, patron.home_ou.id, 1 ); - - if( isAnc) { - log_info("patron and copy circ_lib share a common ancestor, hold allowed"); - - } else { - log_info("patron and copy circ_lib do NOT share a common ancestor"); - - if( hasCommonAncestor( copy.circ_lib.id, holdRequestLib.id, 1) ) { - log_info("request_lib and copy circ_lib DO share a common ancestor"); - - } else { - - log_info("request_lib and copy circ_lib also do NOT share a common ancestor, hold on this type of material not allowed"); - result.events.push('ITEM_NOT_HOLDABLE'); - } - } -} +} go(); -} 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 8b8cd43246..3ea5ddbd6d 100644 --- a/Open-ILS/src/javascript/backend/circ/circ_permit_patron.js +++ b/Open-ILS/src/javascript/backend/circ/circ_permit_patron.js @@ -5,30 +5,11 @@ load_lib('circ/circ_lib.js'); log_vars('circ_permit_patron'); - if( isTrue(patron.barred) ) result.events.push('PATRON_BARRED'); - -/* --------------------------------------------------------------------- - Check the items out count - --------------------------------------------------------------------- */ var config = findGroupConfig(patronProfile); -if( config ) { - - var limit = config.maxItemsOut; - if( limit >= 0 ) { - /* Patrons are allowed to renew regardless - of how many items they have checked out */ - 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); -} +/* inspect the config too see if this patron should be allowed */ } go(); diff --git a/Open-ILS/src/javascript/backend/circ/circ_permit_renew.js b/Open-ILS/src/javascript/backend/circ/circ_permit_renew.js index 7f61d923d3..aca8de0e9e 100644 --- a/Open-ILS/src/javascript/backend/circ/circ_permit_renew.js +++ b/Open-ILS/src/javascript/backend/circ/circ_permit_renew.js @@ -4,12 +4,4 @@ function go() { load_lib('circ/circ_lib.js'); log_vars('circ_permit_renew'); -log_info("permit_renew searching for potential holds for copy " + copy.barcode) -var hold = copy.fetchBestHold(); -if( hold ) { - log_info("hold found for renewal item, checking hold->usr.."); - if( hold && hold.usr != patron.id ) - return result.events.push('COPY_NEEDED_FOR_HOLD'); -} - } go(); diff --git a/Open-ILS/src/javascript/backend/circ/circ_recurring_fines.js b/Open-ILS/src/javascript/backend/circ/circ_recurring_fines.js deleted file mode 100644 index ad7d24d3c8..0000000000 --- a/Open-ILS/src/javascript/backend/circ/circ_recurring_fines.js +++ /dev/null @@ -1,20 +0,0 @@ -/** XXX DEPRECATED */ - - -function go() { - -/* load the lib script */ -load_lib('circ/circ_lib.js'); -log_vars('circ_recurring_fines'); - -/** -Set some sane defaults. Valid values for result.recurringFinesLevel -are low, nornal, and high -*/ -result.recurringFinesRule = "books"; -result.recurringFinesLevel = 'normal'; - - -return; - -} go(); -- 2.43.2