From 672b6863ecb31a061c9de597df0f7fe4c9bef0ca Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Tue, 20 Sep 2011 15:44:12 -0400 Subject: [PATCH] ACQ: Add open holds count to lineitem worksheet Includes a generic bre_open_holds_count reactor utility method Signed-off-by: Bill Erickson Signed-off-by: Lebbeous Fogle-Weekley --- .../OpenILS/Application/Trigger/Reactor.pm | 9 ++ Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +- Open-ILS/src/sql/Pg/950.data.seed-values.sql | 1 + .../0642.data.acq-worksheet-hold-count.sql | 85 +++++++++++++++++++ 4 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/0642.data.acq-worksheet-hold-count.sql diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor.pm index 0f6262ff4d..5f0797226c 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor.pm @@ -237,6 +237,15 @@ my $_TT_helpers = { return $str; }, + + bre_open_hold_count => sub { + my $bre_id = shift; + return 0 unless $bre_id; + return $U->simplereq( + 'open-ils.circ', + 'open-ils.circ.bre.holds.count', $bre_id); + }, + xml_doc => sub { my ($str) = @_; return $str ? (new XML::LibXML)->parse_string($str) : undef; diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index acccf52f37..02ba712f59 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -86,7 +86,7 @@ CREATE TRIGGER no_overlapping_deps BEFORE INSERT OR UPDATE ON config.db_patch_dependencies FOR EACH ROW EXECUTE PROCEDURE evergreen.array_overlap_check ('deprecates'); -INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0641', :eg_version); -- tsbere/phasefx +INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0642', :eg_version); -- berick/senator 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 637a01447c..9ea1baad09 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -7570,6 +7570,7 @@ $$
Author: [% helpers.get_li_attr("author", "", li.attributes) %]
Item Count: [% li.lineitem_details.size %]
Lineitem ID: [% li.id %]
+
Open Holds: [% helpers.bre_open_hold_count(li.eg_bib_id) %]
[% IF li.distribution_formulas.size > 0 %] [% SET forms = [] %] diff --git a/Open-ILS/src/sql/Pg/upgrade/0642.data.acq-worksheet-hold-count.sql b/Open-ILS/src/sql/Pg/upgrade/0642.data.acq-worksheet-hold-count.sql new file mode 100644 index 0000000000..ad909897ef --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/0642.data.acq-worksheet-hold-count.sql @@ -0,0 +1,85 @@ +-- Evergreen DB patch 0642.data.acq-worksheet-hold-count.sql +BEGIN; + +-- check whether patch can be applied +SELECT evergreen.upgrade_deps_block_check('0642', :eg_version); + +UPDATE action_trigger.event_definition SET template = +$$ +[%- USE date -%] +[%- SET li = target; -%] +
+
+ +
Title: [% helpers.get_li_attr("title", "", li.attributes) %]
+
Author: [% helpers.get_li_attr("author", "", li.attributes) %]
+
Item Count: [% li.lineitem_details.size %]
+
Lineitem ID: [% li.id %]
+
Open Holds: [% helpers.bre_open_hold_count(li.eg_bib_id) %]
+ + [% IF li.distribution_formulas.size > 0 %] + [% SET forms = [] %] + [% FOREACH form IN li.distribution_formulas; forms.push(form.formula.name); END %] +
Distribution Formulas: [% forms.join(',') %]
+ [% END %] + + [% IF li.lineitem_notes.size > 0 %] + Lineitem Notes: +
    + [%- FOR note IN li.lineitem_notes -%] +
  • + [% IF note.alert_text %] + [% note.alert_text.code -%] + [% IF note.value -%] + : [% note.value %] + [% END %] + [% ELSE %] + [% note.value -%] + [% END %] +
  • + [% END %] +
+ [% END %] +
+
+ + + + + + + + + + + + + + [% FOREACH detail IN li.lineitem_details.sort('owning_lib') %] + [% + IF detail.eg_copy_id; + SET copy = detail.eg_copy_id; + SET cn_label = copy.call_number.label; + ELSE; + SET copy = detail; + SET cn_label = detail.cn_label; + END + %] + + + + + + + + + + + [% END %] + +
BranchBarcodeCall NumberFundShelving LocationRecd.Notes
[% detail.owning_lib.shortname %][% IF copy.barcode %][% detail.barcode %][% END %][% IF cn_label %][% cn_label %][% END %][% IF detail.fund %][% detail.fund.code %] ([% detail.fund.year %])[% END %][% copy.location.name %][% IF detail.recv_time %][% detail.recv_time %][% END %][% detail.note %]
+
+$$ +WHERE id = 14; + +COMMIT; -- 2.43.2