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

(-)a/Koha/Template/Plugin/Context.pm (+47 lines)
Line 0 Link Here
1
package Koha::Template::Plugin::Context;
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
17
18
use Modern::Perl;
19
20
use base qw( Template::Plugin );
21
22
use C4::Context;
23
24
=head1 NAME
25
26
Koha::Template::Plugin::Scalar - Return object set in scalar context
27
28
=head1 SYNOPSIS
29
30
If you need to force scalar context when calling a method on a object set.
31
Especially useful to call ->search
32
33
=cut
34
35
=head1 API
36
37
=head2 Class Methods
38
39
=cut
40
41
sub Scalar {
42
    my ( $self, $set, $method ) = @_;
43
    $set = $set->$method;
44
    return $set;
45
}
46
47
1;
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/catalog-strings.inc (-3 / +6 lines)
Lines 1-3 Link Here
1
[% USE Context %]
1
<!-- catalog-strings.inc -->
2
<!-- catalog-strings.inc -->
2
<script>
3
<script>
3
    /* Strings for translation */
4
    /* Strings for translation */
Lines 17-24 Link Here
17
    var biblionumber = [% biblionumber | html %];
18
    var biblionumber = [% biblionumber | html %];
18
    var count = [% count | html %];
19
    var count = [% count | html %];
19
    var holdcount = [% holdcount | html %];
20
    var holdcount = [% holdcount | html %];
20
    var countorders = [% countorders | html %];
21
    [% SET orders = biblio.orders %]
21
    var countdeletedorders = [% countdeletedorders | html %];
22
    [% SET current   = Context.Scalar(orders, "filter_by_current") %]
23
    [% SET cancelled = Context.Scalar(orders, "filter_by_cancelled") %]
24
    var countorders = [% current.count || 0 | html %];
25
    var countdeletedorders = [% cancelled.count || 0 | html %];
22
26
23
    /* provide Z3950 search points */
27
    /* provide Z3950 search points */
24
    function GetZ3950Terms(){
28
    function GetZ3950Terms(){
25
- 

Return to bug 23166