From 8d1c541c1fdb4196dec38f23c9666f33a7d6c1c7 Mon Sep 17 00:00:00 2001 From: erickson Date: Wed, 9 Dec 2009 14:39:14 +0000 Subject: [PATCH] added sample selfcheck fines receipt and plugged in fines printing from self-check UI git-svn-id: svn://svn.open-ils.org/ILS/trunk@15120 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +- Open-ILS/src/sql/Pg/950.data.seed-values.sql | 53 ++++++++++++++++++++ .../0112.data.selfcheck-fines-receipt-template.sql | 56 ++++++++++++++++++++++ .../web/js/ui/default/circ/selfcheck/selfcheck.js | 43 +++++++++++++++++ .../web/templates/default/circ/selfcheck/fines.tt2 | 2 +- 5 files changed, 154 insertions(+), 2 deletions(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/0112.data.selfcheck-fines-receipt-template.sql diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index 2800847479..8371144e89 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -51,7 +51,7 @@ CREATE TABLE config.upgrade_log ( 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, diff --git a/Open-ILS/src/sql/Pg/950.data.seed-values.sql b/Open-ILS/src/sql/Pg/950.data.seed-values.sql index dec3a7df55..0f6ac05bc1 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -2840,3 +2840,56 @@ INSERT INTO action_trigger.environment ( event_def, path) VALUES ( 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 -%] +
+ +
[% date.format %]
+
+ + [% user.family_name %], [% user.first_given_name %] +
    + [% FOR xact IN user.open_billable_transactions_summary %] +
  1. +
    Details: + [% IF xact.xact_type == 'circulation' %] + [%- helpers.get_copy_bib_basics(xact.circulation.target_copy).title -%] + [% ELSE %] + [%- xact.last_billing_type -%] + [% END %] +
    +
    Total Billed: [% xact.total_owed %]
    +
    Total Paid: [% xact.total_paid %]
    +
    Balance Owed : [% xact.balance_owed %]
    +
  2. + [% END %] +
+
+$$ +); + + +INSERT INTO action_trigger.environment ( event_def, path) VALUES + ( 13, 'open_billable_transactions_summary.circulation' ); + diff --git a/Open-ILS/src/sql/Pg/upgrade/0112.data.selfcheck-fines-receipt-template.sql b/Open-ILS/src/sql/Pg/upgrade/0112.data.selfcheck-fines-receipt-template.sql new file mode 100644 index 0000000000..65ad27f517 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/0112.data.selfcheck-fines-receipt-template.sql @@ -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 -%] +
+ +
[% date.format %]
+
+ + [% user.family_name %], [% user.first_given_name %] +
    + [% FOR xact IN user.open_billable_transactions_summary %] +
  1. +
    Details: + [% IF xact.xact_type == 'circulation' %] + [%- helpers.get_copy_bib_basics(xact.circulation.target_copy).title -%] + [% ELSE %] + [%- xact.last_billing_type -%] + [% END %] +
    +
    Total Billed: [% xact.total_owed %]
    +
    Total Paid: [% xact.total_paid %]
    +
    Balance Owed : [% xact.balance_owed %]
    +
  2. + [% END %] +
+
+$$ +); + + +INSERT INTO action_trigger.environment ( event_def, path) VALUES + ( 13, 'open_billable_transactions_summary.circulation' ); + +COMMIT; diff --git a/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js b/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js index 8e16638c84..8b909800a7 100644 --- a/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js +++ b/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js @@ -610,6 +610,7 @@ SelfCheckManager.prototype.drawFinesPage = function() { 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,6 +1103,48 @@ SelfCheckManager.prototype.printHoldsReceipt = function(callback) { } +/** + * 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"); + } + } + } + } + ); +} + + /** diff --git a/Open-ILS/web/templates/default/circ/selfcheck/fines.tt2 b/Open-ILS/web/templates/default/circ/selfcheck/fines.tt2 index 423cc25b48..36de24fe6d 100644 --- a/Open-ILS/web/templates/default/circ/selfcheck/fines.tt2 +++ b/Open-ILS/web/templates/default/circ/selfcheck/fines.tt2 @@ -4,7 +4,7 @@ Type Details - Total Owed + Total Billed Total Paid Balance Owed -- 2.11.0