load_lib('circ/circ_lib.js');
log_debug('loading circ_item_config.js ...');
+
+/* SIP media types
+000 Other
+001 Book
+002 Magazine
+003 Bound journal
+004 Audio tape
+005 Video tape
+006 CD/CDROM
+007 Diskette
+008 Book with diskette
+009 Book with CD
+010 Book with audio tape
+*/
+
/* -----------------------------------------------------------------------------
Configure the duration rules for the various item types and circ modifiers
var MARC_ITEM_TYPE_MAP = {
a : { /* Language material [Books] */
+ SIPMediaType : '001',
magneticMedia : 'f',
durationRule : '14_days_2_renew',
recurringFinesRule : '10_cent_per_day',
},
t : { /* Manuscript language material [Books] */
+ SIPMediaType : '001',
magneticMedia : 'f',
durationRule : '14_days_2_renew',
recurringFinesRule : '10_cent_per_day',
},
g : { /* Projected medium [Videos, etc.] */
+ SIPMediaType : '005',
magneticMedia : 'f',
durationRule : '7_days_0_renew',
recurringFinesRule : '10_cent_per_day',
},
k : { /* Two-dimensional nonprojectable graphic [Card, charts, etc.] */
+ SIPMediaType : '001',
magneticMedia : 'f',
durationRule : '3_month_0_renew',
recurringFinesRule : '10_cent_per_day',
},
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',
},
o : { /* Kit [Mixture of item types] */
+ SIPMediaType : '001',
magneticMedia : 'f',
durationRule : '14_days_2_renew',
recurringFinesRule : '10_cent_per_day',
},
p : { /* Mixed materials [Mixture of item types] */
+ SIPMediaType : '001',
magneticMedia : 'f',
durationRule : '14_days_2_renew',
recurringFinesRule : '10_cent_per_day',
},
e : { /* Cartographic material [Map] */
+ SIPMediaType : '001',
magneticMedia : 'f',
durationRule : '7_days_2_renew',
recurringFinesRule : '50_cent_per_day',
},
f : { /* Manuscript cartographic material [Map] */
+ SIPMediaType : '001',
magneticMedia : 'f',
durationRule : '3_days_1_renew',
recurringFinesRule : '50_cent_per_day',
},
c : { /* Notated music [Printed music] */
+ SIPMediaType : '001',
magneticMedia : 'f',
durationRule : '14_days_2_renew',
recurringFinesRule : '10_cent_per_day',
},
d : { /* Manuscript notated music [Printed music] */
+ SIPMediaType : '001',
magneticMedia : 'f',
durationRule : '14_days_2_renew',
recurringFinesRule : '10_cent_per_day',
},
i : { /* Nonmusical sound recording [Audiobooks, sound effects, etc.] */
+ SIPMediaType : '001',
magneticMedia : 'f',
durationRule : '14_days_2_renew',
recurringFinesRule : '10_cent_per_day',
},
j : { /* Musical sound recording [Music] */
+ SIPMediaType : '001',
magneticMedia : 'f',
durationRule : '14_days_2_renew',
recurringFinesRule : '10_cent_per_day',
},
m : { /* Computer file */
+ SIPMediaType : '001',
magneticMedia : 'f',
durationRule : '14_days_2_renew',
recurringFinesRule : '10_cent_per_day',
var CIRC_MOD_MAP = {
'art' : {
+ SIPMediaType : '000',
magneticMedia : 'f',
durationRule : '3_month_0_renew',
recurringFinesRule : '10_cent_per_day',
},
'atlas' : {
+ SIPMediaType : '000',
magneticMedia : 'f',
durationRule : '7_days_2_renew',
recurringFinesRule : '50_cent_per_day',
},
'audiobook' : {
+ SIPMediaType : '004',
magneticMedia : 'f',
durationRule : '14_days_2_renew',
recurringFinesRule : '10_cent_per_day',
},
'av' : {
+ SIPMediaType : '005',
magneticMedia : 'f',
durationRule : '7_days_2_renew',
recurringFinesRule : '50_cent_per_day',
},
'bestseller' : {
+ SIPMediaType : '001',
magneticMedia : 'f',
durationRule : '7_days_2_renew',
recurringFinesRule : '50_cent_per_day',
},
'bestsellernh' : {
+ SIPMediaType : '001',
magneticMedia : 'f',
durationRule : '7_days_2_renew',
recurringFinesRule : '50_cent_per_day',
},
'book' : {
+ SIPMediaType : '001',
magneticMedia : 'f',
durationRule : '14_days_2_renew',
recurringFinesRule : '10_cent_per_day',
},
'cd' : {
+ SIPMediaType : '006',
magneticMedia : 'f',
durationRule : '14_days_2_renew',
recurringFinesRule : '10_cent_per_day',
},
'dvd' : {
+ SIPMediaType : '006',
magneticMedia : 'f',
- durationRule : '7_days_0_renew',
+ durationRule : '7_days_2_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',
},
'equipment' : {
+ SIPMediaType : '000',
magneticMedia : 'f',
durationRule : '3_days_1_renew',
recurringFinesRule : '50_cent_per_day',
},
'filmstrip' : {
+ SIPMediaType : '000',
magneticMedia : 'f',
durationRule : '14_days_2_renew',
recurringFinesRule : '10_cent_per_day',
},
'kit' : {
+ SIPMediaType : '000',
magneticMedia : 'f',
durationRule : '14_days_2_renew',
recurringFinesRule : '10_cent_per_day',
},
'magazine' : {
+ SIPMediaType : '002',
magneticMedia : 'f',
durationRule : '14_days_2_renew',
recurringFinesRule : '10_cent_per_day',
},
'map' : {
+ SIPMediaType : '000',
magneticMedia : 'f',
durationRule : '3_days_1_renew',
recurringFinesRule : '50_cent_per_day',
},
'microform' : {
+ SIPMediaType : '000',
magneticMedia : 'f',
durationRule : '14_days_2_renew',
recurringFinesRule : '10_cent_per_day',
},
'music' : {
+ SIPMediaType : '004',
magneticMedia : 'f',
durationRule : '14_days_2_renew',
recurringFinesRule : '10_cent_per_day',
},
'record' : {
+ SIPMediaType : '000',
magneticMedia : 'f',
durationRule : '14_days_2_renew',
recurringFinesRule : '10_cent_per_day',
},
'software' : {
+ SIPMediaType : '006',
magneticMedia : 'f',
durationRule : '7_days_2_renew',
recurringFinesRule : '10_cent_per_day',
},
'talking book' : {
+ SIPMediaType : '006',
magneticMedia : 'f',
durationRule : 'unlimited',
},
'toy' : {
+ SIPMediaType : '000',
magneticMedia : 'f',
durationRule : '7_days_2_renew',
recurringFinesRule : '50_cent_per_day',
},
'video' : {
+ SIPMediaType : '005',
magneticMedia : 'f',
- durationRule : '7_days_0_renew',
+ durationRule : '7_days_2_renew',
+ recurringFinesRule : '50_cent_per_day',
+ maxFine : 'overdue_mid'
+ },
+
+ 'video-long' : {
+ SIPMediaType : '005',
+ magneticMedia : 'f',
+ durationRule : '14_days_2_renew',
recurringFinesRule : '50_cent_per_day',
maxFine : 'overdue_mid'
},
CIRC_MOD_MAP['REALIA'] = 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() {
provided circ_modifier, use that config. Otherwise fall back on the MARC item type
----------------------------------------------------------------------------------- */
var marcType = getMARCItemType();
- var circMod = copy.circ_modifier;
+ var circMod = (copy.circ_modifier) ? copy.circ_modifier.toLowerCase() : '';
var itemForm = (marcXMLDoc) ? extractFixedField(marcXMLDoc,'Form') : "";
var config;
- if( circMod && CIRC_MOD_MAP[circMod.toLowerCase()] ) {
+ if( circMod && CIRC_MOD_MAP[circMod] ) {
/* 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];
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];
+ /* 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'];
+ }
+
+ /* 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];
}
return config;