1 dump('entering circ.checkout.js\n');
3 if (typeof patron == 'undefined') patron = {};
4 circ.checkout = function (params) {
6 JSAN.use('util.error'); this.error = new util.error();
7 JSAN.use('main.network'); this.network = new main.network();
10 circ.checkout.prototype = {
12 'init' : function( params ) {
16 obj.session = params['session'];
17 obj.patron_id = params['patron_id'];
19 JSAN.use('OpenILS.data'); obj.OpenILS = {};
20 obj.OpenILS.data = new OpenILS.data( { 'session' : params.session } ); obj.OpenILS.data.init(true);
23 JSAN.use('main.list'); obj.list = new main.list('checkout_list');
24 //FIXME//getString used to wrap StringBundles, but we need to do the entity/div thing
25 function getString(s) { return s; }
30 'id' : 'acp_id', 'label' : getString('acp_label_id'), 'flex' : 1,
31 'primary' : false, 'hidden' : true, 'render' : 'my.acp.id()'
34 'id' : 'circ_id', 'label' : getString('circ_label_id'), 'flex' : 1,
35 'primary' : false, 'hidden' : true, 'render' : 'my.circ.id()'
38 'id' : 'mvr_doc_id', 'label' : getString('mvr_label_doc_id'), 'flex' : 1,
39 'primary' : false, 'hidden' : true, 'render' : 'my.mvr.doc_id()'
42 'id' : 'barcode', 'label' : getString('acp_label_barcode'), 'flex' : 1,
43 'primary' : false, 'hidden' : false, 'render' : 'my.acp.barcode()'
46 'id' : 'call_number', 'label' : getString('acp_label_call_number'), 'flex' : 1,
47 'primary' : false, 'hidden' : true, 'render' : 'my.acp.call_number()'
50 'id' : 'copy_number', 'label' : getString('acp_label_copy_number'), 'flex' : 1,
51 'primary' : false, 'hidden' : true, 'render' : 'my.acp.copy_number()'
54 'id' : 'location', 'label' : getString('acp_label_location'), 'flex' : 1,
55 'primary' : false, 'hidden' : true, 'render' : 'my.acp.location()'
58 'id' : 'loan_duration', 'label' : getString('acp_label_loan_duration'), 'flex' : 1,
59 'primary' : false, 'hidden' : true, 'render' : 'my.acp.loan_duration()'
62 'id' : 'circ_lib', 'label' : getString('acp_label_circ_lib'), 'flex' : 1,
63 'primary' : false, 'hidden' : true, 'render' : 'my.acp.circ_lib()'
66 'id' : 'fine_level', 'label' : getString('acp_label_fine_level'), 'flex' : 1,
67 'primary' : false, 'hidden' : true, 'render' : 'my.acp.fine_level()'
70 'id' : 'deposit', 'label' : getString('acp_label_deposit'), 'flex' : 1,
71 'primary' : false, 'hidden' : true, 'render' : 'my.acp.deposit()'
74 'id' : 'deposit_amount', 'label' : getString('acp_label_deposit_amount'), 'flex' : 1,
75 'primary' : false, 'hidden' : true, 'render' : 'my.acp.deposit_amount()'
78 'id' : 'price', 'label' : getString('acp_label_price'), 'flex' : 1,
79 'primary' : false, 'hidden' : true, 'render' : 'my.acp.price()'
82 'id' : 'circ_as_type', 'label' : getString('acp_label_circ_as_type'), 'flex' : 1,
83 'primary' : false, 'hidden' : true, 'render' : 'my.acp.circ_as_type()'
86 'id' : 'circ_modifier', 'label' : getString('acp_label_circ_modifier'), 'flex' : 1,
87 'primary' : false, 'hidden' : true, 'render' : 'my.acp.circ_modifier()'
90 'id' : 'xact_start', 'label' : getString('circ_label_xact_start'), 'flex' : 1,
91 'primary' : false, 'hidden' : true, 'render' : 'my.circ.xact_start()'
94 'id' : 'xact_finish', 'label' : getString('circ_label_xact_finish'), 'flex' : 1,
95 'primary' : false, 'hidden' : true, 'render' : 'my.circ.xact_finish()'
98 'id' : 'due_date', 'label' : getString('circ_label_due_date'), 'flex' : 1,
99 'primary' : false, 'hidden' : false, 'render' : 'my.circ.due_date().substr(0,10)'
102 'id' : 'title', 'label' : getString('mvr_label_title'), 'flex' : 2,
103 'primary' : false, 'hidden' : false, 'render' : 'my.mvr.title()'
106 'id' : 'author', 'label' : getString('mvr_label_author'), 'flex' : 1,
107 'primary' : false, 'hidden' : false, 'render' : 'my.mvr.author()'
110 'id' : 'renewal_remaining', 'label' : getString('circ_label_renewal_remaining'), 'flex' : 0,
111 'primary' : false, 'hidden' : false, 'render' : 'my.circ.renewal_remaining()'
114 'id' : 'status', 'label' : getString('acp_label_status'), 'flex' : 1,
115 'primary' : false, 'hidden' : false, 'render' : 'my.acp.status().name()'
118 'map_row_to_column' : function(row,col) {
119 // row contains { 'my' : { 'acp' : {}, 'circ' : {}, 'mvr' : {} } }
120 // col contains one of the objects listed above in columns
122 return eval( col.render );
127 JSAN.use('main.controller'); obj.controller = new main.controller();
131 'checkout_barcode_entry_textbox' : [
138 function() { alert('Not Yet Implemented'); }
140 'cmd_checkout_submit_barcode' : [
144 var barcode = obj.controller.view.checkout_barcode_entry_textbox.value;
145 var permit = obj.network.request(
147 'open-ils.circ.permit_checkout',
148 [ obj.session, barcode, obj.patron_id, 0 ]
151 if (permit.status == 0) {
152 var checkout = obj.network.request(
154 'open-ils.circ.checkout.barcode',
155 [ obj.session, barcode, obj.patron_id ]
161 'circ' : checkout.circ,
162 'mvr' : checkout.record,
163 'acp' : checkout.copy
166 //I could override map_row_to_col here
174 alert('FIXME: need special alert and error handling\n'
179 'cmd_checkout_print' : [
184 'cmd_checkout_reprint' : [
189 'cmd_checkout_done' : [
201 dump('exiting circ.checkout.js\n');