[open-ils-commits] r17060 - in trunk/Open-ILS: src/perlmods/OpenILS/Application src/sql/Pg src/sql/Pg/upgrade xul/staff_client/server/cat (phasefx)
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Aug 2 10:17:04 EDT 2010
Author: phasefx
Date: 2010-08-02 10:17:02 -0400 (Mon, 02 Aug 2010)
New Revision: 17060
Added:
trunk/Open-ILS/src/sql/Pg/upgrade/0355.data.missing_pieces_format.sql
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm
trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql
trunk/Open-ILS/xul/staff_client/server/cat/util.js
Log:
toward printing slip and letter for missing pieces
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm 2010-07-30 20:27:14 UTC (rev 17059)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm 2010-08-02 14:17:02 UTC (rev 17060)
@@ -1324,12 +1324,14 @@
if ($e->commit) {
my $ses = OpenSRF::AppSession->create('open-ils.trigger');
- $ses->request('open-ils.trigger.event.autocreate', 'checkout.missing_pieces', $circ, $circ->circ_lib);
+ $ses->request('open-ils.trigger.event.autocreate', 'circ.missing_pieces', $circ, $circ->circ_lib);
return OpenILS::Event->new('SUCCESS',
payload => {
circ => $circ,
- copy => $copy
+ copy => $copy,
+ slip => $U->fire_object_event(undef, 'circ.format.missing_pieces.slip.print', $circ, $circ->circ_lib),
+ letter => $U->fire_object_event(undef, 'circ.format.missing_pieces.letter.print', $circ, $circ->circ_lib)
}
);
Modified: trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/002.schema.config.sql 2010-07-30 20:27:14 UTC (rev 17059)
+++ trunk/Open-ILS/src/sql/Pg/002.schema.config.sql 2010-08-02 14:17:02 UTC (rev 17060)
@@ -68,7 +68,7 @@
install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
);
-INSERT INTO config.upgrade_log (version) VALUES ('0354'); -- berick
+INSERT INTO config.upgrade_log (version) VALUES ('0355'); -- phasefx
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 2010-07-30 20:27:14 UTC (rev 17059)
+++ trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql 2010-08-02 14:17:02 UTC (rev 17060)
@@ -5947,3 +5947,126 @@
'array'
);
+-- 0355.data.missing_pieces_format.sql
+
+INSERT INTO action_trigger.hook (key,core_type,description,passive) VALUES
+ ( 'circ.format.missing_pieces.slip.print',
+ 'circ',
+ oils_i18n_gettext(
+ 'circ.format.missing_pieces.slip.print',
+ 'A missing pieces slip needs to be formatted for printing.',
+ 'ath',
+ 'description'
+ ),
+ FALSE
+ )
+ ,( 'circ.format.missing_pieces.letter.print',
+ 'circ',
+ oils_i18n_gettext(
+ 'circ.format.missing_pieces.letter.print',
+ 'A missing pieces patron letter needs to be formatted for printing.',
+ 'ath',
+ 'description'
+ ),
+ FALSE
+ )
+;
+
+INSERT INTO action_trigger.event_definition (
+ id,
+ active,
+ owner,
+ name,
+ hook,
+ validator,
+ reactor,
+ group_field,
+ granularity,
+ template
+ ) VALUES (
+ 33,
+ TRUE,
+ 1,
+ 'circ.missing_pieces.slip.print',
+ 'circ.format.missing_pieces.slip.print',
+ 'NOOP_True',
+ 'ProcessTemplate',
+ 'usr',
+ 'print-on-demand',
+$$
+[%- USE date -%]
+[%- SET user = target.0.usr -%]
+<div style="li { padding: 8px; margin 5px; }">
+ <div>[% date.format %]</div><br/>
+ Missing pieces for:
+ <ol>
+ [% FOR circ IN target %]
+ <li>Barcode: [% circ.target_copy.barcode %] Transaction ID: [% circ.id %] Due: [% circ.due_date.format %]<br />
+ [% helpers.get_copy_bib_basics(circ.target_copy.id).title %]
+ </li>
+ [% END %]
+ </ol>
+</div>
+$$
+ )
+ ,(
+ 34,
+ TRUE,
+ 1,
+ 'circ.missing_pieces.letter.print',
+ 'circ.format.missing_pieces.letter.print',
+ 'NOOP_True',
+ 'ProcessTemplate',
+ 'usr',
+ 'print-on-demand',
+$$
+[%- USE date -%]
+[%- SET user = target.0.usr -%]
+[% date.format %]
+Dear [% user.prefix %] [% user.first_given_name %] [% user.family_name %],
+
+We are missing pieces for the following returned items:
+[% FOR circ IN target %]
+Barcode: [% circ.target_copy.barcode %] Transaction ID: [% circ.id %] Due: [% circ.due_date.format %]
+[% helpers.get_copy_bib_basics(circ.target_copy.id).title %]
+[% END %]
+
+Please return these pieces as soon as possible.
+
+Thanks!
+
+Library Staff
+$$
+ )
+;
+
+INSERT INTO action_trigger.environment (
+ event_def,
+ path
+ ) VALUES -- for fleshing circ objects
+ ( 33, 'usr')
+ ,( 33, 'target_copy')
+ ,( 33, 'target_copy.circ_lib')
+ ,( 33, 'target_copy.circ_lib.mailing_address')
+ ,( 33, 'target_copy.circ_lib.billing_address')
+ ,( 33, 'target_copy.call_number')
+ ,( 33, 'target_copy.call_number.owning_lib')
+ ,( 33, 'target_copy.call_number.owning_lib.mailing_address')
+ ,( 33, 'target_copy.call_number.owning_lib.billing_address')
+ ,( 33, 'circ_lib')
+ ,( 33, 'circ_lib.mailing_address')
+ ,( 33, 'circ_lib.billing_address')
+ ,( 34, 'usr')
+ ,( 34, 'target_copy')
+ ,( 34, 'target_copy.circ_lib')
+ ,( 34, 'target_copy.circ_lib.mailing_address')
+ ,( 34, 'target_copy.circ_lib.billing_address')
+ ,( 34, 'target_copy.call_number')
+ ,( 34, 'target_copy.call_number.owning_lib')
+ ,( 34, 'target_copy.call_number.owning_lib.mailing_address')
+ ,( 34, 'target_copy.call_number.owning_lib.billing_address')
+ ,( 34, 'circ_lib')
+ ,( 34, 'circ_lib.mailing_address')
+ ,( 34, 'circ_lib.billing_address')
+;
+
Added: trunk/Open-ILS/src/sql/Pg/upgrade/0355.data.missing_pieces_format.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/upgrade/0355.data.missing_pieces_format.sql (rev 0)
+++ trunk/Open-ILS/src/sql/Pg/upgrade/0355.data.missing_pieces_format.sql 2010-08-02 14:17:02 UTC (rev 17060)
@@ -0,0 +1,129 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0355'); -- phasefx
+
+INSERT INTO action_trigger.hook (key,core_type,description,passive) VALUES
+ ( 'circ.format.missing_pieces.slip.print',
+ 'circ',
+ oils_i18n_gettext(
+ 'circ.format.missing_pieces.slip.print',
+ 'A missing pieces slip needs to be formatted for printing.',
+ 'ath',
+ 'description'
+ ),
+ FALSE
+ )
+ ,( 'circ.format.missing_pieces.letter.print',
+ 'circ',
+ oils_i18n_gettext(
+ 'circ.format.missing_pieces.letter.print',
+ 'A missing pieces patron letter needs to be formatted for printing.',
+ 'ath',
+ 'description'
+ ),
+ FALSE
+ )
+;
+
+INSERT INTO action_trigger.event_definition (
+ id,
+ active,
+ owner,
+ name,
+ hook,
+ validator,
+ reactor,
+ group_field,
+ granularity,
+ template
+ ) VALUES (
+ 33,
+ TRUE,
+ 1,
+ 'circ.missing_pieces.slip.print',
+ 'circ.format.missing_pieces.slip.print',
+ 'NOOP_True',
+ 'ProcessTemplate',
+ 'usr',
+ 'print-on-demand',
+$$
+[%- USE date -%]
+[%- SET user = target.0.usr -%]
+<div style="li { padding: 8px; margin 5px; }">
+ <div>[% date.format %]</div><br/>
+ Missing pieces for:
+ <ol>
+ [% FOR circ IN target %]
+ <li>Barcode: [% circ.target_copy.barcode %] Transaction ID: [% circ.id %] Due: [% circ.due_date.format %]<br />
+ [% helpers.get_copy_bib_basics(circ.target_copy.id).title %]
+ </li>
+ [% END %]
+ </ol>
+</div>
+$$
+ )
+ ,(
+ 34,
+ TRUE,
+ 1,
+ 'circ.missing_pieces.letter.print',
+ 'circ.format.missing_pieces.letter.print',
+ 'NOOP_True',
+ 'ProcessTemplate',
+ 'usr',
+ 'print-on-demand',
+$$
+[%- USE date -%]
+[%- SET user = target.0.usr -%]
+[% date.format %]
+Dear [% user.prefix %] [% user.first_given_name %] [% user.family_name %],
+
+We are missing pieces for the following returned items:
+[% FOR circ IN target %]
+Barcode: [% circ.target_copy.barcode %] Transaction ID: [% circ.id %] Due: [% circ.due_date.format %]
+[% helpers.get_copy_bib_basics(circ.target_copy.id).title %]
+[% END %]
+
+Please return these pieces as soon as possible.
+
+Thanks!
+
+Library Staff
+$$
+ )
+;
+
+INSERT INTO action_trigger.environment (
+ event_def,
+ path
+ ) VALUES -- for fleshing circ objects
+ ( 33, 'usr')
+ ,( 33, 'target_copy')
+ ,( 33, 'target_copy.circ_lib')
+ ,( 33, 'target_copy.circ_lib.mailing_address')
+ ,( 33, 'target_copy.circ_lib.billing_address')
+ ,( 33, 'target_copy.call_number')
+ ,( 33, 'target_copy.call_number.owning_lib')
+ ,( 33, 'target_copy.call_number.owning_lib.mailing_address')
+ ,( 33, 'target_copy.call_number.owning_lib.billing_address')
+ ,( 33, 'circ_lib')
+ ,( 33, 'circ_lib.mailing_address')
+ ,( 33, 'circ_lib.billing_address')
+ ,( 34, 'usr')
+ ,( 34, 'target_copy')
+ ,( 34, 'target_copy.circ_lib')
+ ,( 34, 'target_copy.circ_lib.mailing_address')
+ ,( 34, 'target_copy.circ_lib.billing_address')
+ ,( 34, 'target_copy.call_number')
+ ,( 34, 'target_copy.call_number.owning_lib')
+ ,( 34, 'target_copy.call_number.owning_lib.mailing_address')
+ ,( 34, 'target_copy.call_number.owning_lib.billing_address')
+ ,( 34, 'circ_lib')
+ ,( 34, 'circ_lib.mailing_address')
+ ,( 34, 'circ_lib.billing_address')
+;
+
+-- DELETE FROM config.upgrade_log WHERE version = 'temp'; DELETE FROM action_trigger.event WHERE event_def IN (33,34); DELETE FROM action_trigger.environment WHERE event_def IN (33,34); DELETE FROM action_trigger.event_definition WHERE id IN (33,34); DELETE FROM action_trigger.hook WHERE key IN ( 'circ.format.missing_pieces.slip.print', 'circ.format.missing_pieces.letter.print' );
+
+COMMIT;
+
Modified: trunk/Open-ILS/xul/staff_client/server/cat/util.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/cat/util.js 2010-07-30 20:27:14 UTC (rev 17059)
+++ trunk/Open-ILS/xul/staff_client/server/cat/util.js 2010-08-02 14:17:02 UTC (rev 17060)
@@ -759,11 +759,18 @@
for (var i = 0; i < copies.length; i++) {
try {
var robj = network.simple_request('MARK_ITEM_MISSING_PIECES',[ses(),copies[i].id()]);
- if (typeof robj.ilsevent != 'undefined') { throw(robj); }
- // TODO: Print missing pieces slip
- // TODO: Bill patron prompt
- // TODO: Item/patron notes/messages
- // TODO: Invoke 3rd party app with letter to patron
+ if (typeof robj.ilsevent != 'undefined') {
+ if (robj.ilsevent == 0 /* SUCCESS */) {
+ // TODO: Print missing pieces slip
+ // TODO: Item/patron notes/messages
+ // TODO: Invoke 3rd party app with letter to patron
+ } else if (robj.ilsevent == 1500 /* ACTION_CIRCULATION_NOT_FOUND */) {
+ } else {
+ throw(robj);
+ }
+ } else {
+ throw(robj);
+ }
count++;
} catch(E) {
error.standard_unexpected_error_alert($("catStrings").getFormattedString('staff.cat.util.mark_item_missing_pieces.marking_error', [copies[i].barcode()]),E);
More information about the open-ils-commits
mailing list