From: Remington Steed <rjs7@calvin.edu>
Date: Wed, 24 Apr 2019 18:01:39 +0000 (-0400)
Subject: LP#1721036: Add url to item tags (DB, IDL, and OPAC link)
X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=d87ad5f21e23f5e28fe7b970baad090d2b59eb63;p=contrib%2FConifer.git

LP#1721036: Add url to item tags (DB, IDL, and OPAC link)

This commit adds a new field to the asset.copy_tag database table, adds
it to the IDL, and includes it as a link in the OPAC when present.

Signed-off-by: Remington Steed <rjs7@calvin.edu>
Signed-off-by: Kyle Huckins <khuckins@catalyte.io>
Signed-off-by: Chris Sharp <csharp@georgialibraries.org>
---

diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml
index 0a14cb5f14..544488e3f1 100644
--- a/Open-ILS/examples/fm_IDL.xml
+++ b/Open-ILS/examples/fm_IDL.xml
@@ -12706,6 +12706,7 @@ SELECT  usr,
 			<field reporter:label="Staff Note" name="staff_note" reporter:datatype="text"/>
 			<field reporter:label="Is OPAC Visible?" name="pub" reporter:datatype="bool"/>
 			<field reporter:label="Owner" name="owner" reporter:datatype="org_unit" oils_obj:required="true"/>
+			<field reporter:label="URL" name="url" reporter:datatype="text"/>
 		</fields>
 		<links>
 			<link field="tag_type" reltype="has_a" key="code" map="" class="cctt"/>
diff --git a/Open-ILS/src/sql/Pg/040.schema.asset.sql b/Open-ILS/src/sql/Pg/040.schema.asset.sql
index 9beed1d751..198632a617 100644
--- a/Open-ILS/src/sql/Pg/040.schema.asset.sql
+++ b/Open-ILS/src/sql/Pg/040.schema.asset.sql
@@ -967,7 +967,8 @@ CREATE TABLE asset.copy_tag (
     index_vector    tsvector NOT NULL,
     staff_note      TEXT,
     pub             BOOLEAN DEFAULT TRUE,
-    owner           INTEGER NOT NULL REFERENCES actor.org_unit (id)
+    owner           INTEGER NOT NULL REFERENCES actor.org_unit (id),
+    url             TEXT
 );
 
 CREATE INDEX asset_copy_tag_label_idx
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.asset.copy_tag.url.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.asset.copy_tag.url.sql
new file mode 100644
index 0000000000..b7b26ceb09
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.asset.copy_tag.url.sql
@@ -0,0 +1,8 @@
+BEGIN;
+
+--INSERT INTO config.upgrade_log (version, applied_to) VALUES ('XXXX', :eg_version);
+
+ALTER TABLE asset.copy_tag
+          ADD COLUMN url TEXT;
+
+COMMIT;
diff --git a/Open-ILS/src/templates/opac/parts/record/copy_table.tt2 b/Open-ILS/src/templates/opac/parts/record/copy_table.tt2
index 1e0456cf83..1c7a2de0dd 100644
--- a/Open-ILS/src/templates/opac/parts/record/copy_table.tt2
+++ b/Open-ILS/src/templates/opac/parts/record/copy_table.tt2
@@ -236,7 +236,15 @@ END; # FOREACH bib
                 <tr class="copy_tag_row">
                     <td>&nbsp;</td>
                     <td class="copy_tag" colspan="4">
-                        <span class="copy_tag_value">[% tag.value | html %]</span>
+                        <span class="copy_tag_value">
+                            [% IF tag.url %]
+                            <a href="[% tag.url | html %]">
+                            [% END %]
+                                [% tag.value | html %]
+                            [% IF tag.url %]
+                            </a>
+                            [% END %]
+                        </span>
                     </td>
                 <tr>
             [% END %]