]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/xul/staff_client/server/circ/alternate_copy_summary.js
some circ column tweaks, and checkin scan time for both columns and alternate item...
[working/Evergreen.git] / Open-ILS / xul / staff_client / server / circ / alternate_copy_summary.js
1 var error; 
2 var network;
3 var data;
4
5 function my_init() {
6     try {
7         netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
8         if (typeof JSAN == 'undefined') { throw( "The JSAN library object is missing."); }
9         JSAN.errorLevel = "die"; // none, warn, or die
10         JSAN.addRepository('/xul/server/');
11         JSAN.use('util.error'); error = new util.error();
12         error.sdump('D_TRACE','my_init() for alternate_copy_summary.xul');
13
14         JSAN.use('util.network'); network = new util.network();
15         JSAN.use('OpenILS.data'); data = new OpenILS.data(); data.stash_retrieve();
16
17         setTimeout( function() { load_item(); }, 1000 ); // timeout so xulG gets a chance to get pushed in
18
19     } catch(E) {
20         try { error.standard_unexpected_error_alert('main/test.xul',E); } catch(F) { alert(E); }
21     }
22 }
23
24 function set(name,value) { 
25     var nodes = document.getElementsByAttribute('name',name); 
26     for (var i = 0; i < nodes.length; i++) {
27         nodes[i].setAttribute('value',value); nodes[i].value = value; 
28     }
29 }
30
31 function load_item() {
32     try {
33         if (! xulG.barcode) return;
34
35         var details = network.simple_request('FM_ACP_DETAILS_VIA_BARCODE.authoritative', [ ses(), xulG.barcode ]);
36         // Should get back .mvr, .copy, .volume, .transit, .circ, .hold
37
38         set('title', '');
39         set('author', '');
40         set('doc_id', '');
41         set('doc_type', '');
42         set('pubdate', '');
43         set('isbn', '');
44         set('publisher', '');
45         set('tcn', '');
46         set('subject', '');
47         set('types_of_resource', '');
48         set('call_numbers', '');
49         set('edition', '');
50         set('online_loc', '');
51         set('synopsis', '');
52         set('physical_description', '');
53         set('toc', '');
54         set('copy_count', '');
55         set('series', '');
56         set('serials', '');
57
58         if (details.mvr) {
59             set('title',details.mvr.title()); 
60             set('author',details.mvr.author());
61             set('doc_id', details.mvr.doc_id());
62             set('doc_type', details.mvr.doc_type());
63             set('pubdate', details.mvr.pubdate());
64             set('isbn',details.mvr.isbn());
65             set('publisher', details.mvr.publisher());
66             set('tcn', details.mvr.tcn());
67             set('subject', details.mvr.subject());
68             set('types_of_resource', details.mvr.types_of_resource());
69             set('call_numbers', details.mvr.call_numbers());
70             set('edition', details.mvr.edition());
71             set('online_loc', details.mvr.online_loc());
72             set('synopsis', details.mvr.synopsis());
73             set('physical_description', details.mvr.physical_description());
74             set('toc', details.mvr.toc());
75             set('copy_count', details.mvr.copy_count());
76             set('series', details.mvr.series());
77             set('serials', details.mvr.serials());
78         } else {
79             set('title',details.copy.dummy_title());
80             set('author',details.copy.dummy_author()); 
81             set('isbn',details.copy.dummy_isbn());
82         }
83
84         set("stat_cat_entries", '');
85         set("age_protect", '');
86         set("alert_message", '');
87         set("barcode", '');
88         set("call_number", '');
89         set("circ_as_type", '');
90         set("copy_circ_lib" , '');
91         set("circ_modifier", '');
92         set("circulate", '');
93         set("copy_number", '');
94         set("create_date", '');
95         set("creator", '');
96         set("deleted", '');
97         set("deposit", '');
98         set("deposit_amount", '');
99         set("dummy_author", '');
100         set("dummy_title", '');
101         set("edit_date", '');
102         set("editor", '');
103         set("fine_level", '');
104         set("holdable", '');
105         set("copy_id", '');
106         set("loan_duration", '');
107         set("location", '');
108         set("opac_visible", '');
109         set("price", '');
110         set("ref", '');
111         set("status", '');
112         set("notes", '');
113         set("stat_cat_entry_copy_maps", '');
114         set("circulations", '');
115         set("total_circ_count", '');
116         set("holds", '');
117
118         if (details.copy) {
119             set("stat_cat_entries", details.copy.stat_cat_entries()); 
120             set("age_protect", details.copy.age_protect()); 
121             set("alert_message", details.copy.alert_message()); 
122             set("barcode", details.copy.barcode()); 
123             set("call_number", details.copy.call_number()); 
124             set("circ_as_type", details.copy.circ_as_type()); 
125             set("copy_circ_lib" , details.copy.circ_lib()); 
126             set("circ_modifier", details.copy.circ_modifier()); 
127             set("circulate", details.copy.circulate()); 
128             set("copy_number", details.copy.copy_number()); 
129             set("create_date", details.copy.create_date()); 
130             set("creator", details.copy.creator()); 
131             set("deleted", details.copy.deleted()); 
132             set("deposit", details.copy.deposit()); 
133             set("deposit_amount", details.copy.deposit_amount()); 
134             set("dummy_author", details.copy.dummy_author()); 
135             set("dummy_title", details.copy.dummy_title()); 
136             set("edit_date", details.copy.edit_date()); 
137             set("editor", details.copy.editor()); 
138             set("fine_level", details.copy.fine_level()); 
139             set("holdable", details.copy.holdable()); 
140             set("copy_id", details.copy.id()); 
141             set("loan_duration", details.copy.loan_duration()); 
142             set("location", details.copy.location()); 
143             set("opac_visible", details.copy.opac_visible()); 
144             set("price", details.copy.price()); 
145             set("ref", details.copy.ref()); 
146             set("status", details.copy.status()); 
147             set("notes", details.copy.notes()); 
148             set("stat_cat_entry_copy_maps", details.copy.stat_cat_entry_copy_maps()); 
149             set("circulations", details.copy.circulations()); 
150             set("total_circ_count", details.copy.total_circ_count()); 
151             set("holds", details.copy.holds()); 
152         }
153
154         set("copies", '');
155         set("create_date", '');
156         set("creator", '');
157         set("deleted", '');
158         set("edit_date", '');
159         set("editor", '');
160         set("volume_id", '');
161         set("label", '');
162         set("owning_lib" , '');
163         set("record", '');
164         set("notes", '');
165         set("uri_maps", '');
166         set("uris", '');
167
168         if (details.volume) {
169             set("copies", details.volume.copies()); 
170             set("create_date", details.volume.create_date()); 
171             set("creator", details.volume.creator()); 
172             set("deleted", details.volume.deleted()); 
173             set("edit_date", details.volume.edit_date()); 
174             set("editor", details.volume.editor()); 
175             set("volume_id", details.volume.id()); 
176             set("label", details.volume.label()); 
177             set("owning_lib" , details.volume.owning_lib()); 
178             set("record", details.volume.record()); 
179             set("notes", details.volume.notes()); 
180             set("uri_maps", details.volume.uri_maps()); 
181             set("uris", details.volume.uris()); 
182         }
183
184         set("copy_status", '');
185         set("dest", '');
186         set("dest_recv_time", '');
187         set("transit_id", '');
188         set("persistant_transfer", '');
189         set("prev_hop", '');
190         set("source", '');
191         set("source_send_time", '');
192         set("target_copy", '');
193         set("hold_transit_copy", '');
194
195         if (details.transit) {
196             set("copy_status", details.transit.copy_status()); 
197             set("dest", details.transit.dest()); 
198             set("dest_recv_time", details.transit.dest_recv_time()); 
199             set("transit_id", details.transit.id()); 
200             set("persistant_transfer", details.transit.persistant_transfer()); 
201             set("prev_hop", details.transit.prev_hop()); 
202             set("source", details.transit.source()); 
203             set("source_send_time", details.transit.source_send_time()); 
204             set("target_copy", details.transit.target_copy()); 
205             set("hold_transit_copy", details.transit.hold_transit_copy()); 
206         }
207
208         set("checkin_lib", '');
209         set("checkin_workstation",""); 
210         set("checkin_staff", '');
211         set("checkin_time", '');
212         set("checkin_scan_time", '');
213         set("circ_circ_lib" , '');
214         set("circ_staff", '');
215         set("desk_renewal", '');
216         set("due_date", '');
217         set("duration", '');
218         set("duration_rule", '');
219         set("fine_interval", '');
220         set("circ_id", '');
221         set("max_fine", '');
222         set("max_fine_rule", '');
223         set("opac_renewal", '');
224         set("phone_renewal", '');
225         set("recuring_fine", '');
226         set("recuring_fine_rule", '');
227         set("renewal_remaining", '');
228         set("stop_fines", '');
229         set("stop_fines_time", '');
230         set("target_copy", '');
231         set("usr", '');
232         set("xact_finish", '');
233         set("xact_start", '');
234         set("create_time", '');
235         set("workstation", '');
236         set("billings", '');
237         set("payments", '');
238         set("billable_transaction", '');
239         set("circ_type", '');
240         set("billing_total", '');
241         set("payment_total", '');
242
243         if (details.circ) {
244             set("checkin_lib", typeof details.circ.checkin_lib() == 'object' ? details.circ.checkin_lib().shortname() : data.hash.aou[ details.circ.checkin_lib() ].shortname() ); 
245             if (details.circ.checkin_workstation()) {
246                 set("checkin_workstation", details.circ.checkin_workstation().name()); 
247             }
248             set("checkin_staff", details.circ.checkin_staff()); 
249             set("checkin_time", details.circ.checkin_time()); 
250             set("checkin_scan_time", details.circ.checkin_scan_time()); 
251             set("circ_circ_lib" , typeof details.circ.circ_lib() == 'object' ? details.circ.circ_lib().shortname() : data.hash.aou[ details.circ.circ_lib() ].shortname() ); 
252             set("circ_staff", details.circ.circ_staff()); 
253             set("desk_renewal", details.circ.desk_renewal()); 
254             set("due_date", details.circ.due_date()); 
255             set("duration", details.circ.duration()); 
256             set("duration_rule", details.circ.duration_rule()); 
257             set("fine_interval", details.circ.fine_interval()); 
258             set("circ_id", details.circ.id()); 
259             set("max_fine", details.circ.max_fine()); 
260             set("max_fine_rule", details.circ.max_fine_rule()); 
261             set("opac_renewal", details.circ.opac_renewal()); 
262             set("phone_renewal", details.circ.phone_renewal()); 
263             set("recuring_fine", details.circ.recuring_fine()); 
264             set("recuring_fine_rule", details.circ.recuring_fine_rule()); 
265             set("renewal_remaining", details.circ.renewal_remaining()); 
266             set("stop_fines", details.circ.stop_fines()); 
267             set("stop_fines_time", details.circ.stop_fines_time()); 
268             set("target_copy", details.circ.target_copy()); 
269             set("usr", details.circ.usr()); 
270             set("xact_finish", details.circ.xact_finish()); 
271             set("xact_start", details.circ.xact_start()); 
272             set("create_time", details.circ.create_time()); 
273             set("workstation", details.circ.workstation()); 
274             set("billings", details.circ.billings()); 
275             set("payments", details.circ.payments()); 
276             set("billable_transaction", details.circ.billable_transaction()); 
277             set("circ_type", details.circ.circ_type()); 
278             set("billing_total", details.circ.billing_total()); 
279             set("payment_total", details.circ.payment_total()); 
280         }
281
282         set("status", '');
283         set("transit", '');
284         set("capture_time", '');
285         set("current_copy", '');
286         set("email_notify", '');
287         set("expire_time", '');
288         set("fulfillment_lib", '');
289         set("fulfillment_staff", '');
290         set("fulfillment_time", '');
291         set("hold_type", '');
292         set("holdable_formats", '');
293         set("hold_id", '');
294         set("phone_notify", '');
295         set("pickup_lib", '');
296         set("prev_check_time", '');
297         set("request_lib", '');
298         set("request_time", '');
299         set("requestor", '');
300         set("selection_depth", '');
301         set("selection_ou", '');
302         set("target", '');
303         set("usr", '');
304         set("cancel_time", '');
305         set("notify_time", '');
306         set("notify_count", '');
307         set("notifications", '');
308         set("bib_rec", '');
309         set("eligible_copies", '');
310         set("frozen", '');
311         set("thaw_date", '');
312         set("shelf_time", '');
313         set("cancel_cause", '');
314         set("cancel_note", '');
315         set("notes", '');
316
317         if (details.hold) {
318             set("status", details.hold.status()); 
319             set("transit", details.hold.transit()); 
320             set("capture_time", details.hold.capture_time()); 
321             set("current_copy", details.hold.current_copy()); 
322             set("email_notify", details.hold.email_notify()); 
323             set("expire_time", details.hold.expire_time()); 
324             set("fulfillment_lib" , typeof details.hold.fulfillment_lib() == 'object' ? details.hold.fulfillment_lib().shortname() : data.hash.aou[ details.hold.fulfillment_lib() ].shortname() ); 
325             set("fulfillment_staff", details.hold.fulfillment_staff()); 
326             set("fulfillment_time", details.hold.fulfillment_time()); 
327             set("hold_type", details.hold.hold_type()); 
328             set("holdable_formats", details.hold.holdable_formats()); 
329             set("hold_id", details.hold.id()); 
330             set("phone_notify", details.hold.phone_notify()); 
331             set("pickup_lib" , typeof details.hold.pickup_lib() == 'object' ? details.hold.pickup_lib().shortname() : data.hash.aou[ details.hold.pickup_lib() ].shortname() ); 
332             set("prev_check_time", details.hold.prev_check_time()); 
333             set("request_lib" , typeof details.hold.request_lib() == 'object' ? details.hold.request_lib().shortname() : data.hash.aou[ details.hold.request_lib() ].shortname() ); 
334             set("request_time", details.hold.request_time()); 
335             set("requestor", details.hold.requestor()); 
336             set("selection_depth", details.hold.selection_depth()); 
337             set("selection_ou" , typeof details.hold.selection_ou() == 'object' ? details.hold.selection_ou().shortname() : data.hash.aou[ details.hold.selection_ou() ].shortname() ); 
338             set("target", details.hold.target()); 
339             set("usr", details.hold.usr()); 
340             set("cancel_time", details.hold.cancel_time()); 
341             set("notify_time", details.hold.notify_time()); 
342             set("notify_count", details.hold.notify_count()); 
343             set("notifications", details.hold.notifications()); 
344             set("bib_rec", details.hold.bib_rec()); 
345             set("eligible_copies", details.hold.eligible_copies()); 
346             set("frozen", details.hold.frozen()); 
347             set("thaw_date", details.hold.thaw_date()); 
348             set("shelf_time", details.hold.shelf_time()); 
349             set("cancel_cause", details.hold.cancel_cause()); 
350             set("cancel_note", details.hold.cancel_note()); 
351             set("notes", details.hold.notes()); 
352         } 
353
354         var x = document.getElementById('cat_deck');
355         if (x) {
356             JSAN.use('util.deck');
357             var d = new util.deck('cat_deck');
358             d.reset_iframe( urls.XUL_MARC_VIEW, {}, { 'docid' : details.mvr ? details.mvr.doc_id() : -1 } );
359         }
360
361     } catch(E) {
362         alert(E);
363     }
364 }