From: erickson Date: Mon, 17 Jul 2006 16:51:59 +0000 (+0000) Subject: adding file X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=b0468b96031d888bd84bbf59b820a5cb1a6c5475;p=Evergreen.git adding file git-svn-id: svn://svn.open-ils.org/ILS/trunk@5042 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/javascript/backend/circ/circ_groups.js b/Open-ILS/src/javascript/backend/circ/circ_groups.js new file mode 100644 index 0000000000..93e783cca5 --- /dev/null +++ b/Open-ILS/src/javascript/backend/circ/circ_groups.js @@ -0,0 +1,142 @@ +/* --------------------------------------------------------------------- + Set up the limits for the various profiles (aka permission groups). + Values of -1 mean there is no limit + + maxItemsOut - the maximum number of items the user can have out + fineThreshold - the fine threshold. + overdueThreshold - the overdue items threshold. + maxHolds - The maximum number of holds the user can have + + A user exceeds the fineThreshold and/or overdueThreshold if they are + equal to or exceed the threshold + --------------------------------------------------------------------- */ + +var GROUP_CONFIG = { + + 'Patron' : { + maxItemsOut : 10, + fineThreshold : 10, + overdueThreshold : 10, + maxHolds : -1 + }, + + 'Class' : { + maxItemsOut : 50, + fineThreshold : 10, + overdueThreshold : 10, + maxHolds : 15 + }, + + 'Friend' : { + maxItemsOut : 10, + fineThreshold : 10, + overdueThreshold : 10, + maxHolds : -1 + }, + + 'NonResident' : { + maxItemsOut : 10, + fineThreshold : 10, + overdueThreshold : 10, + maxHolds : -1 + }, + + 'OutOfState' : { + maxItemsOut : 10, + fineThreshold : 10, + overdueThreshold : 10, + maxHolds : -1 + }, + + 'Outreach' : { + maxItemsOut : -1, + fineThreshold : -1, + overdueThreshold : -1, + maxHolds : 15 + }, + + + 'Restricted' : { + maxItemsOut : 2, + fineThreshold : 0.01, + overdueThreshold : 0, + maxHolds : 5 + }, + + 'Temp' : { + maxItemsOut : 5, + fineThreshold : .01, + overdueThreshold : 1, + maxHolds : 5 + }, + + 'TempRes6' : { + maxItemsOut : 10, + fineThreshold : 10, + overdueThreshold : 10, + maxHolds : -1 + }, + + 'tempRes12' : { + maxItemsOut : 10, + fineThreshold : 10, + overdueThreshold : 10, + maxHolds : -1 + }, + + 'Trustee' : { + maxItemsOut : 10, + 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); +} + + + +