[open-ils-commits] [GIT] Evergreen ILS branch master updated. 4b462fb7dd61713d69c89d3b02c4ad77217b441d

Evergreen Git git at git.evergreen-ils.org
Tue Aug 29 17:46:13 EDT 2017


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  4b462fb7dd61713d69c89d3b02c4ad77217b441d (commit)
       via  4ec0f29df944193ea668f67380c7d2a487bffb4f (commit)
       via  0325d0a5fcee2c6747064bdedee5d4c3462ea3f0 (commit)
      from  9e60f478f574f546bd40a019f75cb4119130ae8f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 4b462fb7dd61713d69c89d3b02c4ad77217b441d
Author: Jason Etheridge <jason at EquinoxInitiative.org>
Date:   Tue Aug 29 17:44:26 2017 -0400

    lp1582354 stamping schema upgrade
    
    and some other tweaks:
    
    1) removing permacrud stanza from IDL entry
    2) changing a tab to spaces
    3) making the upgrade script match the extend-reporter.sql change
    
    Signed-off-by: Jason Etheridge <jason at EquinoxInitiative.org>

diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml
index 90d83f1..7764758 100644
--- a/Open-ILS/examples/fm_IDL.xml
+++ b/Open-ILS/examples/fm_IDL.xml
@@ -9507,11 +9507,6 @@ SELECT  usr,
 			<link field="circ_lib" reltype="has_a" key="id" map="" class="aou"/>
 			<link field="owning_lib" reltype="has_a" key="id" map="" class="aou"/>
 		</links>
-		<permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
-			<actions>
-				<retrieve />
-			</actions>
-		</permacrud>
 	</class>
 	<class id="acqdf" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="acq::distribution_formula" oils_persist:tablename="acq.distribution_formula" reporter:label="Distribution Formula">
 		<fields oils_persist:primary="id" oils_persist:sequence="acq.distribution_formula_id_seq">
diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql
index e73c016..9bf7ff5 100644
--- a/Open-ILS/src/sql/Pg/002.schema.config.sql
+++ b/Open-ILS/src/sql/Pg/002.schema.config.sql
@@ -90,7 +90,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 ('1059', :eg_version); -- Stompro/DPearl/kmlussier
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('1060', :eg_version); -- Bmagic/csharp/phasefx
 
 CREATE TABLE config.bib_source (
 	id		SERIAL	PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/extend-reporter.sql b/Open-ILS/src/sql/Pg/extend-reporter.sql
index a524cbb..d245f40 100644
--- a/Open-ILS/src/sql/Pg/extend-reporter.sql
+++ b/Open-ILS/src/sql/Pg/extend-reporter.sql
@@ -58,7 +58,7 @@ CREATE OR REPLACE VIEW extend_reporter.global_bibs_by_holding_update AS
 CREATE OR REPLACE VIEW extend_reporter.copy_count_per_org AS
  SELECT acn.record AS bibid,
     ac.circ_lib,
-	acn.owning_lib,
+    acn.owning_lib,
     max(ac.edit_date) AS last_edit_time,
     min(ac.deleted::integer) AS has_only_deleted_copies,
     count(
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.LP1582354_report_able_to_show_bibs_where_the_last_copy_was_deleted_cancels.sql b/Open-ILS/src/sql/Pg/upgrade/1060.LP1582354_report_able_to_show_bibs_where_the_last_copy_was_deleted_cancels.sql
similarity index 82%
rename from Open-ILS/src/sql/Pg/upgrade/XXXX.LP1582354_report_able_to_show_bibs_where_the_last_copy_was_deleted_cancels.sql
rename to Open-ILS/src/sql/Pg/upgrade/1060.LP1582354_report_able_to_show_bibs_where_the_last_copy_was_deleted_cancels.sql
index 9b34294..1b852a6 100644
--- a/Open-ILS/src/sql/Pg/upgrade/XXXX.LP1582354_report_able_to_show_bibs_where_the_last_copy_was_deleted_cancels.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/1060.LP1582354_report_able_to_show_bibs_where_the_last_copy_was_deleted_cancels.sql
@@ -1,6 +1,6 @@
 BEGIN;
 
-SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+SELECT evergreen.upgrade_deps_block_check('1060', :eg_version);
 
 DROP VIEW IF EXISTS extend_reporter.copy_count_per_org;
 
@@ -8,6 +8,7 @@ DROP VIEW IF EXISTS extend_reporter.copy_count_per_org;
 CREATE OR REPLACE VIEW extend_reporter.copy_count_per_org AS
  SELECT acn.record AS bibid,
     ac.circ_lib,
+    acn.owning_lib,
     max(ac.edit_date) AS last_edit_time,
     min(ac.deleted::integer) AS has_only_deleted_copies,
     count(
@@ -24,7 +25,7 @@ CREATE OR REPLACE VIEW extend_reporter.copy_count_per_org AS
    FROM asset.call_number acn,
     asset.copy ac
   WHERE ac.call_number = acn.id
-  GROUP BY acn.record, ac.circ_lib;
+  GROUP BY acn.record, acn.owning_lib, ac.circ_lib;
 
 
 COMMIT;

commit 4ec0f29df944193ea668f67380c7d2a487bffb4f
Author: Chris Sharp <csharp at georgialibraries.org>
Date:   Thu Sep 29 13:08:15 2016 -0400

    LP#1582354 - Add owning_lib to available links.
    
    Signed-off-by: Chris Sharp <csharp at georgialibraries.org>
    Signed-off-by: Jason Etheridge <jason at EquinoxInitiative.org>

diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml
index 515f766..90d83f1 100644
--- a/Open-ILS/examples/fm_IDL.xml
+++ b/Open-ILS/examples/fm_IDL.xml
@@ -9494,7 +9494,8 @@ SELECT  usr,
 	<class id="erccpo" controller="open-ils.reporter-store" oils_obj:fieldmapper="extend_reporter::copy_count_per_org" oils_persist:tablename="extend_reporter.copy_count_per_org" reporter:label="Library Holdings Count with Deleted">
 		<fields oils_persist:primary="bibid">
 			<field reporter:label="Bib Record" name="bibid" reporter:datatype="id" />
-			<field reporter:label="Circulation Library" name="circ_lib" reporter:datatype="id" />
+			<field reporter:label="Circulation Library" name="circ_lib" reporter:datatype="link" />
+			<field reporter:label="Owning Library" name="owning_lib" reporter:datatype="link" />
 			<field reporter:label="Last Edit Date" name="last_edit_time" reporter:datatype="timestamp" />
 			<field reporter:label="Has Only Deleted Copies 0/1" name="has_only_deleted_copies" reporter:datatype="int" />
 			<field reporter:label="Total deleted copies" name="deleted_count" reporter:datatype="int" />
@@ -9504,6 +9505,7 @@ SELECT  usr,
 		<links>
 			<link field="bibid" reltype="has_a" key="id" map="" class="bre"/>
 			<link field="circ_lib" reltype="has_a" key="id" map="" class="aou"/>
+			<link field="owning_lib" reltype="has_a" key="id" map="" class="aou"/>
 		</links>
 		<permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
 			<actions>
diff --git a/Open-ILS/src/sql/Pg/extend-reporter.sql b/Open-ILS/src/sql/Pg/extend-reporter.sql
index ca94530..a524cbb 100644
--- a/Open-ILS/src/sql/Pg/extend-reporter.sql
+++ b/Open-ILS/src/sql/Pg/extend-reporter.sql
@@ -58,6 +58,7 @@ CREATE OR REPLACE VIEW extend_reporter.global_bibs_by_holding_update AS
 CREATE OR REPLACE VIEW extend_reporter.copy_count_per_org AS
  SELECT acn.record AS bibid,
     ac.circ_lib,
+	acn.owning_lib,
     max(ac.edit_date) AS last_edit_time,
     min(ac.deleted::integer) AS has_only_deleted_copies,
     count(
@@ -74,6 +75,6 @@ CREATE OR REPLACE VIEW extend_reporter.copy_count_per_org AS
    FROM asset.call_number acn,
     asset.copy ac
   WHERE ac.call_number = acn.id
-  GROUP BY acn.record, ac.circ_lib;
+  GROUP BY acn.record, acn.owning_lib, ac.circ_lib;
 
 COMMIT;

commit 0325d0a5fcee2c6747064bdedee5d4c3462ea3f0
Author: blake <blake at mobiusconsortium.org>
Date:   Tue May 17 16:27:00 2016 -0500

    LP1582354 report able to show bibs where the last copy was deleted cancels
    
    Created a view for ease of reporting. This source table allows you to construct
    a clever aggregate report template which will report bibliographic ID's where a
    library or a group of libraries no longer have a copy attached but had* a copy
    attached. This is especially useful when a holdings sync is required with an
    external vendor.
    
    Signed-off-by: blake <blake at mobiusconsortium.org>
    Signed-off-by: Chris Sharp <csharp at georgialibraries.org>
    Signed-off-by: Jason Etheridge <jason at EquinoxInitiative.org>

diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml
index e0d7584..515f766 100644
--- a/Open-ILS/examples/fm_IDL.xml
+++ b/Open-ILS/examples/fm_IDL.xml
@@ -9491,6 +9491,26 @@ SELECT  usr,
 			<link field="id" reltype="has_a" key="id" map="" class="acp"/>
 		</links>
 	</class>
+	<class id="erccpo" controller="open-ils.reporter-store" oils_obj:fieldmapper="extend_reporter::copy_count_per_org" oils_persist:tablename="extend_reporter.copy_count_per_org" reporter:label="Library Holdings Count with Deleted">
+		<fields oils_persist:primary="bibid">
+			<field reporter:label="Bib Record" name="bibid" reporter:datatype="id" />
+			<field reporter:label="Circulation Library" name="circ_lib" reporter:datatype="id" />
+			<field reporter:label="Last Edit Date" name="last_edit_time" reporter:datatype="timestamp" />
+			<field reporter:label="Has Only Deleted Copies 0/1" name="has_only_deleted_copies" reporter:datatype="int" />
+			<field reporter:label="Total deleted copies" name="deleted_count" reporter:datatype="int" />
+			<field reporter:label="Total visible copies" name="visible_count" reporter:datatype="int" />
+			<field reporter:label="Total copies attached" name="total_count" reporter:datatype="int" />
+		</fields>
+		<links>
+			<link field="bibid" reltype="has_a" key="id" map="" class="bre"/>
+			<link field="circ_lib" reltype="has_a" key="id" map="" class="aou"/>
+		</links>
+		<permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+			<actions>
+				<retrieve />
+			</actions>
+		</permacrud>
+	</class>
 	<class id="acqdf" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="acq::distribution_formula" oils_persist:tablename="acq.distribution_formula" reporter:label="Distribution Formula">
 		<fields oils_persist:primary="id" oils_persist:sequence="acq.distribution_formula_id_seq">
 			<field reporter:label="Formula ID" name="id" reporter:datatype="id" reporter:selector="name" />
diff --git a/Open-ILS/src/sql/Pg/extend-reporter.sql b/Open-ILS/src/sql/Pg/extend-reporter.sql
index 852b537..ca94530 100644
--- a/Open-ILS/src/sql/Pg/extend-reporter.sql
+++ b/Open-ILS/src/sql/Pg/extend-reporter.sql
@@ -54,6 +54,26 @@ CREATE OR REPLACE VIEW extend_reporter.global_bibs_by_holding_update AS
                   AND b.id > 0
             GROUP BY b.id)x
     ORDER BY id, holding_update;
-        
-COMMIT;
 
+CREATE OR REPLACE VIEW extend_reporter.copy_count_per_org AS
+ SELECT acn.record AS bibid,
+    ac.circ_lib,
+    max(ac.edit_date) AS last_edit_time,
+    min(ac.deleted::integer) AS has_only_deleted_copies,
+    count(
+        CASE
+            WHEN ac.deleted THEN ac.id
+            ELSE NULL::bigint
+        END) AS deleted_count,
+    count(
+        CASE
+            WHEN NOT ac.deleted THEN ac.id
+            ELSE NULL::bigint
+        END) AS visible_count,
+    count(*) AS total_count
+   FROM asset.call_number acn,
+    asset.copy ac
+  WHERE ac.call_number = acn.id
+  GROUP BY acn.record, ac.circ_lib;
+
+COMMIT;
diff --git a/Open-ILS/src/sql/Pg/t/lp1582354_report_able_to_show_bibs_where_the_last_copy_was_deleted_cancels.pg b/Open-ILS/src/sql/Pg/t/lp1582354_report_able_to_show_bibs_where_the_last_copy_was_deleted_cancels.pg
new file mode 100644
index 0000000..b3f0a39
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/t/lp1582354_report_able_to_show_bibs_where_the_last_copy_was_deleted_cancels.pg
@@ -0,0 +1,27 @@
+\set ECHO
+\set QUIET 1
+-- Turn off echo and keep things quiet.
+
+-- Format the output for nice TAP.
+\pset format unaligned
+\pset tuples_only true
+\pset pager
+
+-- Revert all changes on failure.
+\set ON_ERROR_ROLLBACK 1
+\set ON_ERROR_STOP true
+\set QUIET 1
+
+-- Load the TAP functions.
+BEGIN;
+
+-- Plan the tests.
+SELECT plan(1);
+
+-- Run the tests.
+-- Check for Lost and Paid copy status.
+SELECT has_view( 'extend_reporter', 'copy_count_per_org', 'VIEW extend_reporter.copy_count_per_org EXISTS' );
+
+-- Finish the tests and clean up.
+SELECT * FROM finish();
+ROLLBACK;
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.LP1582354_report_able_to_show_bibs_where_the_last_copy_was_deleted_cancels.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.LP1582354_report_able_to_show_bibs_where_the_last_copy_was_deleted_cancels.sql
new file mode 100644
index 0000000..9b34294
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.LP1582354_report_able_to_show_bibs_where_the_last_copy_was_deleted_cancels.sql
@@ -0,0 +1,30 @@
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+DROP VIEW IF EXISTS extend_reporter.copy_count_per_org;
+
+
+CREATE OR REPLACE VIEW extend_reporter.copy_count_per_org AS
+ SELECT acn.record AS bibid,
+    ac.circ_lib,
+    max(ac.edit_date) AS last_edit_time,
+    min(ac.deleted::integer) AS has_only_deleted_copies,
+    count(
+        CASE
+            WHEN ac.deleted THEN ac.id
+            ELSE NULL::bigint
+        END) AS deleted_count,
+    count(
+        CASE
+            WHEN NOT ac.deleted THEN ac.id
+            ELSE NULL::bigint
+        END) AS visible_count,
+    count(*) AS total_count
+   FROM asset.call_number acn,
+    asset.copy ac
+  WHERE ac.call_number = acn.id
+  GROUP BY acn.record, ac.circ_lib;
+
+
+COMMIT;
diff --git a/docs/lp1582354_report_able_to_show_bibs_where_the_last_copy_was_deleted_cancels.adoc b/docs/lp1582354_report_able_to_show_bibs_where_the_last_copy_was_deleted_cancels.adoc
new file mode 100644
index 0000000..fdab109
--- /dev/null
+++ b/docs/lp1582354_report_able_to_show_bibs_where_the_last_copy_was_deleted_cancels.adoc
@@ -0,0 +1,25 @@
+New report source table allowing report of "last" deleted copy
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+This source table allows you to construct a clever aggregate report template
+which will report bibliographic ID's where a library or a group of libraries 
+no longer have a copy attached but had* a copy attached. This is especially
+useful when a holdings sync is required with an external vendor.
+
+
+Instructions for creating the report template:
+  * Create a new report template using the "Library Holdings Count with Deleted" as the source
+  * Add "Has Only Deleted Copies 0/1" (Min) to the Aggregate Filters -> Change Value to "1"
+  * Add "Last Edit Date" (Max) to Aggregate Filters -> Change Operator to "Between"
+  * Add Circulation Library -> "Organizational Unit ID" Raw Data to Base Filters -> Change Operator to "In list"
+  * Add "Bib ID" to Displayed Fields
+  * Add "Last Edit Date" to Displayed Fields and Change Transform to Max
+  * Add "Has Only Deleted Copies 0/1" to Displayed Fields and Change Transform to Min
+  * Add "Total copies attached" to Displayed Fields and Change Transform to Sum
+
+
+This template will only output bibliographic ID's where all of the copies for the specified branch(es)
+are deleted. Furthermore, it will only output bibs whose copies were edited (deleted) during the 
+specified date range. Unfortunatly the user will have to manually type the date range without the date
+picker. This view will also allow you to answer questions like "Show me bibs where I have one visible
+copy and more than two deleted copies."

-----------------------------------------------------------------------

Summary of changes:
 Open-ILS/examples/fm_IDL.xml                       |   17 +++++++++++
 Open-ILS/src/sql/Pg/002.schema.config.sql          |    2 +-
 Open-ILS/src/sql/Pg/extend-reporter.sql            |   25 ++++++++++++++-
 ...ibs_where_the_last_copy_was_deleted_cancels.pg} |    7 +---
 ...ibs_where_the_last_copy_was_deleted_cancels.sql |   31 ++++++++++++++++++++
 ...bs_where_the_last_copy_was_deleted_cancels.adoc |   25 ++++++++++++++++
 6 files changed, 99 insertions(+), 8 deletions(-)
 copy Open-ILS/src/sql/Pg/t/{lp1533329-restrict-opt-in-setting.pg => lp1582354_report_able_to_show_bibs_where_the_last_copy_was_deleted_cancels.pg} (72%)
 create mode 100644 Open-ILS/src/sql/Pg/upgrade/1060.LP1582354_report_able_to_show_bibs_where_the_last_copy_was_deleted_cancels.sql
 create mode 100644 docs/lp1582354_report_able_to_show_bibs_where_the_last_copy_was_deleted_cancels.adoc


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list