install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
);
-INSERT INTO config.upgrade_log (version) VALUES ('0107'); -- Scott McKellar
+INSERT INTO config.upgrade_log (version) VALUES ('0108'); -- berick
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
( 10, 'circ_lib.hours_of_operation'),
( 10, 'usr');
+
+-- items out selfcheck receipt
+
+INSERT INTO action_trigger.hook (key, core_type, description, passive)
+ VALUES (
+ 'format.selfcheck.items_out',
+ 'circ',
+ 'Formats items out for self-checkout receipt',
+ TRUE
+ );
+
+INSERT INTO action_trigger.event_definition (id, active, owner, name, hook, validator, reactor, group_field, granularity, template )
+ VALUES (
+ 11,
+ TRUE,
+ 1,
+ 'Self-Checkout Items Out Receipt',
+ 'format.selfcheck.items_out',
+ 'NOOP_True',
+ 'ProcessTemplate',
+ 'usr',
+ 'print-on-demand',
+$$
+[%- USE date -%]
+[%- SET user = target.0.usr -%]
+[%- SET lib = target.0.circ_lib -%]
+[%- SET lib_addr = target.0.circ_lib.billing_address -%]
+[%- SET hours = lib.hours_of_operation -%]
+<div>
+ <style> li { padding: 8px; margin 5px; }</style>
+ <div>[% date.format %]</div>
+ <div>[% lib.name %]</div>
+ <div>[% lib_addr.street1 %] [% lib_addr.street2 %]</div>
+ <div>[% lib_addr.city %], [% lib_addr.state %] [% lb_addr.post_code %]</div>
+ <div>[% lib.phone %]</div>
+ <br/>
+
+ [% user.family_name %], [% user.first_given_name %]
+ <ol>
+ [% FOR circ IN target %]
+ <li>
+ <div>[% helpers.get_copy_bib_basics(circ.target_copy.id).title %]</div>
+ <div>Barcode: [% circ.target_copy.barcode %]</div>
+ <div>Due Date: [% date.format(helpers.format_date(circ.due_date), '%Y-%m-%d') %]</div>
+ </li>
+ [% END %]
+ </ol>
+
+ <div>
+ Library Hours
+ [%- BLOCK format_time; date.format(time _ ' 1/1/1000', format='%I:%M %p'); END -%]
+ <div>
+ Monday
+ [% PROCESS format_time time = hours.dow_0_open %]
+ [% PROCESS format_time time = hours.dow_0_close %]
+ </div>
+ <div>
+ Tuesday
+ [% PROCESS format_time time = hours.dow_1_open %]
+ [% PROCESS format_time time = hours.dow_1_close %]
+ </div>
+ <div>
+ Wednesday
+ [% PROCESS format_time time = hours.dow_2_open %]
+ [% PROCESS format_time time = hours.dow_2_close %]
+ </div>
+ <div>
+ Thursday
+ [% PROCESS format_time time = hours.dow_3_open %]
+ [% PROCESS format_time time = hours.dow_3_close %]
+ </div>
+ <div>
+ Friday
+ [% PROCESS format_time time = hours.dow_4_open %]
+ [% PROCESS format_time time = hours.dow_4_close %]
+ </div>
+ <div>
+ Saturday
+ [% PROCESS format_time time = hours.dow_5_open %]
+ [% PROCESS format_time time = hours.dow_5_close %]
+ </div>
+ <div>
+ Sunday
+ [% PROCESS format_time time = hours.dow_6_open %]
+ [% PROCESS format_time time = hours.dow_6_close %]
+ </div>
+ </div>
+</div>
+$$
+);
+
+
+INSERT INTO action_trigger.environment ( event_def, path) VALUES
+ ( 11, 'target_copy'),
+ ( 11, 'circ_lib.billing_address'),
+ ( 11, 'circ_lib.hours_of_operation'),
+ ( 11, 'usr');
+
--- /dev/null
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0108');
+
+INSERT INTO action_trigger.hook (key, core_type, description, passive)
+ VALUES (
+ 'format.selfcheck.items_out',
+ 'circ',
+ 'Formats items out for self-checkout receipt',
+ TRUE
+ );
+
+INSERT INTO action_trigger.event_definition (id, active, owner, name, hook, validator, reactor, group_field, granularity, template )
+ VALUES (
+ 11,
+ TRUE,
+ 1,
+ 'Self-Checkout Items Out Receipt',
+ 'format.selfcheck.items_out',
+ 'NOOP_True',
+ 'ProcessTemplate',
+ 'usr',
+ 'print-on-demand',
+$$
+[%- USE date -%]
+[%- SET user = target.0.usr -%]
+[%- SET lib = target.0.circ_lib -%]
+[%- SET lib_addr = target.0.circ_lib.billing_address -%]
+[%- SET hours = lib.hours_of_operation -%]
+<div>
+ <style> li { padding: 8px; margin 5px; }</style>
+ <div>[% date.format %]</div>
+ <div>[% lib.name %]</div>
+ <div>[% lib_addr.street1 %] [% lib_addr.street2 %]</div>
+ <div>[% lib_addr.city %], [% lib_addr.state %] [% lb_addr.post_code %]</div>
+ <div>[% lib.phone %]</div>
+ <br/>
+
+ [% user.family_name %], [% user.first_given_name %]
+ <ol>
+ [% FOR circ IN target %]
+ <li>
+ <div>[% helpers.get_copy_bib_basics(circ.target_copy.id).title %]</div>
+ <div>Barcode: [% circ.target_copy.barcode %]</div>
+ <div>Due Date: [% date.format(helpers.format_date(circ.due_date), '%Y-%m-%d') %]</div>
+ </li>
+ [% END %]
+ </ol>
+
+ <div>
+ Library Hours
+ [%- BLOCK format_time; date.format(time _ ' 1/1/1000', format='%I:%M %p'); END -%]
+ <div>
+ Monday
+ [% PROCESS format_time time = hours.dow_0_open %]
+ [% PROCESS format_time time = hours.dow_0_close %]
+ </div>
+ <div>
+ Tuesday
+ [% PROCESS format_time time = hours.dow_1_open %]
+ [% PROCESS format_time time = hours.dow_1_close %]
+ </div>
+ <div>
+ Wednesday
+ [% PROCESS format_time time = hours.dow_2_open %]
+ [% PROCESS format_time time = hours.dow_2_close %]
+ </div>
+ <div>
+ Thursday
+ [% PROCESS format_time time = hours.dow_3_open %]
+ [% PROCESS format_time time = hours.dow_3_close %]
+ </div>
+ <div>
+ Friday
+ [% PROCESS format_time time = hours.dow_4_open %]
+ [% PROCESS format_time time = hours.dow_4_close %]
+ </div>
+ <div>
+ Saturday
+ [% PROCESS format_time time = hours.dow_5_open %]
+ [% PROCESS format_time time = hours.dow_5_close %]
+ </div>
+ <div>
+ Sunday
+ [% PROCESS format_time time = hours.dow_6_open %]
+ [% PROCESS format_time time = hours.dow_6_close %]
+ </div>
+ </div>
+</div>
+$$
+);
+
+
+INSERT INTO action_trigger.environment ( event_def, path) VALUES
+ ( 11, 'target_copy'),
+ ( 11, 'circ_lib.billing_address'),
+ ( 11, 'circ_lib.hours_of_operation'),
+ ( 11, 'usr');
+
+COMMIT;
border-left: 1px solid #888;
}
+#oils-selfck-content-header {
+ margin: 8px 10px 15px 10px;
+ padding: 8px;
+ border-bottom: 1px dashed #888;
+ text-align: right;
+ width: 100%;
+}
+
#oils-selfck-info-nav {
margin: 15px 10px 15px 10px;
padding: 8px;
this.patronBarcodeRegex = null;
this.checkouts = [];
+ this.itemsOut = [];
// During renewals, keep track of the ID of the previous circulation.
// Previous circ is used for tracking failed renewals (for receipts).
// connect onclick handlers to the various navigation links
var linkHandlers = {
'oils-selfck-hold-details-link' : function() { self.drawHoldsPage(); },
- //'oils-selfck-nav-holds' : function() { self.drawHoldsPage(); },
'oils-selfck-pay-fines-link' : function() { self.drawFinesPage(); },
- //'oils-selfck-nav-fines' : function() { self.drawFinesPage(); },
'oils-selfck-nav-home' : function() { self.drawCircPage(); },
'oils-selfck-nav-logout' : function() { self.logoutPatron(); },
'oils-selfck-nav-logout-print' : function() { self.logoutPatron(true); },
- 'oils-selfck-items-out-details-link' : function() { self.drawItemsOutPage(); }
+ 'oils-selfck-items-out-details-link' : function() { self.drawItemsOutPage(); },
+ 'oils-selfck-print-list-link' : function() { self.printList(); }
}
for(var id in linkHandlers)
var testPrint = this.cgi.param('testprint');
if(testPrint) {
this.checkouts = JSON2js(testPrint);
- this.printReceipt();
+ this.printSessionReceipt();
this.checkouts = [];
}
}
SelfCheckManager.prototype.drawCircPage = function() {
openils.Util.show('oils-selfck-circ-tbody');
+ this.goToTab('checkout');
while(this.itemsOutTbody.childNodes[0])
this.itemsOutTbody.removeChild(this.itemsOutTbody.childNodes[0]);
handler : function(barcode) { self.checkout(barcode); }
});
- openils.Util.hide('oils-selfck-payment-page');
- openils.Util.hide('oils-selfck-holds-page');
- openils.Util.show('oils-selfck-circ-page');
-
if(!this.circTemplate)
this.circTemplate = this.circTbody.removeChild(dojo.byId('oils-selfck-circ-row'));
}
}
+
SelfCheckManager.prototype.drawItemsOutPage = function() {
openils.Util.hide('oils-selfck-circ-tbody');
- openils.Util.hide('oils-selfck-payment-page');
- openils.Util.hide('oils-selfck-holds-page');
- openils.Util.show('oils-selfck-circ-page');
+
+ this.goToTab('items_out');
while(this.itemsOutTbody.childNodes[0])
this.itemsOutTbody.removeChild(this.itemsOutTbody.childNodes[0]);
progressDialog.hide();
+ self.itemsOut = [];
dojo.forEach(circs,
function(circ) {
+ self.itemsOut.push(circ.circ.id());
self.displayCheckout(
{payload : circ},
(circ.circ.parent_circ()) ? 'renew' : 'checkout',
);
}
+
+SelfCheckManager.prototype.goToTab = function(name) {
+ this.tabName = name;
+
+ openils.Util.hide('oils-selfck-payment-page');
+ openils.Util.hide('oils-selfck-holds-page');
+ openils.Util.show('oils-selfck-circ-page');
+
+ switch(name) {
+ case 'checkout':
+ openils.Util.show('oils-selfck-circ-page');
+ break;
+ case 'items_out':
+ openils.Util.show('oils-selfck-circ-page');
+ break;
+ case 'holds':
+ openils.Util.show('oils-selfck-holds-page');
+ break;
+ case 'fines':
+ openils.Util.show('oils-selfck-payment-page');
+ break;
+ }
+}
+
+
+SelfCheckManager.prototype.printList = function() {
+ switch(this.tabName) {
+ case 'checkout':
+ this.printSessionReceipt();
+ break;
+ case 'items_out':
+ this.printItemsOutReceipt();
+ break;
+ case 'holds':
+ this.printHoldsReceipt();
+ break;
+ case 'fines':
+ this.printFinesReceipt();
+ break;
+ }
+}
+
SelfCheckManager.prototype.updateHoldsSummary = function() {
if(!this.holdsSummary) {
// TODO add option to hid scanBox
// this.updateScanBox(...)
- openils.Util.hide('oils-selfck-circ-page');
- openils.Util.hide('oils-selfck-payment-page');
- openils.Util.show('oils-selfck-holds-page');
+ this.goToTab('holds');
this.holdTbody = dojo.byId('oils-selfck-hold-tbody');
if(!this.holdTemplate)
}
/**
- * Print a receipt
+ * Print a receipt for this session's checkouts
*/
-SelfCheckManager.prototype.printReceipt = function(callback) {
+SelfCheckManager.prototype.printSessionReceipt = function(callback) {
var circIds = [];
var circCtx = []; // circ context data. in this case, renewal_failure info
}
+/**
+ * Print a receipt for this user's items out
+ */
+SelfCheckManager.prototype.printItemsOutReceipt = function(callback) {
+
+ if(!this.itemsOut.length) return;
+
+ var params = [
+ this.authtoken,
+ this.staff.ws_ou(),
+ null,
+ 'format.selfcheck.items_out',
+ 'print-on-demand',
+ this.itemsOut
+ ];
+
+ var self = this;
+ fieldmapper.standardRequest(
+ ['open-ils.circ', 'open-ils.circ.fire_circ_trigger_events'],
+ {
+ async : true,
+ params : params,
+ oncomplete : function(r) {
+ var resp = openils.Util.readResponse(r);
+ var output = resp.template_output();
+ if(output) {
+ self.printData(output.data(), self.itemsOut.length, callback);
+ } else {
+ var error = resp.error_output();
+ if(error) {
+ throw new Error("Error creating receipt: " + error.data());
+ } else {
+ throw new Error("No receipt data returned from server");
+ }
+ }
+ }
+ }
+ );
+}
+
+
+
/**
* Logout the patron and return to the login page
*/
SelfCheckManager.prototype.logoutPatron = function(print) {
if(print && this.checkouts.length) {
- this.printReceipt(
+ this.printSessionReceipt(
function() {
location.href = location.href;
}
</div>
<div id='oils-selfck-bottom-div'>
<div id='oils-selfck-content-div'>
+ <div id='oils-selfck-content-header'>
+ <a id='oils-selfck-print-list-link' href='javascript:void(0);'>Print List</a>
+ </div>
<div id='oils-selfck-circ-page' class='hidden'>
<!-- Checkout / renewal interface -->
[% INCLUDE 'default/circ/selfcheck/circ_page.tt2' %]