TPAC: Link library in results page to library page
authorDan Scott <dscott@laurentian.ca>
Wed, 22 Jan 2014 15:12:37 +0000 (10:12 -0500)
committerDan Scott <dscott@laurentian.ca>
Sat, 25 Jan 2014 14:20:02 +0000 (09:20 -0500)
Dan Wells noticed that the links on results pages went to a different location
(potentially, depending on the "prefer external library uri" OUS) than the
links on record pages. Make things consistent.

Signed-off-by: Dan Scott <dscott@laurentian.ca>
Signed-off-by: Ben Shum <bshum@biblio.org>
Open-ILS/src/templates/opac/parts/result/table.tt2

index b481b5f..ff2766b 100644 (file)
@@ -248,9 +248,15 @@ END;
                                                                         <tr>
                                                                             <td>
 [%-
+    org_name = ctx.get_aou(copy.circ_lib).name;
+    org_sname = ctx.get_aou(copy.circ_lib).shortname;
     lib_url = ctx.get_org_setting(copy.circ_lib, 'lib.info_url');
-    IF lib_url; '<a href="'; lib_url | url; '">'; END;
-    copy.library | html;
+    prefer_external_url = ctx.get_org_setting(copy.circ_lib, 'lib.prefer_external_url');
+    UNLESS lib_url && prefer_external_url;
+        lib_url = mkurl(ctx.opac_root _ '/library/' _ ctx.get_aou(copy.circ_lib).shortname, {}, 1);
+    END; 
+    IF lib_url; '<a property="seller" typeof="Library" href="'; lib_url | url; '">'; END;
+    '<span property="name">'; org_name | html; '</span>';
     IF lib_url; '</a>'; END;
 -%]
                                                                             </td>