From: dbs Date: Fri, 6 Mar 2009 04:36:56 +0000 (+0000) Subject: Add basic circulation rule tests X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=4e161ccec9c578de64e643bd35087c4e94afd73c;p=contrib%2FConifer.git Add basic circulation rule tests git-svn-id: svn://svn.open-ils.org/ILS-Contrib/conifer/trunk@140 6d9bc8c9-1ec2-4278-b937-99fde70a366f --- diff --git a/circ/circ_duration.js b/circ/circ_duration.js new file mode 100755 index 0000000000..137546d02e --- /dev/null +++ b/circ/circ_duration.js @@ -0,0 +1,62 @@ +function go(){ + +load_lib('circ/circ_item_config.js'); +load_lib('JSON_v1.js'); +log_vars('circ_duration'); + + +/* treat pre-cat copies like vanilla books */ +if( isTrue(isPrecat) ) { + log_info("pre-cat copy getting duration defaults..."); + result.durationRule = 'default'; + result.recurringFinesRule = 'default'; + result.maxFine = 'default' + return; +} + + +/* grab the config from the config script */ +var config = getItemConfig(); +var itemForm = (marcXMLDoc) ? extractFixedField(marcXMLDoc,'Form') : ""; + + +/* ----------------------------------------------------------------------------- + Now set the rule values based on the config. If there is no configured info + on this copy, fall back on defaults. + ----------------------------------------------------------------------------- */ +if( config ) { + + log_debug("circ_duration found a config for the copy"); + result.durationRule = config.durationRule; + result.recurringFinesRule = config.recurringFinesRule; + result.maxFine = config.maxFine; + +} else { + + result.durationRule = 'default'; + result.recurringFinesRule = 'default'; + result.maxFine = 'default'; +} + +if (patronProfile == 'Faculty') { + result.durationRule = '120_days_2_renew'; +} +if (patronProfile == 'Graduate students') { + result.durationRule = '120_days_2_renew'; +} +if (patronProfile == 'Undergraduate students') { + result.durationRule = '3_weeks_2_renew'; +} +if (patronProfile == 'Guest borrowers') { + result.durationRule = '3_weeks_2_renew'; +} + + +log_info('final duration results: ' + + result.durationRule + ' : ' + result.recurringFinesRule + ' : ' + result.maxFine ); + +} go(); + + + + diff --git a/circ/circ_groups.js b/circ/circ_groups.js new file mode 100755 index 0000000000..a99f21fb39 --- /dev/null +++ b/circ/circ_groups.js @@ -0,0 +1,46 @@ +/* --------------------------------------------------------------------- + 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 : 50, + fineThreshold : 10, + overdueThreshold : 1, + maxHolds : -1 + }, + 'Faculty' : { + maxItemsOut : 50, + fineThreshold : 10, + overdueThreshold : 1, + maxHolds : -1 + }, + 'Graduate students' : { + maxItemsOut : 50, + fineThreshold : 10, + overdueThreshold : 1, + maxHolds : -1 + }, + 'Undergraduate students' : { + maxItemsOut : 30, + fineThreshold : 10, + overdueThreshold : 1, + maxHolds : -1 + }, + 'Guest borrowers' : { + maxItemsOut : 15, + fineThreshold : 10, + overdueThreshold : 1, + maxHolds : -1 + }, + +}