var scanTimeoutId;
var patronBarcodeRegex;
var orgUnit;
+var orgUnitAddress;
+var orgUnitHours;
function selfckInit() {
selfckSetupPrinter();
orgUnit = findOrgUnitSN(cgi.param('l')) || globalOrgTree;
+ selfckFetchOrgDetails();
var t = fetchOrgSettingDefault(orgUnit.id(), 'circ.selfcheck.patron_login_timeout');
patronTimeout = (t) ? parseInt(t) * 1000 : patronTimeout;
}
+function selfckFetchOrgDetails() {
+ var hreq = new Request('open-ils.actor:open-ils.actor.org_unit.hours_of_operation.retrieve', G.user.session, orgUnit.id());
+ hreq.callback(function(r) { orgUnitHours = r.getResultObject(); });
+ hreq.send();
+
+ var areq = new Request('open-ils.actor:open-ils.actor.org_unit.address.retrieve', orgUnit.mailing_address());
+ areq.callback(function(r) { orgUnitAddress = r.getResultObject(); });
+ areq.send();
+}
+
function selfckSetupPrinter() {
try { // Mozilla only
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
*/
function selfckPrint() {
for(var x in successfulItems) { // make sure we've checked out at least one item
- appendClear($('selfck-print-lib-name'), text(orgUnit.name()));
appendClear($('selfck-print-date'), text(new Date().toLocaleString()));
+ appendClear($('selfck-print-lib-name'), text(orgUnit.name()));
+ if(orgUnitAddress) {
+ appendClear($('selfck-print-lib-addr-street'), text(orgUnitAddress.street1()+' '+orgUnitAddress.street2()));
+ appendClear($('selfck-print-lib-addr-city'), text(orgUnitAddress.city()));
+ appendClear($('selfck-print-lib-addr-state'), text(orgUnitAddress.state()));
+ appendClear($('selfck-print-lib-addr-post-code'), text(orgUnitAddress.post_code()));
+ }
+ appendClear($('selfck-print-lname'), text(patron.family_name()));
+ appendClear($('selfck-print-fname'), text(patron.first_given_name()));
+ appendClear($('selfck-print-lib-phone'), text(orgUnit.phone()));
+ if(orgUnitHours) {
+ for(var i in [0, 1, 2, 3, 4, 5, 6]) {
+ appendClear($('selfck-print-dow_'+i+'_open'), text(orgUnitHours['dow_'+i+'_open']()));
+ appendClear($('selfck-print-dow_'+i+'_close'), text(orgUnitHours['dow_'+i+'_close']()));
+ }
+ }
window.print();
return;
}
<span id='selfck-print-lib-addr-state'/>
<span id='selfck-print-lib-addr-post-code'/>
</div>
- <div><span id='selfck-print-lname'/> <span id='selfck-print-fname'/></div>
- You checked out the following items:
+ <br/>
+ <div><span id='selfck-print-lname'/>, <span id='selfck-print-fname'/></div>
+ &selfck.items_out;
<ol id='selfck-print-items-list'>
<li name='selfck-print-items-template'>
<div name='title'/>
- Barcode: <span name='barcode'/>
- Due Date: <span name='due_date'/>
+ &selfck.barcode;: <span name='barcode'/>
+ &selfck.due_date;: <span name='due_date'/>
</li>
</ol>
+ <br/>
+ <div>&selfck.org_phone; <span id='selfck-print-lib-phone'/></div>
+ <br/>
+ <div>
+ <div>&selfck.org_hours;</div>
+ <table>
+ <tr><td>&selfck.day0;</td><td id='selfck-print-dow_0_open'/><td id='selfck-print-dow_0_close'/></tr>
+ <tr><td>&selfck.day1;</td><td id='selfck-print-dow_1_open'/><td id='selfck-print-dow_1_close'/></tr>
+ <tr><td>&selfck.day2;</td><td id='selfck-print-dow_2_open'/><td id='selfck-print-dow_2_close'/></tr>
+ <tr><td>&selfck.day3;</td><td id='selfck-print-dow_3_open'/><td id='selfck-print-dow_3_close'/></tr>
+ <tr><td>&selfck.day4;</td><td id='selfck-print-dow_4_open'/><td id='selfck-print-dow_4_close'/></tr>
+ <tr><td>&selfck.day5;</td><td id='selfck-print-dow_5_open'/><td id='selfck-print-dow_5_close'/></tr>
+ <tr><td>&selfck.day6;</td><td id='selfck-print-dow_6_open'/><td id='selfck-print-dow_6_close'/></tr>
+ </table>
+ </div>
</div>
</div>
</body>
<!ENTITY selfck.event.patron_not_found "The patron barcode was not found">
<!ENTITY selfck.event.item_noncat "The requested item is not in the catalog">
<!ENTITY selfck.event.item_nocirc "The requested item is not allowed to circulate">
+<!ENTITY selfck.items_out "You checked out the following items">
+<!ENTITY selfck.org_hours "Hours of Operation">
+<!ENTITY selfck.org_phone "Library Phone Number">
+<!ENTITY selfck.due_date "Due Date">
+<!ENTITY selfck.barcode "Barcode">
+<!ENTITY selfck.day0 "Monday">
+<!ENTITY selfck.day1 "Tuesday">
+<!ENTITY selfck.day2 "Wednesday">
+<!ENTITY selfck.day3 "Thursday">
+<!ENTITY selfck.day4 "Friday">
+<!ENTITY selfck.day5 "Saturday">
+<!ENTITY selfck.day6 "Sunday">