@@ -, +, @@ filter to BranchName - Enable IndependentBranches and log in to Koha as a non-superlibrarian. Try to check out an item which belongs to another library. The library name should appear correctly in the warning message. - In Acquisitions, view the list of basket groups for any vendor. The "billing place" and "delivery place" columns should show library names correctly. - View the detail page for a subscription (serials/subscription-detail.pl?subscriptionid=X). The library name should appear correctly. - In suggestions management, view the details for a suggestion (/suggestion/suggestion.pl?suggestionid=X&op=show). Library names should appear correctly in the "suggestions management" table and in the "acquisition information" block. - Test the Koha_template_plugin_BranchName.t test: In a test database prove -v t/db_dependent/Koha_template_plugin_BranchName.t --- .../prog/en/modules/acqui/basketgroup.tt | 10 +++--- .../prog/en/modules/circ/circulation.tt | 4 +-- .../prog/en/modules/serials/subscription-detail.tt | 4 +-- .../prog/en/modules/suggestion/suggestion.tt | 16 ++++----- t/db_dependent/Koha_template_plugin_BranchName.t | 37 ++++++++++++++++++++ .../Koha_template_plugin_KohaBranchName.t | 37 -------------------- 6 files changed, 54 insertions(+), 54 deletions(-) create mode 100644 t/db_dependent/Koha_template_plugin_BranchName.t delete mode 100644 t/db_dependent/Koha_template_plugin_KohaBranchName.t --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt @@ -1,4 +1,4 @@ -[% USE KohaBranchName %] +[% USE BranchName %] [% INCLUDE 'doc-head-open.inc' %] Koha › Basket grouping for [% booksellername |html %] @@ -275,8 +275,8 @@ function submitForm(form) { [% END %] [% basketgroup.id %] - [% basketgroup.billingplace | $KohaBranchName %] - [% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% basketgroup.deliveryplace | $KohaBranchName %][% END %] + [% basketgroup.billingplace | $BranchName %] + [% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% basketgroup.deliveryplace | $BranchName %][% END %] [% basketgroup.basketsqty %] @@ -313,8 +313,8 @@ function submitForm(form) { [% END %] [% basketgroup.id %] - [% basketgroup.billingplace | $KohaBranchName %] - [% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% basketgroup.deliveryplace | $KohaBranchName %][% END %] + [% basketgroup.billingplace | $BranchName %] + [% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% basketgroup.deliveryplace | $BranchName %][% END %] [% basketgroup.basketsqty %]
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -1,4 +1,4 @@ -[% USE KohaBranchName %] +[% USE BranchName %] [% USE KohaDates %] [% IF ( export_remove_fields OR export_with_csv_profile ) %] [% SET exports_enabled = 1 %] @@ -547,7 +547,7 @@ function validate1(date) { [% END %] [% IF ( ITEMNOTSAMEBRANCH ) %] -
  • This item belongs to [% itemhomebranch | $KohaBranchName %] and cannot be checked out from this location.
  • +
  • This item belongs to [% itemhomebranch | $BranchName %] and cannot be checked out from this location.
  • [% END %] [% IF ( USERBLOCKEDREMAINING ) %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt @@ -1,4 +1,4 @@ -[% USE KohaBranchName %] +[% USE BranchName %] [% INCLUDE 'doc-head-open.inc' %] Koha › Serials › Details for subscription #[% subscriptionid %] [% INCLUDE 'doc-head-close.inc' %] @@ -102,7 +102,7 @@ $(document).ready(function() {
  • Librarian identity: [% librarian %]
  • Vendor: [% aqbooksellername %]
  • Biblio: [% bibliotitle %] ([% bibnum %])
  • -[% IF ( branchcode ) %]
  • Library: [% branchcode | $KohaBranchName %]
  • [% END %] +[% IF ( branchcode ) %]
  • Library: [% branchcode | $BranchName %]
  • [% END %] [% IF ( serialsadditems ) %]
  • Items: Serial receipt creates an item record.
  • [% ELSE %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt @@ -1,5 +1,5 @@ [% USE KohaAuthorisedValues %] -[% USE KohaBranchName %] +[% USE BranchName %] [% INCLUDE 'doc-head-open.inc' %] Koha › Acquisitions › [% IF ( op_save ) %] @@ -226,18 +226,18 @@ $(document).ready(function() { calcNewsuggTotal(); }); <tr> <th><span class="label">Suggestion creation</span> </th> <td>[% suggesteddate %]</td> - <td>[% IF ( suggestedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestedby_borrowernumber %]">[% suggestedby_surname %], [% suggestedby_firstname %]</a> [% suggestedby_branchcode | $KohaBranchName %] ([% suggestedby_description %])[% END %] + <td>[% IF ( suggestedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestedby_borrowernumber %]">[% suggestedby_surname %], [% suggestedby_firstname %]</a> [% suggestedby_branchcode | $BranchName %] ([% suggestedby_description %])[% END %] </td> </tr> <tr> <th><span class="label">Suggestion management</span> </th> <td>[% manageddate %]</td> - <td>[% IF ( managedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% managedby_borrowernumber %]">[% managedby_surname %], [% managedby_firstname %]</a> [% managedby_branchcode | $KohaBranchName %] ([% managedby_description %])[% END %]</td> + <td>[% IF ( managedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% managedby_borrowernumber %]">[% managedby_surname %], [% managedby_firstname %]</a> [% managedby_branchcode | $BranchName %] ([% managedby_description %])[% END %]</td> </tr> <tr> <th><span class="label">Suggestion accepted</span> </th> <td>[% accepteddate %]</td> - <td>[% IF ( acceptedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% acceptedby_borrowernumber %]">[% acceptedby_surname %], [% acceptedby_firstname %]</a> [% acceptedby_branchcode | $KohaBranchName %] ([% acceptedby_description %])[% END %]</td> + <td>[% IF ( acceptedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% acceptedby_borrowernumber %]">[% acceptedby_surname %], [% acceptedby_firstname %]</a> [% acceptedby_branchcode | $BranchName %] ([% acceptedby_description %])[% END %]</td> </tr> </tbody> </table></li></ol> @@ -354,18 +354,18 @@ $(document).ready(function() { calcNewsuggTotal(); }); <tr> <th><label for="suggesteddate">Suggestion creation</label> </th> <td><input type="text" id="suggesteddate" name="suggesteddate" size="10" maxlength="10" value="[% suggesteddate %]"/></td> - <td><input type="hidden" id="suggestedby" name="suggestedby" value="[% suggestedby %]"/>[% IF ( suggestedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestedby_borrowernumber %]">[% suggestedby_surname %], [% suggestedby_firstname %]</a> [% suggestedby_branchcode | $KohaBranchName %] ([% suggestedby_description %])[% END %] + <td><input type="hidden" id="suggestedby" name="suggestedby" value="[% suggestedby %]"/>[% IF ( suggestedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestedby_borrowernumber %]">[% suggestedby_surname %], [% suggestedby_firstname %]</a> [% suggestedby_branchcode | $BranchName %] ([% suggestedby_description %])[% END %] </td> </tr> <tr> <th><label for="managedon">Suggestion management</label> </th> <td><input type="text" id="managedon" name="manageddate" size="10" maxlength="10" value="[% manageddate %]" /></td> - <td><input type="hidden" id="managedby" name="managedby" value="[% managedby %]"/>[% IF ( managedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% managedby_borrowernumber %]">[% managedby_surname %], [% managedby_firstname %]</a> [% managedby_branchcode | $KohaBranchName %] ([% managedby_description %])[% END %]</td> + <td><input type="hidden" id="managedby" name="managedby" value="[% managedby %]"/>[% IF ( managedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% managedby_borrowernumber %]">[% managedby_surname %], [% managedby_firstname %]</a> [% managedby_branchcode | $BranchName %] ([% managedby_description %])[% END %]</td> </tr> <tr> <th><label for="accepteddate">Suggestion accepted</label> </th> <td><input type="text" id="accepteddate" name="accepteddate" size="10" maxlength="10" value="[% accepteddate %]" /></td> - <td><input type="hidden" id="acceptedby" name="acceptedby" value="[% acceptedby %]"/>[% IF ( acceptedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% acceptedby_borrowernumber %]">[% acceptedby_surname %], [% acceptedby_firstname %]</a> [% acceptedby_branchcode | $KohaBranchName %] ([% acceptedby_description %])[% END %]</td> + <td><input type="hidden" id="acceptedby" name="acceptedby" value="[% acceptedby %]"/>[% IF ( acceptedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% acceptedby_borrowernumber %]">[% acceptedby_surname %], [% acceptedby_firstname %]</a> [% acceptedby_branchcode | $BranchName %] ([% acceptedby_description %])[% END %]</td> </tr> </tbody> </table></li></ol> @@ -482,7 +482,7 @@ $(document).ready(function() { calcNewsuggTotal(); }); [% IF ( suggestions_loo.manageddate ) %] - [% suggestions_loo.manageddate %][% END %] </td> <td> - [% suggestions_loo.branchcode | $KohaBranchName %] + [% suggestions_loo.branchcode | $BranchName %] </td> <td> [% suggestions_loo.budget_name %] --- a/t/db_dependent/Koha_template_plugin_BranchName.t +++ a/t/db_dependent/Koha_template_plugin_BranchName.t @@ -0,0 +1,37 @@ +#!/usr/bin/perl + +# Copyright 2013 Equinox Software, Inc. +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 3 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with Koha; if not, see <http://www.gnu.org/licenses>. + +use Modern::Perl; + +use Test::More tests => 5; + +BEGIN { + use_ok('Koha::Template::Plugin::BranchName'); +} + +my $filter = Koha::Template::Plugin::BranchName->new(); +ok($filter, "initialized BranchName plugin"); + +my $name = $filter->filter('CPL'); +is($name, 'Centerville', 'retrieved expected name for CPL'); + +$name = $filter->filter('__ANY__'); +is($name, '', 'received empty string as name of the "__ANY__" placeholder library code'); + +$name = $filter->filter(undef); +is($name, '', 'received empty string as name of NULL/undefined library code'); --- a/t/db_dependent/Koha_template_plugin_KohaBranchName.t +++ a/t/db_dependent/Koha_template_plugin_KohaBranchName.t @@ -1,37 +0,0 @@ -#!/usr/bin/perl - -# Copyright 2013 Equinox Software, Inc. -# -# This file is part of Koha. -# -# Koha is free software; you can redistribute it and/or modify it under the -# terms of the GNU General Public License as published by the Free Software -# Foundation; either version 3 of the License, or (at your option) any later -# version. -# -# Koha is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR -# A PARTICULAR PURPOSE. See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with Koha; if not, see <http://www.gnu.org/licenses>. - -use Modern::Perl; - -use Test::More tests => 5; - -BEGIN { - use_ok('Koha::Template::Plugin::KohaBranchName'); -} - -my $filter = Koha::Template::Plugin::KohaBranchName->new(); -ok($filter, "initialized KohaBranchName plugin"); - -my $name = $filter->filter('CPL'); -is($name, 'Centerville', 'retrieved expected name for CPL'); - -$name = $filter->filter('__ANY__'); -is($name, '', 'received empty string as name of the "__ANY__" placeholder library code'); - -$name = $filter->filter(undef); -is($name, '', 'received empty string as name of NULL/undefined library code'); --