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