[open-ils-commits] r15120 - in trunk/Open-ILS: src/sql/Pg src/sql/Pg/upgrade web/js/ui/default/circ/selfcheck web/templates/default/circ/selfcheck (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Dec 9 09:39:16 EST 2009
Author: erickson
Date: 2009-12-09 09:39:14 -0500 (Wed, 09 Dec 2009)
New Revision: 15120
Added:
trunk/Open-ILS/src/sql/Pg/upgrade/0112.data.selfcheck-fines-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/js/ui/default/circ/selfcheck/selfcheck.js
trunk/Open-ILS/web/templates/default/circ/selfcheck/fines.tt2
Log:
added sample selfcheck fines receipt and plugged in fines printing from self-check UI
Modified: trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/002.schema.config.sql 2009-12-09 14:34:54 UTC (rev 15119)
+++ trunk/Open-ILS/src/sql/Pg/002.schema.config.sql 2009-12-09 14:39:14 UTC (rev 15120)
@@ -51,7 +51,7 @@
install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
);
-INSERT INTO config.upgrade_log (version) VALUES ('0111'); -- berick
+INSERT INTO config.upgrade_log (version) VALUES ('0112'); -- 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-09 14:34:54 UTC (rev 15119)
+++ trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql 2009-12-09 14:39:14 UTC (rev 15120)
@@ -2840,3 +2840,56 @@
( 12, 'pickup_lib'),
( 12, 'usr');
+-- fines receipt
+
+INSERT INTO action_trigger.hook (key, core_type, description, passive)
+ VALUES (
+ 'format.selfcheck.fines',
+ 'au',
+ 'Formats fines for self-checkout receipt',
+ TRUE
+ );
+
+INSERT INTO action_trigger.event_definition (id, active, owner, name, hook, validator, reactor, granularity, template )
+ VALUES (
+ 13,
+ TRUE,
+ 1,
+ 'Self-Checkout Fines Receipt',
+ 'format.selfcheck.fines',
+ 'NOOP_True',
+ 'ProcessTemplate',
+ 'print-on-demand',
+$$
+[%- USE date -%]
+[%- SET user = target -%]
+<div>
+ <style> li { padding: 8px; margin 5px; }</style>
+ <div>[% date.format %]</div>
+ <br/>
+
+ [% user.family_name %], [% user.first_given_name %]
+ <ol>
+ [% FOR xact IN user.open_billable_transactions_summary %]
+ <li>
+ <div>Details:
+ [% IF xact.xact_type == 'circulation' %]
+ [%- helpers.get_copy_bib_basics(xact.circulation.target_copy).title -%]
+ [% ELSE %]
+ [%- xact.last_billing_type -%]
+ [% END %]
+ </div>
+ <div>Total Billed: [% xact.total_owed %]</div>
+ <div>Total Paid: [% xact.total_paid %]</div>
+ <div>Balance Owed : [% xact.balance_owed %]</div>
+ </li>
+ [% END %]
+ </ol>
+</div>
+$$
+);
+
+
+INSERT INTO action_trigger.environment ( event_def, path) VALUES
+ ( 13, 'open_billable_transactions_summary.circulation' );
+
Added: trunk/Open-ILS/src/sql/Pg/upgrade/0112.data.selfcheck-fines-receipt-template.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/upgrade/0112.data.selfcheck-fines-receipt-template.sql (rev 0)
+++ trunk/Open-ILS/src/sql/Pg/upgrade/0112.data.selfcheck-fines-receipt-template.sql 2009-12-09 14:39:14 UTC (rev 15120)
@@ -0,0 +1,56 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0112');
+
+INSERT INTO action_trigger.hook (key, core_type, description, passive)
+ VALUES (
+ 'format.selfcheck.fines',
+ 'au',
+ 'Formats fines for self-checkout receipt',
+ TRUE
+ );
+
+INSERT INTO action_trigger.event_definition (id, active, owner, name, hook, validator, reactor, granularity, template )
+ VALUES (
+ 13,
+ TRUE,
+ 1,
+ 'Self-Checkout Fines Receipt',
+ 'format.selfcheck.fines',
+ 'NOOP_True',
+ 'ProcessTemplate',
+ 'print-on-demand',
+$$
+[%- USE date -%]
+[%- SET user = target -%]
+<div>
+ <style> li { padding: 8px; margin 5px; }</style>
+ <div>[% date.format %]</div>
+ <br/>
+
+ [% user.family_name %], [% user.first_given_name %]
+ <ol>
+ [% FOR xact IN user.open_billable_transactions_summary %]
+ <li>
+ <div>Details:
+ [% IF xact.xact_type == 'circulation' %]
+ [%- helpers.get_copy_bib_basics(xact.circulation.target_copy).title -%]
+ [% ELSE %]
+ [%- xact.last_billing_type -%]
+ [% END %]
+ </div>
+ <div>Total Billed: [% xact.total_owed %]</div>
+ <div>Total Paid: [% xact.total_paid %]</div>
+ <div>Balance Owed : [% xact.balance_owed %]</div>
+ </li>
+ [% END %]
+ </ol>
+</div>
+$$
+);
+
+
+INSERT INTO action_trigger.environment ( event_def, path) VALUES
+ ( 13, 'open_billable_transactions_summary.circulation' );
+
+COMMIT;
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-09 14:34:54 UTC (rev 15119)
+++ trunk/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js 2009-12-09 14:39:14 UTC (rev 15120)
@@ -610,6 +610,7 @@
var self = this;
var handler = function(dataList) {
+ self.finesCount = dataList.length;
for(var i in dataList) {
var data = dataList[i];
var row = self.finesTemplate.cloneNode(true);
@@ -1102,8 +1103,50 @@
}
+/**
+ * Print a receipt for this user's items out
+ */
+SelfCheckManager.prototype.printFinesReceipt = function(callback) {
+ progressDialog.show(true);
+ var params = [
+ this.authtoken,
+ this.staff.ws_ou(),
+ null,
+ 'format.selfcheck.fines',
+ 'print-on-demand',
+ [this.patron.id()]
+ ];
+
+ var self = this;
+ fieldmapper.standardRequest(
+ ['open-ils.circ', 'open-ils.circ.fire_user_trigger_events'],
+ {
+ async : true,
+ params : params,
+ oncomplete : function(r) {
+ progressDialog.hide();
+ var resp = openils.Util.readResponse(r);
+ var output = resp.template_output();
+ if(output) {
+ self.printData(output.data(), self.finesCount, 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
*/
Modified: trunk/Open-ILS/web/templates/default/circ/selfcheck/fines.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/circ/selfcheck/fines.tt2 2009-12-09 14:34:54 UTC (rev 15119)
+++ trunk/Open-ILS/web/templates/default/circ/selfcheck/fines.tt2 2009-12-09 14:39:14 UTC (rev 15120)
@@ -4,7 +4,7 @@
<tr>
<td>Type</td>
<td>Details</td>
- <td>Total Owed</td>
+ <td>Total Billed</td>
<td>Total Paid</td>
<td>Balance Owed</td>
</tr>
More information about the open-ils-commits
mailing list