]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/javascript/backend/circ/circ_duration.js
moved the item config out to its own file for clarity
[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
20
21 /* ----------------------------------------------------------------------------- 
22         Now set the rule values based on the config.  If there is no configured info
23         on this copy, fall back on defaults.
24         ----------------------------------------------------------------------------- */
25 if( config ) {
26
27         log_debug("circ_duration found a config for the copy");
28         result.durationRule                     = config.durationRule;
29         result.recurringFinesRule       = config.recurringFinesRule;
30         result.maxFine                                  = config.maxFine;
31
32         log_debug(config.durationRule + ' : ' + config.recurringFinesRule + ' : ' + config.maxFine );
33
34 } else {
35
36         result.durationRule                     = '14_days_2_renew';
37         result.recurringFinesRule       = "10_cent_per_day";
38         result.maxFine                                  = "overdue_mid";
39 }
40
41
42
43 /* ----------------------------------------------------------------------------- 
44         Add custom rules here.  
45         ----------------------------------------------------------------------------- */
46
47 /* statelib has some special circ rules */
48
49 if( isOrgDescendent('STATELIB', copy.circ_lib.id) ) {
50
51         result.durationRule                     = '35_days_1_renew';
52         result.recurringFinesRule       = "10_cent_per_day";
53         result.maxFine                                  = "overdue_mid";
54
55         /* reference, microfiche, microfilm */
56         if(     isTrue(copy.ref)        || 
57                         itemForm == 'a' || 
58                         itemForm == 'b' ) {
59
60                 result.durationRule             = '14_days_2_renew';
61         }       
62 }
63
64
65
66 } go();
67