Bugzilla – Attachment 20205 Details for
Bug 10626
Remove doubled up TT plugins
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10626 - Remove doubled up TT plugins - Merge KohaBranchName and Branches
Bug-10626---Remove-doubled-up-TT-plugins---Merge-K.patch (text/plain), 16.59 KB, created by
Chris Cormack
on 2013-08-08 23:43:56 UTC
(
hide
)
Description:
Bug 10626 - Remove doubled up TT plugins - Merge KohaBranchName and Branches
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2013-08-08 23:43:56 UTC
Size:
16.59 KB
patch
obsolete
>From 7a80eead931f2468e7f80b87f45ccf7476693590 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Tue, 23 Jul 2013 09:52:08 -0400 >Subject: [PATCH] Bug 10626 - Remove doubled up TT plugins - Merge > KohaBranchName and Branches > >Looking at the TT plugin directory I notice we have some plugins that >seem to do the same thing: > >KohaBranchName.pm >Branches.pm > >Test Plan: >1) Apply this patch >2) View a basket group, note the branch name is displayed >3) View a subscription's details, note the branch name is displayed >4) View suggestions, note the branch names are displayed >5) Return an item that needs transfered, note the branch name is displayed >6) Run 'prove t/db_dependent/Koha_template_plugin_Branches.t' > >Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> >--- > Koha/Template/Plugin/Branches.pm | 2 +- > Koha/Template/Plugin/KohaBranchName.pm | 33 ---------------------- > .../prog/en/modules/acqui/basketgroup.tt | 10 +++---- > .../intranet-tmpl/prog/en/modules/circ/returns.tt | 4 +-- > .../prog/en/modules/serials/subscription-detail.tt | 4 +-- > .../prog/en/modules/suggestion/suggestion.tt | 16 +++++------ > ...ranchName.t => Koha_template_plugin_Branches.t} | 12 ++++---- > 7 files changed, 24 insertions(+), 57 deletions(-) > delete mode 100644 Koha/Template/Plugin/KohaBranchName.pm > rename t/db_dependent/{Koha_template_plugin_KohaBranchName.t => Koha_template_plugin_Branches.t} (78%) > >diff --git a/Koha/Template/Plugin/Branches.pm b/Koha/Template/Plugin/Branches.pm >index e9ff105..343158c 100644 >--- a/Koha/Template/Plugin/Branches.pm >+++ b/Koha/Template/Plugin/Branches.pm >@@ -32,7 +32,7 @@ sub GetName { > my $sth = C4::Context->dbh->prepare($query); > $sth->execute($branchcode); > my $b = $sth->fetchrow_hashref(); >- return encode( 'UTF-8', $b->{'branchname'} ); >+ return $b ? encode( 'UTF-8', $b->{'branchname'} ) : q{}; > } > > 1; >diff --git a/Koha/Template/Plugin/KohaBranchName.pm b/Koha/Template/Plugin/KohaBranchName.pm >deleted file mode 100644 >index 51d1a44..0000000 >--- a/Koha/Template/Plugin/KohaBranchName.pm >+++ /dev/null >@@ -1,33 +0,0 @@ >-package Koha::Template::Plugin::KohaBranchName; >- >-# Copyright Bywater Solutions 2012 >- >-# 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 2 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, write to the Free Software Foundation, Inc., >-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >- >-use Modern::Perl; >- >-use Template::Plugin::Filter; >-use base qw( Template::Plugin::Filter ); >- >-use C4::Branch qw( GetBranchName );; >- >-sub filter { >- my ($self, $branchcode) = @_; >- my $name = GetBranchName( $branchcode ); >- return defined($name) ? $name : ''; >-} >- >-1; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt >index 6bb0048..cdf216a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt >@@ -1,4 +1,4 @@ >-[% USE KohaBranchName %] >+[% USE Branches %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Basket grouping for [% booksellername |html %]</title> > <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" /> >@@ -274,8 +274,8 @@ function submitForm(form) { > [% END %] > </td> > <td>[% basketgroup.id %]</td> >- <td>[% basketgroup.billingplace | $KohaBranchName %]</td> >- <td>[% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% basketgroup.deliveryplace | $KohaBranchName %][% END %]</td> >+ <td>[% Branches.GetName( basketgroup.billingplace ) %]</td> >+ <td>[% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% Branches.GetName( basketgroup.deliveryplace ) %][% END %]</td> > <td>[% basketgroup.basketsqty %]</td> > <td> > <input type="button" onclick="closeandprint([% basketgroup.id %])" value="Close and print" /> >@@ -312,8 +312,8 @@ function submitForm(form) { > [% END %] > </td> > <td>[% basketgroup.id %]</td> >- <td>[% basketgroup.billingplace | $KohaBranchName %]</td> >- <td>[% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% basketgroup.deliveryplace | $KohaBranchName %][% END %]</td> >+ <td>[% Branches.GetName( basketgroup.billingplace ) %]</td> >+ <td>[% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% Branches.GetName( basketgroup.deliveryplace ) %][% END %]</td> > <td>[% basketgroup.basketsqty %]</td> > <td> > <form action="/cgi-bin/koha/acqui/basketgroup.pl" method="get"><input type="hidden" name="op" value="reopen" /><input type="hidden" name="booksellerid" value="[% basketgroup.booksellerid %]" /><input type="hidden" name="basketgroupid" value="[% basketgroup.id %]" /><input type="submit" value="Reopen" /></form> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >index 98d2ae9..c39bdd4 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >@@ -1,5 +1,5 @@ > [% USE KohaDates %] >-[% USE KohaBranchName %] >+[% USE Branches %] > > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Circulation › Check in [% title |html %]</title> >@@ -92,7 +92,7 @@ $(document).ready(function () { > </div> > [% END %] > <!-- case of a mistake in transfer loop --> >-[% IF ( WrongTransfer ) %]<div id="return2" class="dialog message"><!-- WrongTransfer --><h3>Please return <a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&biblionumber=[% itembiblionumber %]">[% title |html %]</a> to [% TransferWaitingAt | $KohaBranchName %]</h3><h3><a href="#" onclick="Dopop('transfer-slip.pl?transferitem=[% itemnumber %]&&branchcode=[% homebranch %]&op=slip'); return true;">Print slip</a> or <a href="/cgi-bin/koha/circ/returns.pl?itemnumber=[% itemnumber %]&canceltransfer=1">Cancel transfer</a></h3> >+[% IF ( WrongTransfer ) %]<div id="return2" class="dialog message"><!-- WrongTransfer --><h3>Please return <a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&biblionumber=[% itembiblionumber %]">[% title |html %]</a> to [% Branches.GetName( TransferWaitingAt ) %]</h3><h3><a href="#" onclick="Dopop('transfer-slip.pl?transferitem=[% itemnumber %]&&branchcode=[% homebranch %]&op=slip'); return true;">Print slip</a> or <a href="/cgi-bin/koha/circ/returns.pl?itemnumber=[% itemnumber %]&canceltransfer=1">Cancel transfer</a></h3> > [% IF ( wborcnum ) %]<h5>Hold for:</h5> > <ul><li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]"> > [% borsurname %], [% borfirstname %]</a> ([% borcnum %])</li> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt >index 959f14f..5696c39 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt >@@ -1,4 +1,4 @@ >-[% USE KohaBranchName %] >+[% USE Branches %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Serials › Details for subscription #[% subscriptionid %]</title> > [% INCLUDE 'doc-head-close.inc' %] >@@ -102,7 +102,7 @@ $(document).ready(function() { > <li><span class="label">Librarian identity:</span> [% librarian %]</li> > <li><span class="label">Vendor:</span> <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% aqbooksellerid %]">[% aqbooksellername %]</a></li> > <li><span class="label">Biblio:</span> <a href="/cgi-bin/koha/catalogue/[% default_bib_view %].pl?biblionumber=[% bibnum %]">[% bibliotitle %]</a> <i>([% bibnum %])</i></li> >-[% IF ( branchcode ) %]<li><span class="label">Library:</span> [% branchcode | $KohaBranchName %]</li>[% END %] >+[% IF ( branchcode ) %]<li><span class="label">Library:</span> [% Branches.GetName( branchcode ) %]</li>[% END %] > [% IF ( serialsadditems ) %] > <li><span class="label">Items:</span> Serial receipt creates an item record.</li> > [% ELSE %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt >index 0b559fb..4c3c481 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt >@@ -1,5 +1,5 @@ > [% USE AuthorisedValues %] >-[% USE KohaBranchName %] >+[% USE Branches %] > [% INCLUDE 'doc-head-open.inc' %] > <title>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> [% Branches.GetName( suggestedby_branchcode ) %] ([% 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> [% Branches.GetName( managedby_branchcode ) %] ([% 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> [% Branches.GetName( acceptedby_branchcode ) %] ([% 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> [% Branches.GetName( suggestedby_branchcode ) %] ([% 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> [% Branches.GetName( managedby_branchcode ) %] ([% 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> [% Branches.GetName( acceptedby_branchcode ) %] ([% 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 %] >+ [% Branches.GetName( suggestions_loo.branchcode ) %] > </td> > <td> > [% suggestions_loo.budget_name %] >diff --git a/t/db_dependent/Koha_template_plugin_KohaBranchName.t b/t/db_dependent/Koha_template_plugin_Branches.t >similarity index 78% >rename from t/db_dependent/Koha_template_plugin_KohaBranchName.t >rename to t/db_dependent/Koha_template_plugin_Branches.t >index dbba6da..c47c466 100644 >--- a/t/db_dependent/Koha_template_plugin_KohaBranchName.t >+++ b/t/db_dependent/Koha_template_plugin_Branches.t >@@ -21,17 +21,17 @@ use Modern::Perl; > use Test::More tests => 5; > > BEGIN { >- use_ok('Koha::Template::Plugin::KohaBranchName'); >+ use_ok('Koha::Template::Plugin::Branches'); > } > >-my $filter = Koha::Template::Plugin::KohaBranchName->new(); >-ok($filter, "initialized KohaBranchName plugin"); >+my $plugin = Koha::Template::Plugin::Branches->new(); >+ok($plugin, "initialized Branches plugin"); > >-my $name = $filter->filter('CPL'); >+my $name = $plugin->GetName('CPL'); > is($name, 'Centerville', 'retrieved expected name for CPL'); > >-$name = $filter->filter('__ANY__'); >+$name = $plugin->GetName('__ANY__'); > is($name, '', 'received empty string as name of the "__ANY__" placeholder library code'); > >-$name = $filter->filter(undef); >+$name = $plugin->GetName(undef); > is($name, '', 'received empty string as name of NULL/undefined library code'); >-- >1.8.1.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 10626
:
19866
|
19867
|
19869
|
19870
|
20204
|
20205
|
20659
|
20660
|
20846
|
20847
|
20848
|
20849
|
20850
|
20962
|
22361
|
22363
|
22364
|
22365
|
22366
|
22367
|
22368
|
22369
|
23693
|
23695
|
23696