[open-ils-commits] r15101 - in trunk/Open-ILS: src/sql/Pg src/sql/Pg/upgrade web/css/skin/default web/js/ui/default/circ/selfcheck web/templates/default/circ/selfcheck (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Dec 8 11:47:10 EST 2009
Author: erickson
Date: 2009-12-08 11:47:07 -0500 (Tue, 08 Dec 2009)
New Revision: 15101
Added:
trunk/Open-ILS/src/sql/Pg/upgrade/0108.data.selfcheck-itemsout-receipt-template.sql
Modified:
trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql
trunk/Open-ILS/web/css/skin/default/selfcheck.css
trunk/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js
trunk/Open-ILS/web/templates/default/circ/selfcheck/main.tt2
Log:
plugged in items-out receipt template and printing for selfcheck
Modified: trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/002.schema.config.sql 2009-12-08 16:29:53 UTC (rev 15100)
+++ trunk/Open-ILS/src/sql/Pg/002.schema.config.sql 2009-12-08 16:47:07 UTC (rev 15101)
@@ -51,7 +51,7 @@
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,
Modified: trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql 2009-12-08 16:29:53 UTC (rev 15100)
+++ trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql 2009-12-08 16:47:07 UTC (rev 15101)
@@ -2731,3 +2731,101 @@
( 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');
+
Added: trunk/Open-ILS/src/sql/Pg/upgrade/0108.data.selfcheck-itemsout-receipt-template.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/upgrade/0108.data.selfcheck-itemsout-receipt-template.sql (rev 0)
+++ trunk/Open-ILS/src/sql/Pg/upgrade/0108.data.selfcheck-itemsout-receipt-template.sql 2009-12-08 16:47:07 UTC (rev 15101)
@@ -0,0 +1,100 @@
+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;
Modified: trunk/Open-ILS/web/css/skin/default/selfcheck.css
===================================================================
--- trunk/Open-ILS/web/css/skin/default/selfcheck.css 2009-12-08 16:29:53 UTC (rev 15100)
+++ trunk/Open-ILS/web/css/skin/default/selfcheck.css 2009-12-08 16:47:07 UTC (rev 15101)
@@ -72,6 +72,14 @@
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;
Modified: trunk/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js 2009-12-08 16:29:53 UTC (rev 15100)
+++ trunk/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js 2009-12-08 16:47:07 UTC (rev 15101)
@@ -30,6 +30,7 @@
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).
@@ -90,13 +91,12 @@
// 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)
@@ -120,7 +120,7 @@
var testPrint = this.cgi.param('testprint');
if(testPrint) {
this.checkouts = JSON2js(testPrint);
- this.printReceipt();
+ this.printSessionReceipt();
this.checkouts = [];
}
}
@@ -299,6 +299,7 @@
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]);
@@ -309,10 +310,6 @@
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'));
@@ -347,12 +344,12 @@
}
}
+
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]);
@@ -378,8 +375,10 @@
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',
@@ -392,6 +391,48 @@
);
}
+
+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) {
@@ -463,9 +504,7 @@
// 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)
@@ -840,9 +879,9 @@
}
/**
- * 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
@@ -917,13 +956,55 @@
}
+/**
+ * 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;
}
Modified: trunk/Open-ILS/web/templates/default/circ/selfcheck/main.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/circ/selfcheck/main.tt2 2009-12-08 16:29:53 UTC (rev 15100)
+++ trunk/Open-ILS/web/templates/default/circ/selfcheck/main.tt2 2009-12-08 16:47:07 UTC (rev 15101)
@@ -17,6 +17,9 @@
</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' %]
More information about the open-ils-commits
mailing list