]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/javascript/backend/circ/circ_permit_hold.js
moved scriptbuilder to new storage method for fetching total owed by a patron
[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 /* projected medium 
13         this needs to be expanded to check circ_modifiers as well
14 */
15
16 var mod = (copy.circ_modifier) ? copy.circ_modifier.toLowerCase() : "";
17
18 log_info("circ-modifier = "+mod);
19
20
21 if( mod == 'bestsellernh' )
22         result.events.push('ITEM_NOT_HOLDABLE');
23
24 var marcItemType = getMARCItemType();
25
26 var isAnc;
27
28 if( ( marcItemType == 'g' || 
29                 marcItemType == 'i' || 
30                 marcItemType == 'j' || 
31                 mod == 'softwrlong' || 
32                 mod == 'music' || 
33                 mod == 'audiobook' || 
34                 mod == 'av' || 
35                 mod == 'cd' || 
36                 mod == 'dvd' || 
37                 mod == 'video' ) ) {
38
39         isAnc = hasCommonAncestor( copy.circ_lib.id, patron.home_ou.id, 1 );
40
41         if( isAnc) {
42                 log_info("patron and copy circ_lib share a common ancestor, hold allowed");
43
44         } else {
45
46                 log_info("patron and copy circ_lib do NOT share a common ancestor, hold on this type of material not allowed");
47                 result.events.push('ITEM_NOT_HOLDABLE');
48         }
49 }
50
51
52 } go();
53