From: erickson Date: Thu, 12 Oct 2006 21:08:49 +0000 (+0000) Subject: added max-fine logic to make the max-fine rule depend on the owning lib of the copy X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=6eadc515937afaa0572aae71ecf7e46cf53c28ed;p=evergreen%2Fpines.git added max-fine logic to make the max-fine rule depend on the owning lib of the copy git-svn-id: svn://svn.open-ils.org/ILS/trunk@6455 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- 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 1eec356c8d..7d1aa44c37 100644 --- a/Open-ILS/src/javascript/backend/circ/circ_item_config.js +++ b/Open-ILS/src/javascript/backend/circ/circ_item_config.js @@ -422,6 +422,8 @@ function getItemConfig() { 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 ) { @@ -433,3 +435,38 @@ function getItemConfig() { } +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; +} + +