]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Evergreen/staff_client/chrome/content/evergreen/circ/circ_utils.js
checkout, maybe
[working/Evergreen.git] / Evergreen / staff_client / chrome / content / evergreen / circ / circ_utils.js
1 sdump('D_TRACE','Loading circ_tree.js\n');
2
3 function is_barcode_valid( barcode ) {
4
5         // consider checkdigit, length, etc.
6
7         return check_checkdigit( barcode );
8 }
9
10 function checkout_permit(barcode, patron_id, num_of_open_async_checkout_requests) {
11         sdump('D_CIRC_UTILS',arg_dump(arguments,{0:true,1:true,2:true}));
12         try {
13                 var check = user_request(
14                         'open-ils.circ',
15                         'open-ils.circ.permit_checkout',
16                         [ mw.G.auth_ses[0], barcode, patron_id, num_of_open_async_checkout_requests ]
17                 )[0];
18                 sdump('D_CIRC_UTILS','check = ' + js2JSON(check) + '\n');
19                 return check;   
20         } catch(E) {
21                 handle_error(E);
22                 return null;
23         }       
24 }
25
26 function checkout_by_copy_barcode(barcode, patron_id) {
27         sdump('D_CIRC_UTILS',arg_dump(arguments,{0:true,1:true}));
28         try {
29                 var check = user_request(
30                         'open-ils.circ',
31                         'open-ils.circ.checkout.barcode',
32                         [ mw.G.auth_ses[0], barcode, patron_id ]
33                 )[0];
34                 sdump('D_CIRC_UTILS','check = ' + js2JSON(check) + '\n');
35                 return check;
36         } catch(E) {
37                 sdump('D_ERROR',E);
38                 return null;
39         }
40 }
41
42 function checkin_by_copy_barcode(barcode) {
43         sdump('D_CIRC_UTILS',arg_dump(arguments,{0:true}));
44         try {
45                 var check = user_request(
46                         'open-ils.circ',
47                         'open-ils.circ.checkin.barcode',
48                         [ mw.G.auth_ses[0], barcode ]
49                 )[0];
50                 sdump('D_CIRC_UTILS','check = ' + js2JSON(check) + '\n');
51                 return check;
52         } catch(E) {
53                 sdump('D_ERROR',E);
54                 return null;
55         }
56 }
57
58 function renew_by_circ_id(id) {
59         sdump('D_CIRC_UTILS',arg_dump(arguments,{0:true}));
60         try {
61                 var check = user_request(
62                         'open-ils.circ',
63                         'open-ils.circ.renew',
64                         [ mw.G.auth_ses[0], id ]
65                 )[0];
66                 sdump('D_CIRC_UTILS','check = ' + js2JSON(check) + '\n');
67                 return check;
68         } catch(E) {
69                 sdump('D_ERROR',E);
70                 return null;
71         }
72 }
73
74 function circ_cols() {
75         return  [
76                 {
77                         'id' : 'barcode', 'label' : getString('acp_label_barcode'), 'flex' : 1,
78                         'primary' : true, 'hidden' : false, 'fm_class' : 'acp', 'fm_field_render' : '.barcode()'
79                 },
80                 {
81                         'id' : 'call_number', 'label' : getString('acp_label_call_number'), 'flex' : 1,
82                         'primary' : false, 'hidden' : true, 'fm_class' : 'acp', 'fm_field_render' : '.call_number()'
83                 },
84                 {
85                         'id' : 'copy_number', 'label' : getString('acp_label_copy_number'), 'flex' : 1,
86                         'primary' : false, 'hidden' : true, 'fm_class' : 'acp', 'fm_field_render' : '.copy_number()'
87                 },
88                 {
89                         'id' : 'status', 'label' : getString('acp_label_status'), 'flex' : 1,
90                         'primary' : false, 'hidden' : true, 'fm_class' : 'acp', 'fm_field_render' : '.status()'
91                 },
92                 {
93                         'id' : 'location', 'label' : getString('acp_label_location'), 'flex' : 1,
94                         'primary' : false, 'hidden' : true, 'fm_class' : 'acp', 'fm_field_render' : '.location()'
95                 },
96                 {
97                         'id' : 'loan_duration', 'label' : getString('acp_label_loan_duration'), 'flex' : 1,
98                         'primary' : false, 'hidden' : true, 'fm_class' : 'acp', 'fm_field_render' : '.loan_duration()'
99                 },
100                 {
101                         'id' : 'circ_lib', 'label' : getString('acp_label_circ_lib'), 'flex' : 1,
102                         'primary' : false, 'hidden' : true, 'fm_class' : 'acp', 'fm_field_render' : '.circ_lib()'
103                 },
104                 {
105                         'id' : 'fine_level', 'label' : getString('acp_label_fine_level'), 'flex' : 1,
106                         'primary' : false, 'hidden' : true, 'fm_class' : 'acp', 'fm_field_render' : '.fine_level()'
107                 },
108                 {
109                         'id' : 'deposit', 'label' : getString('acp_label_deposit'), 'flex' : 1,
110                         'primary' : false, 'hidden' : true, 'fm_class' : 'acp', 'fm_field_render' : '.deposit()'
111                 },
112                 {
113                         'id' : 'deposit_amount', 'label' : getString('acp_label_deposit_amount'), 'flex' : 1,
114                         'primary' : false, 'hidden' : true, 'fm_class' : 'acp', 'fm_field_render' : '.deposit_amount()'
115                 },
116                 {
117                         'id' : 'price', 'label' : getString('acp_label_price'), 'flex' : 1,
118                         'primary' : false, 'hidden' : true, 'fm_class' : 'acp', 'fm_field_render' : '.price()'
119                 },
120                 {
121                         'id' : 'circ_as_type', 'label' : getString('acp_label_circ_as_type'), 'flex' : 1,
122                         'primary' : false, 'hidden' : true, 'fm_class' : 'acp', 'fm_field_render' : '.circ_as_type()'
123                 },
124                 {
125                         'id' : 'circ_modifier', 'label' : getString('acp_label_circ_modifier'), 'flex' : 1,
126                         'primary' : false, 'hidden' : true, 'fm_class' : 'acp', 'fm_field_render' : '.circ_modifier()'
127                 },
128                 {
129                         'id' : 'xact_start', 'label' : getString('circ_label_xact_start'), 'flex' : 1,
130                         'primary' : false, 'hidden' : true, 'fm_class' : 'circ', 'fm_field_render' : '.xact_start()'
131                 },
132                 {
133                         'id' : 'xact_finish', 'label' : getString('circ_label_xact_finish'), 'flex' : 1,
134                         'primary' : false, 'hidden' : true, 'fm_class' : 'circ', 'fm_field_render' : '.xact_finish()'
135                 },
136                 {
137                         'id' : 'renewal_remaining', 'label' : getString('circ_label_renewal_remaining'), 'flex' : 1,
138                         'primary' : false, 'hidden' : false, 'fm_class' : 'circ', 'fm_field_render' : '.renewal_remaining()'
139                 },
140                 {
141                         'id' : 'due_date', 'label' : getString('circ_label_due_date'), 'flex' : 1,
142                         'primary' : false, 'hidden' : false, 'fm_class' : 'circ', 'fm_field_render' : '.due_date()'
143                 },
144                 {
145                         'id' : 'title', 'label' : getString('mvr_label_title'), 'flex' : 1,
146                         'primary' : false, 'hidden' : false, 'fm_class' : 'mvr', 'fm_field_render' : '.title()'
147                 },
148                 {
149                         'id' : 'author', 'label' : getString('mvr_label_author'), 'flex' : 1,
150                         'primary' : false, 'hidden' : false, 'fm_class' : 'mvr', 'fm_field_render' : '.author()'
151                 }
152                 
153         ]
154 };
155
156