LP1753536 - (Respin) Add "Owning Library" column to Items Out display in OPAC. user/rsteed/LP1753536_lib_column_respin
authorDan Pearl <dpearl@cwmars.org>
Thu, 5 Apr 2018 18:13:28 +0000 (14:13 -0400)
committerRemington Steed <rjs7@calvin.edu>
Thu, 5 Apr 2018 20:16:57 +0000 (16:16 -0400)
Signed-off-by: Dan Pearl <dpearl@cwmars.org>
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm
Open-ILS/src/templates/opac/myopac/circs.tt2
Open-ILS/src/templates/opac/parts/library_name_link_from_ou.tt2 [new file with mode: 0644]
docs/RELEASE_NOTES_NEXT/OPAC/LP1753536_items_out_lib.adoc

index 4c2773d..3f2f045 100644 (file)
@@ -1525,8 +1525,8 @@ sub fetch_user_circs {
         flesh => 3,
         flesh_fields => {
             circ => ['target_copy'],
-            acp => ['call_number','location','circ_lib'],
-            acn => ['record']
+            acp => ['call_number'],
+            acn => ['record','owning_lib']
         }
     };
 
index e7088f8..7510bf6 100644 (file)
@@ -77,7 +77,7 @@
                 <th>[% sort_head("due", l("Due Date")) %]</th>
                 <th>[% sort_head("barcode", l("Barcode")) %]</th>
                 <th>[% sort_head("callnum", l("Call Number")) %]</th>
-                <th>[% sort_head("lib", l("Lending Library")) %]</th>
+                <th>[% sort_head("lib", l("Owning Library")) %]</th>
             </tr>
             </thead>
             <tbody>
                        CASE "callnum";
                           circ.SORTING = circ.circ.target_copy.call_number.label;
                        CASE "lib";
-                          circ.SORTING = circ.circ.target_copy.circ_lib.name;
+                          circ.SORTING = circ.circ.target_copy.call_number.owning_lib.name;
                        
                        CASE;
                           sort_field = "";
                             [% circ.circ.target_copy.call_number.label | html %]
                         </td>
                         <td name="lib">
-                           [%- copy_info = circ.circ.target_copy;
-                            INCLUDE "opac/parts/library_name_link.tt2";
+                           [%- fleshed_ou = circ.circ.target_copy.call_number.owning_lib;
+                            INCLUDE "opac/parts/library_name_link_from_ou.tt2";
                            %]
                         </td>
                     </tr>
diff --git a/Open-ILS/src/templates/opac/parts/library_name_link_from_ou.tt2 b/Open-ILS/src/templates/opac/parts/library_name_link_from_ou.tt2
new file mode 100644 (file)
index 0000000..54e085b
--- /dev/null
@@ -0,0 +1,22 @@
+[%-
+    opac_root = ctx.opac_root;
+    IF ctx.kpac_root;
+        opac_root = ctx.kpac_root;
+    END;
+
+    # Requires a "fleshed_ou" (aou) object defined.
+    # Allow fleshed circ_libs
+    org_id = fleshed_ou.id;
+    org_name = fleshed_ou.name; 
+    org_sname = fleshed_ou.shortname;
+
+    lib_url = ctx.get_org_setting(org_id, 'lib.info_url');
+    prefer_external_url = ctx.get_org_setting(org_id, 'lib.prefer_external_url');
+    UNLESS lib_url && prefer_external_url;
+        lib_url = mkurl(opac_root _ '/library/' _ org_sname, {}, 1);
+    END; 
+    IF lib_url; '<a property="offeredBy" typeof="Library" href="'; lib_url | html; '">'; END;
+    '<span property="name">'; org_name | html; '</span>';
+    IF lib_url; '</a>'; END;
+-%]
+
index c17c7cd..d634734 100644 (file)
@@ -1,6 +1,6 @@
 New Column in Items Out Display
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-A new column, Lending Library, has been added to the Items Out display which
+A new column, Owning Library, has been added to the Items Out display which
 shows the owning library of the item (not necessarily the library at which
 the item was picked up at).  When a patron has run out of renewals, the owning
 library is the one with whom the patron will negotiate additional renewals, and