]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/javascript/backend/circ/circ_duration.js
a5d46abe3c0e69a01fa2a1c89528b4b91a2a595a
[Evergreen.git] / Open-ILS / src / javascript / backend / circ / circ_duration.js
1 function go(){
2
3 load_lib('circ/circ_item_config.js');
4 log_vars('circ_duration');
5
6
7 /* treat pre-cat copies like vanilla books */
8 if( isTrue(isPrecat) ) {
9         log_info("pre-cat copy getting duration defaults...");
10         result.durationRule                     = '14_days_2_renew';
11         result.recurringFinesRule       = '10_cent_per_day';
12         result.maxFine                                  = 'overdue_mid';
13         return;
14 }
15
16
17 /* grab the config from the config script */
18 var config = getItemConfig();
19 var itemForm    = (marcXMLDoc) ? extractFixedField(marcXMLDoc,'Form') : "";
20
21
22 /* ----------------------------------------------------------------------------- 
23         Now set the rule values based on the config.  If there is no configured info
24         on this copy, fall back on defaults.
25         ----------------------------------------------------------------------------- */
26 if( config ) {
27
28         log_debug("circ_duration found a config for the copy");
29         result.durationRule                     = config.durationRule;
30         result.recurringFinesRule       = config.recurringFinesRule;
31         result.maxFine                                  = config.maxFine;
32
33         log_debug(config.durationRule + ' : ' + config.recurringFinesRule + ' : ' + config.maxFine );
34
35 } else {
36
37         result.durationRule                     = '14_days_2_renew';
38         result.recurringFinesRule       = "10_cent_per_day";
39         result.maxFine                                  = "overdue_mid";
40 }
41
42
43
44 /* ----------------------------------------------------------------------------- 
45         Add custom rules here.  
46         ----------------------------------------------------------------------------- */
47
48 /* statelib has some special circ rules */
49
50 if( isOrgDescendent('STATELIB', copy.circ_lib.id) ) {
51
52         result.durationRule                     = '35_days_1_renew';
53         result.recurringFinesRule       = "10_cent_per_day";
54         result.maxFine                                  = "overdue_mid";
55
56         /* reference, microfiche, microfilm */
57         if(     isTrue(copy.ref)        || 
58                         itemForm == 'a' || 
59                         itemForm == 'b' ) {
60
61                 result.durationRule             = '14_days_2_renew';
62         }       
63 }
64
65
66
67 } go();
68