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 274-281 function submitForm(form) { Link Here
274
												[% END %]
274
												[% END %]
275
						</td>
275
						</td>
276
                                    <td>[% basketgroup.id %]</td>
276
                                    <td>[% basketgroup.id %]</td>
277
                                    <td>[% basketgroup.billingplace | $KohaBranchName %]</td>
277
                                    <td>[% Branches.GetName( basketgroup.billingplace ) %]</td>
278
                                    <td>[% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% basketgroup.deliveryplace | $KohaBranchName %][% END %]</td>
278
                                    <td>[% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% Branches.GetName( basketgroup.deliveryplace ) %][% END %]</td>
279
                                    <td>[% basketgroup.basketsqty %]</td>
279
                                    <td>[% basketgroup.basketsqty %]</td>
280
							<td>
280
							<td>
281
								<input type="button" onclick="closeandprint([% basketgroup.id %])" value="Close and print" />
281
								<input type="button" onclick="closeandprint([% basketgroup.id %])" value="Close and print" />
Lines 312-319 function submitForm(form) { Link Here
312
										[% END %]
312
										[% END %]
313
					</td>
313
					</td>
314
                                    <td>[% basketgroup.id %]</td>
314
                                    <td>[% basketgroup.id %]</td>
315
                                    <td>[% basketgroup.billingplace | $KohaBranchName %]</td>
315
                                    <td>[% Branches.GetName( basketgroup.billingplace ) %]</td>
316
                                    <td>[% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% basketgroup.deliveryplace | $KohaBranchName %][% END %]</td>
316
                                    <td>[% IF (basketgroup.freedeliveryplace) %]Free delivery place[% ELSE %][% Branches.GetName( basketgroup.deliveryplace ) %][% END %]</td>
317
                                    <td>[% basketgroup.basketsqty %]</td>
317
                                    <td>[% basketgroup.basketsqty %]</td>
318
					<td>
318
					<td>
319
							<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>
319
							<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 AuthorisedValues %]
1
[% USE AuthorisedValues %]
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 226-243 $(document).ready(function() { calcNewsuggTotal(); }); Link Here
226
            <tr>
226
            <tr>
227
                <th><span class="label">Suggestion creation</span> </th>
227
                <th><span class="label">Suggestion creation</span> </th>
228
                <td>[% suggesteddate %]</td>
228
                <td>[% suggesteddate %]</td>
229
                <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 %]
229
                <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 %]
230
                </td>
230
                </td>
231
            </tr>
231
            </tr>
232
            <tr>
232
            <tr>
233
                <th><span class="label">Suggestion management</span> </th>
233
                <th><span class="label">Suggestion management</span> </th>
234
                <td>[% manageddate %]</td>
234
                <td>[% manageddate %]</td>
235
                <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>
235
                <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>
236
            </tr>
236
            </tr>
237
            <tr>
237
            <tr>
238
                <th><span class="label">Suggestion accepted</span> </th>
238
                <th><span class="label">Suggestion accepted</span> </th>
239
                <td>[% accepteddate %]</td>
239
                <td>[% accepteddate %]</td>
240
                <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>
240
                <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>
241
            </tr>
241
            </tr>
242
            </tbody>
242
            </tbody>
243
        </table></li></ol>
243
        </table></li></ol>
Lines 354-371 $(document).ready(function() { calcNewsuggTotal(); }); Link Here
354
            <tr>
354
            <tr>
355
                <th><label for="suggesteddate">Suggestion creation</label> </th>
355
                <th><label for="suggesteddate">Suggestion creation</label> </th>
356
                <td><input type="text" id="suggesteddate" name="suggesteddate" size="10" maxlength="10" value="[% suggesteddate %]"/></td>
356
                <td><input type="text" id="suggesteddate" name="suggesteddate" size="10" maxlength="10" value="[% suggesteddate %]"/></td>
357
                <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 %]
357
                <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 %]
358
                </td>
358
                </td>
359
            </tr>
359
            </tr>
360
            <tr>
360
            <tr>
361
                <th><label for="managedon">Suggestion management</label> </th>
361
                <th><label for="managedon">Suggestion management</label> </th>
362
                <td><input type="text" id="managedon" name="manageddate" size="10" maxlength="10" value="[% manageddate %]" /></td>
362
                <td><input type="text" id="managedon" name="manageddate" size="10" maxlength="10" value="[% manageddate %]" /></td>
363
                <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>
363
                <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>
364
            </tr>
364
            </tr>
365
            <tr>
365
            <tr>
366
                <th><label for="accepteddate">Suggestion accepted</label> </th>
366
                <th><label for="accepteddate">Suggestion accepted</label> </th>
367
                <td><input type="text" id="accepteddate" name="accepteddate" size="10" maxlength="10" value="[% accepteddate %]" /></td>
367
                <td><input type="text" id="accepteddate" name="accepteddate" size="10" maxlength="10" value="[% accepteddate %]" /></td>
368
                <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>
368
                <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>
369
            </tr>
369
            </tr>
370
            </tbody>
370
            </tbody>
371
        </table></li></ol>
371
        </table></li></ol>
Lines 482-488 $(document).ready(function() { calcNewsuggTotal(); }); Link Here
482
                    [% IF ( suggestions_loo.manageddate ) %] - [% suggestions_loo.manageddate %][% END %]
482
                    [% IF ( suggestions_loo.manageddate ) %] - [% suggestions_loo.manageddate %][% END %]
483
                </td>
483
                </td>
484
                <td>
484
                <td>
485
                    [% suggestions_loo.branchcode | $KohaBranchName %]
485
                    [% Branches.GetName( suggestions_loo.branchcode ) %]
486
                </td>
486
                </td>
487
                <td>
487
                <td>
488
                    [% suggestions_loo.budget_name %]
488
                    [% 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