]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/javascript/backend/circ/circ_item_config.js
9cfd9463eec0a1f1441443d8f5a588840a079c16
[Evergreen.git] / Open-ILS / src / javascript / backend / circ / circ_item_config.js
1 load_lib('circ/circ_lib.js');
2 load_lib('JSON_v1.js');
3 log_debug('loading circ_item_config.js ...');
4
5
6 /* SIP media types
7 000 Other
8 001 Book
9 002 Magazine
10 003 Bound journal
11 004 Audio tape
12 005 Video tape
13 006 CD/CDROM
14 007 Diskette
15 008 Book with diskette
16 009 Book with CD
17 010 Book with audio tape
18 */
19
20 /* ----------------------------------------------------------------------------- 
21         Configure the duration rules for the various item types and circ modifiers
22         MARC Fixed Field info:
23         http://www.oclc.org/bibformats/en/fixedfield/
24         ----------------------------------------------------------------------------- */
25
26 var MARC_ITEM_TYPE_MAP = {
27         a : { /* Language material [Books] */
28                 SIPMediaType                    : '001',
29                 magneticMedia                   : 'f',
30                 durationRule                    : 'default',
31                 recurringFinesRule          : 'default',
32                 maxFine                                 : 'default'
33         },
34     /* add more MARC item type configs as needed... */
35 }
36
37 /* make 't' and 'a' share the same config info */
38 MARC_ITEM_TYPE_MAP.t = MARC_ITEM_TYPE_MAP.a;
39
40
41 var CIRC_MOD_MAP = {
42         'bestseller'                            : {
43                 SIPMediaType                    : '001',
44                 magneticMedia                   : 'f',
45                 durationRule                    : 'default',
46                 recurringFinesRule          : 'default',
47                 maxFine                                 : 'default'
48         },
49 }
50
51
52 /* this will set defaults even if no one asked for them */
53 log_debug("Calling getItemConfig() to force defaults..");
54 getItemConfig();
55
56
57 function getItemConfig() {
58
59         var config = null;
60         var marcType    = getMARCItemType();
61         var circMod             = copy.circ_modifier;
62
63     if( circMod ) {
64         config = CIRC_MOD_MAP[circMod];
65         if(!config) 
66             config = CIRC_MOD_MAP[circMod.toLowerCase()]
67     }
68
69     if(!config)
70                 config = MARC_ITEM_TYPE_MAP[marcType];
71
72     if(!config) {
73         config = {};
74                 config.SIPMediaType = '001';
75                 config.magneticMedia = 'f';
76                 config.durationRule     = 'default';
77                 config.recurringFinesRule = 'default';
78                 config.maxFine = 'default';
79     }
80
81     return config
82 }
83
84
85
86
87