2 <!-- Application: Evergreen Staff Client -->
3 <!-- Screen: Patron Display -->
5 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
7 <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
8 <?xml-stylesheet href="chrome://open_ils_staff_client/skin/global.css" type="text/css"?>
9 <?xml-stylesheet href="/xul/server/skin/global.css" type="text/css"?>
10 <?xml-stylesheet href="/xul/server/skin/patron_display.css" type="text/css"?>
12 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
14 <!DOCTYPE window PUBLIC "" ""[
15 <!--#include virtual="/opac/locale/${locale}/lang.dtd"-->
18 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
20 <?xul-overlay href="/xul/server/OpenILS/util_overlay.xul"?>
21 <?xul-overlay href="/xul/server/patron/bill_summary_overlay.xul"?>
23 <window id="patron_bill" title="&staff.patron.bill_wizard.title;"
24 orient="vertical" style="overflow: auto"
25 onload="try { patron_bill_init(); font_helper(); } catch(E) { alert(E); }" width="700" height="550"
26 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
28 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
30 <script type="text/javascript">var myPackageDir = 'open_ils_staff_client'; var IAMXUL = true; var g = {};</script>
31 <scripts id="openils_util_scripts"/>
33 <script type="text/javascript" src="/xul/server/main/JSAN.js"/>
38 function $(id) { return document.getElementById(id); }
40 function retrieve_mbts() {
41 g.network.simple_request('FM_MBTS_RETRIEVE.authoritative',[ses(),g.mbts_id],
44 g.mbts = req.getResultObject();
45 $('mbts_id').value = g.mbts.id();
46 $('mbts_xact_type').value = g.mbts.xact_type();
47 $('mbts_xact_start').value = g.mbts.xact_start().toString().substr(0,19);
48 $('mbts_xact_finish').value = g.mbts.xact_finish() ? g.mbts.xact_finish().toString().substr(0,19) : '';
49 $('mbts_total_owed').value = g.mbts.total_owed() ? util.money.sanitize( g.mbts.total_owed() ) : '';
50 $('mbts_total_paid').value = g.mbts.total_paid() ? util.money.sanitize( g.mbts.total_paid() ) : '';
51 $('mbts_balance_owed').value = g.mbts.balance_owed() ? util.money.sanitize( g.mbts.balance_owed() ) : '';
52 $('xact_type').value = g.mbts.xact_type(); $('xact_type').disabled = true;
54 g.error.sdump('D_ERROR',E);
60 function retrieve_circ() {
61 JSAN.use('util.widgets');
62 g.network.simple_request('FM_CIRC_RETRIEVE_VIA_ID', [ ses(), g.mbts_id ],
64 var r_circ = req.getResultObject();
65 if (instanceOf(r_circ,circ)) {
67 $('title_label').hidden = false;
68 $('checked_out_label').hidden = false;
69 $('due_label').hidden = false;
70 $('checked_in_label').hidden = false;
71 $('checked_out').value = r_circ.xact_start() ? r_circ.xact_start().toString().substr(0,10) : '';
72 $('checked_in').value = r_circ.checkin_time() ? r_circ.checkin_time().toString().substr(0,10) : '';
73 $('due').value = r_circ.due_date() ? r_circ.due_date().toString().substr(0,10) : '';
75 g.network.simple_request(
76 'MODS_SLIM_RECORD_RETRIEVE_VIA_COPY.authoritative',
77 [ r_circ.target_copy() ],
79 var r_mvr = rreq.getResultObject();
80 if (instanceOf(r_mvr,mvr)) {
81 util.widgets.remove_children('title');
82 $('title').appendChild( document.createTextNode( r_mvr.title() ) );
84 g.network.simple_request(
86 [ r_circ.target_copy() ],
88 var r_acp = rrreq.getResultObject();
89 if (instanceOf(r_acp,acp)) {
90 util.widgets.remove_children('title');
91 $('title').appendChild( document.createTextNode( r_acp.dummy_title() ) );
104 function retrieve_patron() {
105 g.patron_id = xul_param('patron_id',{'modal_xulG':true});
108 JSAN.use('patron.util');
109 g.au_obj = patron.util.retrieve_fleshed_au_via_id( ses(), g.patron_id );
111 $('patron_name').setAttribute('value',
112 ( g.au_obj.prefix() ? g.au_obj.prefix() + ' ' : '') +
113 g.au_obj.family_name() + ', ' +
114 g.au_obj.first_given_name() + ' ' +
115 ( g.au_obj.second_given_name() ? g.au_obj.second_given_name() + ' ' : '' ) +
116 ( g.au_obj.suffix() ? g.au_obj.suffix() : '')
117 + ' : ' + g.au_obj.card().barcode()
123 function patron_bill_init() {
125 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
126 if (typeof JSAN == 'undefined') { throw( $("commonStrings").getString('common.jsan.missing') ); }
127 JSAN.errorLevel = "die"; // none, warn, or die
128 JSAN.addRepository('/xul/server/');
129 JSAN.use('util.error'); g.error = new util.error();
130 g.error.sdump('D_TRACE','my_init() for patron_display.xul');
131 g.OpenILS = {}; JSAN.use('OpenILS.data'); g.OpenILS.data = new OpenILS.data();
132 g.OpenILS.data.init({'via':'stash'});
133 JSAN.use('util.network'); g.network = new util.network();
134 JSAN.use('util.date');
135 JSAN.use('util.money');
136 JSAN.use('util.widgets');
137 JSAN.use('util.functional');
138 var ml = util.widgets.make_menulist(
139 util.functional.map_list(
140 g.OpenILS.data.list.billing_type.sort(),
141 function(obj) { return [ obj, obj ]; }
144 ml.setAttribute('id','billing_type');
145 document.getElementById('menu_placeholder').appendChild(ml);
149 $('billing_location').setAttribute('value', g.OpenILS.data.hash.aou[ g.OpenILS.data.list.au[0].ws_ou() ].name() );
151 $('bill_amount').focus();
153 if (xul_param('xact_id',{'modal_xulG':true})) {
154 g.mbts_id = xul_param('xact_id',{'modal_xulG':true});
155 $('summary').hidden = false;
161 var err_msg = $("commonStrings").getFormattedString('common.exception', ['patron/bill_wizard.xul', E]);
162 try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
168 function patron_bill_finish() {
170 var xact_id = xul_param('xact_id',{'modal_xulG':true});
172 var grocery = new mg();
174 grocery.billing_location( g.OpenILS.data.list.au[0].ws_ou() );
175 grocery.usr( g.au_obj.id() );
176 grocery.note( $('bill_note').value );
177 xact_id = g.network.request(
178 api.FM_MG_CREATE.app,
179 api.FM_MG_CREATE.method,
183 if (typeof xact_id.ilsevent == 'undefined') {
184 JSAN.use('util.money');
185 var billing = new mb();
187 billing.note( $('bill_note').value );
188 billing.xact( xact_id );
189 billing.amount( util.money.sanitize( $('bill_amount').value ) );
190 billing.billing_type( $('billing_type').value );
191 var mb_id = g.network.request(
192 api.FM_MB_CREATE.app,
193 api.FM_MB_CREATE.method,
196 if (typeof mb_id.ilsevent != 'undefined') throw(mb_id);
197 alert($('patronStrings').getString('staff.patron.bill_wizard.patron_bill_finish.billing_added'));
202 g.error.standard_unexpected_error_alert('bill_wizard',E);
209 <messagecatalog id="commonStrings" src="/xul/server/locale/<!--#echo var='locale'-->/common.properties" />
210 <messagecatalog id="patronStrings" src="/xul/server/locale/<!--#echo var='locale'-->/patron.properties"/>
214 <label id="patron_name" class="patronNameLarge"/>
216 <groupbox orient="vertical" flex="1" id="summary" hidden="true"/>
219 <caption label="&staff.patron.bill_wizard.create_bill.label;"/>
221 <columns> <column flex="0" /> <column flex="0" /> </columns>
222 <rows id="page1_rows">
223 <row><label value="&staff.patron.bill_wizard.location.value;"/><textbox id="billing_location" disabled="true" /></row>
224 <row><label value="&staff.patron.bill_wizard.transaction_type.value;"/>
225 <menulist id="xact_type">
227 <menuitem label="&staff.patron.bill_wizard.grocery.label;" value="grocery" selected="true"/>
228 <menuitem label="&staff.patron.bill_wizard.circulation.label;" value="circulation" disabled="true"/>
232 <row><label value="&staff.patron.bill_wizard.billing_type.label;"/>
233 <hbox id="menu_placeholder"/>
235 <row><label value="&staff.patron.bill_wizard.amount.value;"/><textbox id="bill_amount" /></row>
236 <row><label value="&staff.patron.bill_wizard.note.value;"/><textbox id="bill_note" multiline="true" rows="5" /></row>
242 <button label="&staff.patron.bill_wizard.cancel.label;" oncommand="window.close()" accesskey="&staff.patron.bill_wizard.cancel.accesskey;"/>
243 <button label="&staff.patron.bill_wizard.submit.label;" oncommand="patron_bill_finish(); window.close();" accesskey="&staff.patron.bill_wizard.submit.accesskey;"/>