Bug 14575: OPACURLOpenInNewWindow should apply to item-level urls too

This patch applies the OPACURLOpenInNewWindow system preference
to item-level urls (in addition to the pre-existing bib-level url
handling).

_TEST PLAN_

Before applying:

1) Set OPACURLOpenInNewWindow to "don't" and click on an item-level url
2) Note that the current tab changes to that url
3) Set OPACURLOpenInNewWindow to "do" and click on an item-level url
4) Note that the current tab changes to that url

Apply the patch.

After applying:

5) Click on an item-level url
6) Note that the url opens in a new tab (as OPACURLOpenInNewWindow
should be set to "do")
7) Set OPACURLOpenInNewWindow to "don't" and click on an item-level
url
8) Note that the url opens in the current tab

9) Repeat the above steps 5-8 alternating
"TrackClicks" between "Don't track" and either "Track" or
"Track anonymously".

Followed test plan. Works as expected.
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit e815d1e010)
This commit is contained in:
David Cook 2015-07-21 13:09:39 +10:00 committed by Frédéric Demians
parent d4870cbf99
commit 219df070e8
1 changed files with 8 additions and 0 deletions

View File

@ -1276,9 +1276,17 @@
<td class="url">
[% IF ITEM_RESULT.uri %]
[% IF trackclicks == 'track' || trackclicks == 'anonymous' %]
[% IF Koha.Preference("OPACURLOpenInNewWindow") %]
<a target="_blank" href="/cgi-bin/koha/tracklinks.pl?uri=[% ITEM_RESULT.uri | url %]&amp;biblionumber=[% biblionumber |url %]&amp;itemnumber=[% ITEM_RESULT.itemnumber | url %]" property="url"> Link to resource </a>
[% ELSE %]
<a href="/cgi-bin/koha/tracklinks.pl?uri=[% ITEM_RESULT.uri | url %]&amp;biblionumber=[% biblionumber |url %]&amp;itemnumber=[% ITEM_RESULT.itemnumber | url %]" property="url"> Link to resource </a>
[% END %]
[% ELSE %]
[% IF Koha.Preference("OPACURLOpenInNewWindow") %]
<a target="_blank" href="[% ITEM_RESULT.uri %]" property="url">[% ITEM_RESULT.uri %]</a>
[% ELSE %]
<a href="[% ITEM_RESULT.uri %]" property="url">[% ITEM_RESULT.uri %]</a>
[% END %]
[% END %]
[% END %]
</td>