function go(){
-load_lib('circ/circ_lib.js');
+load_lib('circ/circ_item_config.js');
log_vars('circ_duration');
-/* -----------------------------------------------------------------------------
- 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] */
- durationRule : '14_days_2_renew',
- recurringFinesRule : '10_cent_per_day',
- maxFine : 'overdue_mid'
- },
-
- t : { /* Manuscript language material [Books] */
- durationRule : '14_days_2_renew',
- recurringFinesRule : '10_cent_per_day',
- maxFine : 'overdue_mid'
- },
-
- g : { /* Projected medium [Videos, etc.] */
- durationRule : '7_days_0_renew',
- recurringFinesRule : '10_cent_per_day',
- maxFine : 'overdue_mid'
- },
-
- k : { /* Two-dimensional nonprojectable graphic [Card, charts, etc.] */
- durationRule : '3_month_0_renew',
- recurringFinesRule : '10_cent_per_day',
- maxFine : 'overdue_mid'
- },
-
- r : { /* Three-dimensional artifact or naturally occurring object [Models, games, etc.] */
- durationRule : '14_days_2_renew',
- recurringFinesRule : '10_cent_per_day',
- maxFine : 'overdue_mid'
- },
-
- o : { /* Kit [Mixture of item types] */
- durationRule : '14_days_2_renew',
- recurringFinesRule : '10_cent_per_day',
- maxFine : 'overdue_mid'
- },
-
- p : { /* Mixed materials [Mixture of item types] */
- durationRule : '14_days_2_renew',
- recurringFinesRule : '10_cent_per_day',
- maxFine : 'overdue_mid'
- },
-
- e : { /* Cartographic material [Map] */
- durationRule : '7_days_2_renew',
- recurringFinesRule : '50_cent_per_day',
- maxFine : 'overdue_mid'
- },
-
- f : { /* Manuscript cartographic material [Map] */
- durationRule : '3_days_1_renew',
- recurringFinesRule : '50_cent_per_day',
- maxFine : 'overdue_mid'
- },
-
- c : { /* Notated music [Printed music] */
- durationRule : '14_days_2_renew',
- recurringFinesRule : '10_cent_per_day',
- maxFine : 'overdue_mid'
- },
-
- d : { /* Manuscript notated music [Printed music] */
- durationRule : '14_days_2_renew',
- recurringFinesRule : '10_cent_per_day',
- maxFine : 'overdue_mid'
- },
-
- i : { /* Nonmusical sound recording [Audiobooks, sound effects, etc.] */
- durationRule : '14_days_2_renew',
- recurringFinesRule : '10_cent_per_day',
- maxFine : 'overdue_mid'
- },
-
- j : { /* Musical sound recording [Music] */
- durationRule : '14_days_2_renew',
- recurringFinesRule : '10_cent_per_day',
- maxFine : 'overdue_mid'
- },
-
- m : { /* Computer file */
- durationRule : '14_days_2_renew',
- recurringFinesRule : '10_cent_per_day',
- maxFine : 'overdue_mid'
- }
-}
-
-
-var CIRC_MOD_MAP = {
-
- 'art' : {
- durationRule : '3_month_0_renew',
- recurringFinesRule : '10_cent_per_day',
- maxFine : 'overdue_mid'
- },
-
- 'atlas' : {
- durationRule : '7_days_2_renew',
- recurringFinesRule : '50_cent_per_day',
- maxFine : 'overdue_mid'
- },
-
- 'audiobook' : {
- durationRule : '14_days_2_renew',
- recurringFinesRule : '10_cent_per_day',
- maxFine : 'overdue_mid'
- },
-
- 'av' : {
- durationRule : '7_days_2_renew',
- recurringFinesRule : '50_cent_per_day',
- maxFine : 'overdue_mid'
- },
-
- 'bestseller' : {
- durationRule : '7_days_2_renew',
- recurringFinesRule : '50_cent_per_day',
- maxFine : 'overdue_mid'
- },
-
- 'bestsellernh' : {
- durationRule : '7_days_2_renew',
- recurringFinesRule : '50_cent_per_day',
- maxFine : 'overdue_mid'
- },
-
- 'book' : {
- durationRule : '14_days_2_renew',
- recurringFinesRule : '10_cent_per_day',
- maxFine : 'overdue_mid'
- },
-
- 'cd' : {
- durationRule : '14_days_2_renew',
- recurringFinesRule : '10_cent_per_day',
- maxFine : 'overdue_mid'
- },
-
- 'dvd' : {
- durationRule : '7_days_0_renew',
- recurringFinesRule : '50_cent_per_day',
- maxFine : 'overdue_mid'
- },
-
- 'e-book' : {
- durationRule : '3_days_1_renew',
- recurringFinesRule : '50_cent_per_day',
- maxFine : 'overdue_mid'
- },
-
- 'equipment' : {
- durationRule : '3_days_1_renew',
- recurringFinesRule : '50_cent_per_day',
- maxFine : 'overdue_mid'
- },
-
- 'filmstrip' : {
- durationRule : '14_days_2_renew',
- recurringFinesRule : '10_cent_per_day',
- maxFine : 'overdue_mid'
- },
-
- 'kit' : {
- durationRule : '14_days_2_renew',
- recurringFinesRule : '10_cent_per_day',
- maxFine : 'overdue_mid'
- },
-
- 'magazine' : {
- durationRule : '14_days_2_renew',
- recurringFinesRule : '10_cent_per_day',
- maxFine : 'overdue_mid'
- },
-
- 'map' : {
- durationRule : '3_days_1_renew',
- recurringFinesRule : '50_cent_per_day',
- maxFine : 'overdue_mid'
- },
-
- 'microform' : {
- durationRule : '14_days_2_renew',
- recurringFinesRule : '10_cent_per_day',
- maxFine : 'overdue_mid'
- },
-
- 'music' : {
- durationRule : '14_days_2_renew',
- recurringFinesRule : '10_cent_per_day',
- maxFine : 'overdue_mid'
- },
-
- 'record' : {
- durationRule : '14_days_2_renew',
- recurringFinesRule : '10_cent_per_day',
- maxFine : 'overdue_mid'
- },
-
- 'software' : {
- durationRule : '7_days_2_renew',
- recurringFinesRule : '10_cent_per_day',
- maxFine : 'overdue_mid'
- },
-
- 'talking book' : {
- durationRule : 'unlimited',
- },
-
- 'toy' : {
- durationRule : '7_days_2_renew',
- recurringFinesRule : '50_cent_per_day',
- maxFine : 'overdue_mid'
- },
-
- 'video' : {
- durationRule : '7_days_0_renew',
- recurringFinesRule : '50_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['EQUIP'] = CIRC_MOD_MAP['book'];
-CIRC_MOD_MAP['FACBESTSLR'] = 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-AV'] = CIRC_MOD_MAP['book'];
-CIRC_MOD_MAP['NEW-BOOK'] = CIRC_MOD_MAP['book'];
-CIRC_MOD_MAP['NEWSPAPER'] = CIRC_MOD_MAP['book'];
-CIRC_MOD_MAP['NILS-ITEM'] = 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['REALIA'] = CIRC_MOD_MAP['book'];
-CIRC_MOD_MAP['RESERVE'] = CIRC_MOD_MAP['book'];
-CIRC_MOD_MAP['STATE-BOOK'] = {
- durationRule : '35_days_1_renew',
- recurringFinesRule : "10_cent_per_day",
- maxFine : "overdue_mid"
-};
-CIRC_MOD_MAP['STATE-MFRM'] = {
- durationRule : '14_days_2_renew',
- recurringFinesRule : "10_cent_per_day",
- maxFine : "overdue_mid"
-};
-
-
-
/* treat pre-cat copies like vanilla books */
if( isTrue(isPrecat) ) {
}
-/* -----------------------------------------------------------------------------------
- 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 marcType = getMARCItemType();
-var circMod = copy.circ_modifier;
-var itemForm = (marcXMLDoc) ? extractFixedField(marcXMLDoc,'Form') : "";
-
-
-var config;
-
-if( circMod && CIRC_MOD_MAP[circMod.toLowerCase()] ) {
- /* if we have a config for the given circ_modifier, use it */
- log_debug("a circ_mod config exists for the copy: " + circMod);
- config = CIRC_MOD_MAP[circMod];
-
-} else {
- /* otherwise, fall back on the MARC item type */
-
- if( circMod ) {
- log_debug("no circ_mod config found for "
- +circMod+", falling back to MARC");
- }
- config = MARC_ITEM_TYPE_MAP[marcType];
-}
-
+/* grab the config from the config script */
+var config = getItemConfig();
/* -----------------------------------------------------------------------------
-
/* -----------------------------------------------------------------------------
Add custom rules here.
----------------------------------------------------------------------------- */
--- /dev/null
+load_lib('circ/circ_lib.js');
+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] */
+ magneticMedia : 'f',
+ durationRule : '14_days_2_renew',
+ recurringFinesRule : '10_cent_per_day',
+ maxFine : 'overdue_mid'
+ },
+
+ t : { /* Manuscript language material [Books] */
+ magneticMedia : 'f',
+ durationRule : '14_days_2_renew',
+ recurringFinesRule : '10_cent_per_day',
+ maxFine : 'overdue_mid'
+ },
+
+ g : { /* Projected medium [Videos, etc.] */
+ magneticMedia : 'f',
+ durationRule : '7_days_0_renew',
+ recurringFinesRule : '10_cent_per_day',
+ maxFine : 'overdue_mid'
+ },
+
+ k : { /* Two-dimensional nonprojectable graphic [Card, charts, etc.] */
+ 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.] */
+ magneticMedia : 'f',
+ durationRule : '14_days_2_renew',
+ recurringFinesRule : '10_cent_per_day',
+ maxFine : 'overdue_mid'
+ },
+
+ o : { /* Kit [Mixture of item types] */
+ magneticMedia : 'f',
+ durationRule : '14_days_2_renew',
+ recurringFinesRule : '10_cent_per_day',
+ maxFine : 'overdue_mid'
+ },
+
+ p : { /* Mixed materials [Mixture of item types] */
+ magneticMedia : 'f',
+ durationRule : '14_days_2_renew',
+ recurringFinesRule : '10_cent_per_day',
+ maxFine : 'overdue_mid'
+ },
+
+ e : { /* Cartographic material [Map] */
+ magneticMedia : 'f',
+ durationRule : '7_days_2_renew',
+ recurringFinesRule : '50_cent_per_day',
+ maxFine : 'overdue_mid'
+ },
+
+ f : { /* Manuscript cartographic material [Map] */
+ magneticMedia : 'f',
+ durationRule : '3_days_1_renew',
+ recurringFinesRule : '50_cent_per_day',
+ maxFine : 'overdue_mid'
+ },
+
+ c : { /* Notated music [Printed music] */
+ magneticMedia : 'f',
+ durationRule : '14_days_2_renew',
+ recurringFinesRule : '10_cent_per_day',
+ maxFine : 'overdue_mid'
+ },
+
+ d : { /* Manuscript notated music [Printed music] */
+ magneticMedia : 'f',
+ durationRule : '14_days_2_renew',
+ recurringFinesRule : '10_cent_per_day',
+ maxFine : 'overdue_mid'
+ },
+
+ i : { /* Nonmusical sound recording [Audiobooks, sound effects, etc.] */
+ magneticMedia : 'f',
+ durationRule : '14_days_2_renew',
+ recurringFinesRule : '10_cent_per_day',
+ maxFine : 'overdue_mid'
+ },
+
+ j : { /* Musical sound recording [Music] */
+ magneticMedia : 'f',
+ durationRule : '14_days_2_renew',
+ recurringFinesRule : '10_cent_per_day',
+ maxFine : 'overdue_mid'
+ },
+
+ m : { /* Computer file */
+ magneticMedia : 'f',
+ durationRule : '14_days_2_renew',
+ recurringFinesRule : '10_cent_per_day',
+ maxFine : 'overdue_mid'
+ }
+}
+
+
+var CIRC_MOD_MAP = {
+
+ 'art' : {
+ magneticMedia : 'f',
+ durationRule : '3_month_0_renew',
+ recurringFinesRule : '10_cent_per_day',
+ maxFine : 'overdue_mid'
+ },
+
+ 'atlas' : {
+ magneticMedia : 'f',
+ durationRule : '7_days_2_renew',
+ recurringFinesRule : '50_cent_per_day',
+ maxFine : 'overdue_mid'
+ },
+
+ 'audiobook' : {
+ magneticMedia : 'f',
+ durationRule : '14_days_2_renew',
+ recurringFinesRule : '10_cent_per_day',
+ maxFine : 'overdue_mid'
+ },
+
+ 'av' : {
+ magneticMedia : 'f',
+ durationRule : '7_days_2_renew',
+ recurringFinesRule : '50_cent_per_day',
+ maxFine : 'overdue_mid'
+ },
+
+ 'bestseller' : {
+ magneticMedia : 'f',
+ durationRule : '7_days_2_renew',
+ recurringFinesRule : '50_cent_per_day',
+ maxFine : 'overdue_mid'
+ },
+
+ 'bestsellernh' : {
+ magneticMedia : 'f',
+ durationRule : '7_days_2_renew',
+ recurringFinesRule : '50_cent_per_day',
+ maxFine : 'overdue_mid'
+ },
+
+ 'book' : {
+ magneticMedia : 'f',
+ durationRule : '14_days_2_renew',
+ recurringFinesRule : '10_cent_per_day',
+ maxFine : 'overdue_mid'
+ },
+
+ 'cd' : {
+ magneticMedia : 'f',
+ durationRule : '14_days_2_renew',
+ recurringFinesRule : '10_cent_per_day',
+ maxFine : 'overdue_mid'
+ },
+
+ 'dvd' : {
+ magneticMedia : 'f',
+ durationRule : '7_days_0_renew',
+ recurringFinesRule : '50_cent_per_day',
+ maxFine : 'overdue_mid'
+ },
+
+ 'e-book' : {
+ magneticMedia : 'f',
+ durationRule : '3_days_1_renew',
+ recurringFinesRule : '50_cent_per_day',
+ maxFine : 'overdue_mid'
+ },
+
+ 'equipment' : {
+ magneticMedia : 'f',
+ durationRule : '3_days_1_renew',
+ recurringFinesRule : '50_cent_per_day',
+ maxFine : 'overdue_mid'
+ },
+
+ 'filmstrip' : {
+ magneticMedia : 'f',
+ durationRule : '14_days_2_renew',
+ recurringFinesRule : '10_cent_per_day',
+ maxFine : 'overdue_mid'
+ },
+
+ 'kit' : {
+ magneticMedia : 'f',
+ durationRule : '14_days_2_renew',
+ recurringFinesRule : '10_cent_per_day',
+ maxFine : 'overdue_mid'
+ },
+
+ 'magazine' : {
+ magneticMedia : 'f',
+ durationRule : '14_days_2_renew',
+ recurringFinesRule : '10_cent_per_day',
+ maxFine : 'overdue_mid'
+ },
+
+ 'map' : {
+ magneticMedia : 'f',
+ durationRule : '3_days_1_renew',
+ recurringFinesRule : '50_cent_per_day',
+ maxFine : 'overdue_mid'
+ },
+
+ 'microform' : {
+ magneticMedia : 'f',
+ durationRule : '14_days_2_renew',
+ recurringFinesRule : '10_cent_per_day',
+ maxFine : 'overdue_mid'
+ },
+
+ 'music' : {
+ magneticMedia : 'f',
+ durationRule : '14_days_2_renew',
+ recurringFinesRule : '10_cent_per_day',
+ maxFine : 'overdue_mid'
+ },
+
+ 'record' : {
+ magneticMedia : 'f',
+ durationRule : '14_days_2_renew',
+ recurringFinesRule : '10_cent_per_day',
+ maxFine : 'overdue_mid'
+ },
+
+ 'software' : {
+ magneticMedia : 'f',
+ durationRule : '7_days_2_renew',
+ recurringFinesRule : '10_cent_per_day',
+ maxFine : 'overdue_mid'
+ },
+
+ 'talking book' : {
+ magneticMedia : 'f',
+ durationRule : 'unlimited',
+ },
+
+ 'toy' : {
+ magneticMedia : 'f',
+ durationRule : '7_days_2_renew',
+ recurringFinesRule : '50_cent_per_day',
+ maxFine : 'overdue_mid'
+ },
+
+ 'video' : {
+ magneticMedia : 'f',
+ durationRule : '7_days_0_renew',
+ recurringFinesRule : '50_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['EQUIP'] = CIRC_MOD_MAP['book'];
+CIRC_MOD_MAP['FACBESTSLR'] = 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-AV'] = CIRC_MOD_MAP['book'];
+CIRC_MOD_MAP['NEW-BOOK'] = CIRC_MOD_MAP['book'];
+CIRC_MOD_MAP['NEWSPAPER'] = CIRC_MOD_MAP['book'];
+CIRC_MOD_MAP['NILS-ITEM'] = 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['REALIA'] = CIRC_MOD_MAP['book'];
+CIRC_MOD_MAP['RESERVE'] = CIRC_MOD_MAP['book'];
+CIRC_MOD_MAP['STATE-BOOK'] = {
+ magneticMedia : 'f',
+ durationRule : '35_days_1_renew',
+ recurringFinesRule : "10_cent_per_day",
+ maxFine : "overdue_mid"
+};
+CIRC_MOD_MAP['STATE-MFRM'] = {
+ magneticMedia : 'f',
+ durationRule : '14_days_2_renew',
+ recurringFinesRule : "10_cent_per_day",
+ maxFine : "overdue_mid"
+};
+
+
+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 marcType = getMARCItemType();
+ var circMod = copy.circ_modifier;
+ var itemForm = (marcXMLDoc) ? extractFixedField(marcXMLDoc,'Form') : "";
+
+ var config;
+
+ if( circMod && CIRC_MOD_MAP[circMod.toLowerCase()] ) {
+ /* if we have a config for the given circ_modifier, use it */
+ log_debug("a circ_mod config exists for the copy: " + circMod);
+ config = CIRC_MOD_MAP[circMod];
+
+ } else {
+ /* otherwise, fall back on the MARC item type */
+
+ if( circMod ) {
+ log_debug("no circ_mod config found for "
+ +circMod+", falling back to MARC");
+ }
+ config = MARC_ITEM_TYPE_MAP[marcType];
+ }
+
+ if( config ) {
+ /* go ahead and set some default result
+ data (which may be overidden) */
+ for( var i in config )
+ result[i] = config[i];
+ }
+
+ return config;
+}
+
+