[Koha-patches] [PATCH 1/3] Bug 10691: 5xx not properly linked by authid in authority search result list [Staff]

Tomas Cohen Arazi tomascohen at gmail.com
Fri Dec 13 18:55:14 CET 2013


This patch changes the URL and data used to show the 'see also' links
on the Staff's authority search results page.

Bonus points: makes some strings translatable.

To test:
- On your dev setup (master) create some authority records (i created personal name authorities).
- Pick one of them and link 400$a to another one, do the same with 500$a
- Add some other 400$a and 500$a entries with plain text (i.e. no linking)
- Make sure zebra is running and changes got indexed.
- In the staff interface search for the authority that is linked to the others.
- Check the 'see also:' link points to an authority search
- Apply the patch
- Reload/re-do the search
- Check the 'see also:' link points to the authority id for linked authorities,
  and to an authority search result in the case of plain text entries.
- Check that the authority search from the cataloguing interface still works as usual.

Regards
To+

Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel at gmail.com>

Work as described. No errors

Signed-off-by: Jonathan Druart <jonathan.druart at biblibre.com>
---
 .../en/includes/authorities-search-results.inc     | 96 ++++++++++++++--------
 .../en/modules/authorities/searchresultlist.tt     |  2 +-
 2 files changed, 63 insertions(+), 35 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-search-results.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-search-results.inc
index 2ee4571..bb8e3f6 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-search-results.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-search-results.inc
@@ -1,4 +1,7 @@
 [% BLOCK showreference %]
+    [% SET authidurl = '/cgi-bin/koha/authorities/detail.pl?authid=' %]
+    [% SET searchurl = '/cgi-bin/koha/authorities/authorities-home.pl?op=do_search&type=intranet&marclist=any&operator=contains&orderby=HeadingAsc&value=' %]
+
     [% IF marcflavour == 'UNIMARC' %]
         [% SWITCH type %]
         [% CASE 'broader' %]
@@ -11,30 +14,48 @@
             <span class="RT">RT: [% heading | html %]</span>
         [% END %]
     [% ELSE %]
-        [% IF ( label ) %]<span class="label">[% label | html %]</span>[% END %]
+        <span class="label">
+        [% IF ( type=='seefrom' ) %]
+            used for/see from:
+        [% ELSIF  ( type=='seealso' ) %]
+            see also:
+        [% END %]
+        </span>
         <span class="heading">
-        [% IF ( linkpath && search ) %]<a href="[% link | url %][% search | url %]">[% heading | html %]</a>
-        [% ELSE %][% heading | html %][% END %]
+        [% IF ( type=='seealso' ) %]
+            [% IF ( authid ) %]
+            <a href="[% authidurl | url %][% authid | url %]">[% heading | html %]</a>
+            [% ELSE %]
+            <a href="[% searchurl | url %][% heading | html %]">[% heading | html %]</a>
+            [% END %]
+        [% ELSE %]
+            [% heading | html %]
+        [% END %]
         </span>
-        [% UNLESS ( type=='seefrom' || type=='seealso' ) %]<span class="type">[% SWITCH type %]
-        [% CASE 'earlier' %](Earlier heading)
-        [% CASE 'later' %](Later heading)
-        [% CASE 'acronym' %](Acronym)
-        [% CASE 'musical' %](Musical composition)
-        [% CASE 'broader' %](Broader heading)
-        [% CASE 'narrower' %](Narrower heading)
-        [% CASE 'parent' %](Immediate parent body)
-        [% CASE %][% IF type %]([% type | html %])[% END %]
-        [% END %]</span>[% END %]
+        [% UNLESS ( type=='seefrom' || type=='seealso' ) %]
+        <span class="type">
+            [% SWITCH type %]
+            [% CASE 'earlier' %](Earlier heading)
+            [% CASE 'later' %](Later heading)
+            [% CASE 'acronym' %](Acronym)
+            [% CASE 'musical' %](Musical composition)
+            [% CASE 'broader' %](Broader heading)
+            [% CASE 'narrower' %](Narrower heading)
+            [% CASE 'parent' %](Immediate parent body)
+            [% CASE %][% IF type %]([% type | html %])
+            [% END %]
+        [% END %]
+        </span>
+        [% END %]
     [% END %]
 [% END %]
 [% BLOCK authresult %]
     [% IF ( summary.summary ) %][% summary.summary | html %]:[% END %]
     [% UNLESS ( summary.summaryonly ) %]
         <div class="authorizedheading">
-        [% FOREACH authorize IN summary.authorized %]
-          <span class="authorizedheading">[% authorize.heading | html %]</span>
-        [% END %]
+          [% FOREACH authorize IN summary.authorized %]
+            <span class="authorizedheading">[% authorize.heading | html %]</span>
+          [% END %]
         </div>
         [% IF ( marcflavour == 'UNIMARC' ) %]
           [% IF summary.notes %]
@@ -52,36 +73,43 @@
             [% END %]
             </div>
           [% END %]
-          [% IF summary.seealso %]
-            <div class="authres_seealso">
-            [% FOREACH see IN summary.seealso %]
-              [% PROCESS showreference heading=see.heading label="" type=see.type search='' %]
-              [% IF ! loop.last %] ; [% END %]
+            [% IF summary.seealso %]
+              <div class="authres_seealso">
+              [% FOREACH see IN summary.seealso %]
+                 [% PROCESS showreference heading=see.heading label="" type=see.type search='' %]
+                 [% IF ! loop.last %] ; [% END %]
+              [% END %]
+              </div>
             [% END %]
-            </div>
-          [% END %]
-          [% IF summary.otherscript %]
-            <div class="authres_otherscript">
-            [% FOREACH other IN summary.otherscript %]
-              [% PROCESS language lang=other.lang | trim %]:
-              [% other.term %]
-              [% IF ! loop.last %] ; [% END %]
+            [% IF summary.otherscript %]
+              <div class="authres_otherscript">
+              [% FOREACH other IN summary.otherscript %]
+                [% PROCESS language lang=other.lang | trim %]:
+                [% other.term %]
+                [% IF ! loop.last %] ; [% END %]
+              [% END %]
+              </div>
             [% END %]
-            </div>
-          [% END %]
-
         [% ELSE %]
             [% IF ( summary.seefrom ) %]
                 [% FOREACH seefro IN summary.seefrom %]
                     <div class="seefrom authref">
-                    [% PROCESS showreference heading=seefro.heading label="used for/see from:" type=seefro.type search='' %]
+                    [% PROCESS showreference
+                        heading=seefro.heading
+                        type=seefro.type
+                        authid=seefro.authid
+                    %]
                     </div>
                 [% END %]
             [% END %]
             [% IF ( summary.seealso ) %]
                 [% FOREACH seeals IN summary.seealso %]
                     <div class="seealso authref">
-                    [% PROCESS showreference heading=seeals.heading label="see also:" type=seeals.type linkpath=link search=seeals.search %]
+                    [% PROCESS showreference
+                        heading=seeals.heading
+                        type=seeals.type
+                        authid=seeals.authid
+                    %]
                     </div>
                 [% END %]
             [% END %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt
index f73b819..49ba49f 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt
@@ -80,7 +80,7 @@ function searchauthority() {
     [% ELSE %]
     <tr data-authid="[% resul.authid %]">
     [% END %]
-      <td>[% PROCESS authresult summary=resul.summary link="/cgi-bin/koha/authorities/authorities-home.pl?op=do_search&type=intranet&marclist=any&operator=contains&orderby=HeadingAsc&value=" %]</td>
+      <td>[% PROCESS authresult summary=resul.summary %]</td>
       <td><a href="detail.pl?authid=[% resul.authid %]">Details</a></td>
   [% UNLESS ( resul.isEDITORS ) %]
       <td>
-- 
1.8.3.2



More information about the Koha-patches mailing list