View | Details | Raw Unified | Return to bug 10626
Collapse All | Expand All

(-)a/Koha/Template/Plugin/Branches.pm (-1 / +1 lines)
Lines 32-38 sub GetName { Link Here
32
    my $sth   = C4::Context->dbh->prepare($query);
32
    my $sth   = C4::Context->dbh->prepare($query);
33
    $sth->execute($branchcode);
33
    $sth->execute($branchcode);
34
    my $b = $sth->fetchrow_hashref();
34
    my $b = $sth->fetchrow_hashref();
35
    return encode( 'UTF-8', $b->{'branchname'} );
35
    return $b ? encode( 'UTF-8', $b->{'branchname'} ) : q{};
36
}
36
}
37
37
38
1;
38
1;
(-)a/Koha/Template/Plugin/KohaBranchName.pm (-33 lines)
Lines 1-33 Link Here
1
package Koha::Template::Plugin::KohaBranchName;
2
3
# Copyright Bywater Solutions 2012
4
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 2 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use Modern::Perl;
21
22
use Template::Plugin::Filter;
23
use base qw( Template::Plugin::Filter );
24
25
use C4::Branch qw( GetBranchName );;
26
27
sub filter {
28
    my ($self, $branchcode) = @_;
29
    my $name = GetBranchName( $branchcode );
30
    return defined($name) ? $name : '';
31
}
32
33
1;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt (-5 / +5 lines)
Lines 1-4 Link Here
1
[% USE KohaBranchName %]
1
[% USE Branches %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
<title>Koha &rsaquo; Basket grouping for [% booksellername |html %]</title>
3
<title>Koha &rsaquo; Basket grouping for [% booksellername |html %]</title>
4
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
4
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
Lines 273-280 function submitForm(form) { Link Here
273
												[% END %]
273
												[% END %]
274
						</td>
274
						</td>
275
                                    <td>[% basketgroup.id %]</td>
275
                                    <td>[% basketgroup.id %]</td>
276
                                    <td>[% basketgroup.billingplace | $KohaBranchName %]</td>
276
                                    <td>[% Branches.GetName( basketgroup.billingplace ) %]</td>
277
                                    <td>[% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% basketgroup.deliveryplace | $KohaBranchName %][% END %]</td>
277
                                    <td>[% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% Branches.GetName( basketgroup.deliveryplace ) %][% END %]</td>
278
                                    <td>[% basketgroup.basketsqty %]</td>
278
                                    <td>[% basketgroup.basketsqty %]</td>
279
							<td>
279
							<td>
280
								<input type="button" onclick="closeandprint([% basketgroup.id %])" value="Close and print" />
280
								<input type="button" onclick="closeandprint([% basketgroup.id %])" value="Close and print" />
Lines 311-318 function submitForm(form) { Link Here
311
										[% END %]
311
										[% END %]
312
					</td>
312
					</td>
313
                                    <td>[% basketgroup.id %]</td>
313
                                    <td>[% basketgroup.id %]</td>
314
                                    <td>[% basketgroup.billingplace | $KohaBranchName %]</td>
314
                                    <td>[% Branches.GetName( basketgroup.billingplace ) %]</td>
315
                                    <td>[% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% basketgroup.deliveryplace | $KohaBranchName %][% END %]</td>
315
                                    <td>[% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% Branches.GetName( basketgroup.deliveryplace ) %][% END %]</td>
316
                                    <td>[% basketgroup.basketsqty %]</td>
316
                                    <td>[% basketgroup.basketsqty %]</td>
317
					<td>
317
					<td>
318
							<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>
318
							<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>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt (-2 / +2 lines)
Lines 1-5 Link Here
1
[% USE KohaDates %]
1
[% USE KohaDates %]
2
[% USE KohaBranchName %]
2
[% USE Branches %]
3
3
4
[% INCLUDE 'doc-head-open.inc' %]
4
[% INCLUDE 'doc-head-open.inc' %]
5
<title>Koha &rsaquo; Circulation &rsaquo; Check in [% title |html %]</title>
5
<title>Koha &rsaquo; Circulation &rsaquo; Check in [% title |html %]</title>
Lines 92-98 $(document).ready(function () { Link Here
92
</div>
92
</div>
93
[% END %]
93
[% END %]
94
<!-- case of a mistake in transfer loop -->
94
<!-- case of a mistake in transfer loop -->
95
[% IF ( WrongTransfer ) %]<div id="return2" class="dialog message"><!-- WrongTransfer --><h3>Please return <a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber %]">[% title |html %]</a> to [% TransferWaitingAt | $KohaBranchName %]</h3><h3><a href="#" onclick="Dopop('transfer-slip.pl?transferitem=[% itemnumber %]&amp;&amp;branchcode=[% homebranch %]&amp;op=slip'); return true;">Print slip</a> or <a href="/cgi-bin/koha/circ/returns.pl?itemnumber=[% itemnumber %]&amp;canceltransfer=1">Cancel transfer</a></h3>
95
[% IF ( WrongTransfer ) %]<div id="return2" class="dialog message"><!-- WrongTransfer --><h3>Please return <a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=[% itembiblionumber %]">[% title |html %]</a> to [% Branches.GetName( TransferWaitingAt ) %]</h3><h3><a href="#" onclick="Dopop('transfer-slip.pl?transferitem=[% itemnumber %]&amp;&amp;branchcode=[% homebranch %]&amp;op=slip'); return true;">Print slip</a> or <a href="/cgi-bin/koha/circ/returns.pl?itemnumber=[% itemnumber %]&amp;canceltransfer=1">Cancel transfer</a></h3>
96
[% IF ( wborcnum ) %]<h5>Hold for:</h5>
96
[% IF ( wborcnum ) %]<h5>Hold for:</h5>
97
        <ul><li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">
97
        <ul><li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]">
98
            [% borsurname %], [% borfirstname %]</a> ([% borcnum %])</li>
98
            [% borsurname %], [% borfirstname %]</a> ([% borcnum %])</li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt (-2 / +2 lines)
Lines 1-4 Link Here
1
[% USE KohaBranchName %]
1
[% USE Branches %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
<title>Koha &rsaquo; Serials &rsaquo; Details for subscription #[% subscriptionid %]</title>
3
<title>Koha &rsaquo; Serials &rsaquo; Details for subscription #[% subscriptionid %]</title>
4
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'doc-head-close.inc' %]
Lines 102-108 $(document).ready(function() { Link Here
102
        <li><span class="label">Librarian identity:</span> [% librarian %]</li>
102
        <li><span class="label">Librarian identity:</span> [% librarian %]</li>
103
        <li><span class="label">Vendor:</span> <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% aqbooksellerid %]">[% aqbooksellername %]</a></li>
103
        <li><span class="label">Vendor:</span> <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% aqbooksellerid %]">[% aqbooksellername %]</a></li>
104
        <li><span class="label">Biblio:</span>  <a href="/cgi-bin/koha/catalogue/[% default_bib_view %].pl?biblionumber=[% bibnum %]">[% bibliotitle %]</a> <i>([% bibnum %])</i></li>
104
        <li><span class="label">Biblio:</span>  <a href="/cgi-bin/koha/catalogue/[% default_bib_view %].pl?biblionumber=[% bibnum %]">[% bibliotitle %]</a> <i>([% bibnum %])</i></li>
105
[% IF ( branchcode ) %]<li><span class="label">Library:</span> [% branchcode | $KohaBranchName %]</li>[% END %]
105
[% IF ( branchcode ) %]<li><span class="label">Library:</span> [% Branches.GetName( branchcode ) %]</li>[% END %]
106
        [% IF ( serialsadditems ) %]
106
        [% IF ( serialsadditems ) %]
107
            <li><span class="label">Items:</span> Serial receipt creates an item record.</li>
107
            <li><span class="label">Items:</span> Serial receipt creates an item record.</li>
108
        [% ELSE %]
108
        [% ELSE %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt (-8 / +8 lines)
Lines 1-5 Link Here
1
[% USE KohaAuthorisedValues %]
1
[% USE KohaAuthorisedValues %]
2
[% USE KohaBranchName %]
2
[% USE Branches %]
3
[% INCLUDE 'doc-head-open.inc' %]
3
[% INCLUDE 'doc-head-open.inc' %]
4
<title>Koha &rsaquo; Acquisitions  &rsaquo;
4
<title>Koha &rsaquo; Acquisitions  &rsaquo;
5
    [% IF ( op_save ) %]
5
    [% IF ( op_save ) %]
Lines 242-259 h4.local_collapse a { font-size : 80%; text-decoration: none; } fieldset.brief o Link Here
242
            <tr>
242
            <tr>
243
                <th><span class="label">Suggestion creation</span> </th>
243
                <th><span class="label">Suggestion creation</span> </th>
244
                <td>[% suggesteddate %]</td>
244
                <td>[% suggesteddate %]</td>
245
                <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 %]
245
                <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 %]
246
                </td>
246
                </td>
247
            </tr>
247
            </tr>
248
            <tr>
248
            <tr>
249
                <th><span class="label">Suggestion management</span> </th>
249
                <th><span class="label">Suggestion management</span> </th>
250
                <td>[% manageddate %]</td>
250
                <td>[% manageddate %]</td>
251
                <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>
251
                <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>
252
            </tr>
252
            </tr>
253
            <tr>
253
            <tr>
254
                <th><span class="label">Suggestion accepted</span> </th>
254
                <th><span class="label">Suggestion accepted</span> </th>
255
                <td>[% accepteddate %]</td>
255
                <td>[% accepteddate %]</td>
256
                <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>
256
                <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>
257
            </tr>
257
            </tr>
258
            </tbody>
258
            </tbody>
259
        </table></li></ol>
259
        </table></li></ol>
Lines 372-389 h4.local_collapse a { font-size : 80%; text-decoration: none; } fieldset.brief o Link Here
372
            <tr>
372
            <tr>
373
                <th><label for="suggesteddate">Suggestion creation</label> </th>
373
                <th><label for="suggesteddate">Suggestion creation</label> </th>
374
                <td><input type="text" id="suggesteddate" name="suggesteddate" size="10" maxlength="10" value="[% suggesteddate %]"/></td>
374
                <td><input type="text" id="suggesteddate" name="suggesteddate" size="10" maxlength="10" value="[% suggesteddate %]"/></td>
375
                <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 %]
375
                <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 %]
376
                </td>
376
                </td>
377
            </tr>
377
            </tr>
378
            <tr>
378
            <tr>
379
                <th><label for="managedon">Suggestion management</label> </th>
379
                <th><label for="managedon">Suggestion management</label> </th>
380
                <td><input type="text" id="managedon" name="manageddate" size="10" maxlength="10" value="[% manageddate %]" /></td>
380
                <td><input type="text" id="managedon" name="manageddate" size="10" maxlength="10" value="[% manageddate %]" /></td>
381
                <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>
381
                <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>
382
            </tr>
382
            </tr>
383
            <tr>
383
            <tr>
384
                <th><label for="accepteddate">Suggestion accepted</label> </th>
384
                <th><label for="accepteddate">Suggestion accepted</label> </th>
385
                <td><input type="text" id="accepteddate" name="accepteddate" size="10" maxlength="10" value="[% accepteddate %]" /></td>
385
                <td><input type="text" id="accepteddate" name="accepteddate" size="10" maxlength="10" value="[% accepteddate %]" /></td>
386
                <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>
386
                <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>
387
            </tr>
387
            </tr>
388
            </tbody>
388
            </tbody>
389
        </table></li></ol>
389
        </table></li></ol>
Lines 501-507 h4.local_collapse a { font-size : 80%; text-decoration: none; } fieldset.brief o Link Here
501
                    [% IF ( suggestions_loo.manageddate ) %] - [% suggestions_loo.manageddate %][% END %]
501
                    [% IF ( suggestions_loo.manageddate ) %] - [% suggestions_loo.manageddate %][% END %]
502
                </td>
502
                </td>
503
                <td>
503
                <td>
504
                    [% suggestions_loo.branchcode | $KohaBranchName %]
504
                    [% Branches.GetName( suggestions_loo.branchcode ) %]
505
                </td>
505
                </td>
506
                <td>
506
                <td>
507
                    [% suggestions_loo.budget_name %]
507
                    [% suggestions_loo.budget_name %]
(-)a/t/db_dependent/Koha_template_plugin_KohaBranchName.t (-7 / +6 lines)
Lines 21-37 use Modern::Perl; Link Here
21
use Test::More tests => 5;
21
use Test::More tests => 5;
22
22
23
BEGIN {
23
BEGIN {
24
    use_ok('Koha::Template::Plugin::KohaBranchName');
24
    use_ok('Koha::Template::Plugin::Branches');
25
}
25
}
26
26
27
my $filter = Koha::Template::Plugin::KohaBranchName->new();
27
my $plugin = Koha::Template::Plugin::Branches->new();
28
ok($filter, "initialized KohaBranchName plugin");
28
ok($plugin, "initialized Branches plugin");
29
29
30
my $name = $filter->filter('CPL');
30
my $name = $plugin->GetName('CPL');
31
is($name, 'Centerville', 'retrieved expected name for CPL');
31
is($name, 'Centerville', 'retrieved expected name for CPL');
32
32
33
$name = $filter->filter('__ANY__');
33
$name = $plugin->GetName('__ANY__');
34
is($name, '', 'received empty string as name of the "__ANY__" placeholder library code');
34
is($name, '', 'received empty string as name of the "__ANY__" placeholder library code');
35
35
36
$name = $filter->filter(undef);
36
$name = $plugin->GetName(undef);
37
is($name, '', 'received empty string as name of NULL/undefined library code');
37
is($name, '', 'received empty string as name of NULL/undefined library code');
38
- 

Return to bug 10626