]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/javascript/backend/circ/circ_permit_hold.js
for PINES, make non-circ items non-holdable
[Evergreen.git] / Open-ILS / src / javascript / backend / circ / circ_permit_hold.js
1 function go() {
2
3 load_lib('circ/circ_lib.js');
4 log_vars('circ_permit_hold');
5
6 if( isTrue(patron.barred) ) 
7         result.events.push('PATRON_BARRED');
8
9 if( isTrue(copy.ref) ) 
10         result.events.push('ITEM_NOT_HOLDABLE');
11
12 if( !isTrue(copy.circulate) ) 
13         result.events.push('ITEM_NOT_HOLDABLE');
14
15 /* projected medium 
16         this needs to be expanded to check circ_modifiers as well
17 */
18
19 var mod = (copy.circ_modifier) ? copy.circ_modifier.toLowerCase() : "";
20
21 log_info("circ-modifier = "+mod);
22
23
24 if( mod == 'bestsellernh' )
25         result.events.push('ITEM_NOT_HOLDABLE');
26
27 var marcItemType = getMARCItemType();
28
29 var isAnc;
30
31 if( ( marcItemType == 'g' || 
32                 marcItemType == 'i' || 
33                 marcItemType == 'j' || 
34                 mod == 'softwrlong' || 
35                 mod == 'music' || 
36                 mod == 'audiobook' || 
37                 mod == 'av' || 
38                 mod == 'cd' || 
39                 mod == 'dvd' || 
40                 mod == 'video' ) ) {
41
42         isAnc = hasCommonAncestor( copy.circ_lib.id, patron.home_ou.id, 1 );
43
44         if( isAnc) {
45                 log_info("patron and copy circ_lib share a common ancestor, hold allowed");
46
47         } else {
48
49                 log_info("patron and copy circ_lib do NOT share a common ancestor, hold on this type of material not allowed");
50                 result.events.push('ITEM_NOT_HOLDABLE');
51         }
52 }
53
54
55 } go();
56