Bugzilla – Attachment 108965 Details for
Bug 26139
'Place hold' button isn't hidden in all detail views if there are no items available for loan
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26139: Koha::Template::Plugin::Context
Bug-26139-KohaTemplatePluginContext.patch (text/plain), 2.16 KB, created by
Jonathan Druart
on 2020-08-24 07:59:58 UTC
(
hide
)
Description:
Bug 26139: Koha::Template::Plugin::Context
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-08-24 07:59:58 UTC
Size:
2.16 KB
patch
obsolete
>From 9346274c72732d8e3fd37e674df83a7e6aaa0677 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 24 Aug 2020 09:58:15 +0200 >Subject: [PATCH] Bug 26139: Koha::Template::Plugin::Context > >There is something wrong with our ->search method and TT behaviours, it >is hard to retrieve object list in a scalar context. >If [% objects.method.count %] is called, objects.method will get the >first object of the list and count will explode (Koha::Object->count >does not exist) > >We need to force the call in a scalar context to retrieve an iterator >and prevent to fetch all the objects (we could have called all then >size, but it's not efficient) >--- > Koha/Template/Plugin/Context.pm | 47 +++++++++++++++++++++++++++++++++ > 1 file changed, 47 insertions(+) > create mode 100644 Koha/Template/Plugin/Context.pm > >diff --git a/Koha/Template/Plugin/Context.pm b/Koha/Template/Plugin/Context.pm >new file mode 100644 >index 0000000000..03c024b609 >--- /dev/null >+++ b/Koha/Template/Plugin/Context.pm >@@ -0,0 +1,47 @@ >+package Koha::Template::Plugin::Context; >+ >+# 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 base qw( Template::Plugin ); >+ >+use C4::Context; >+ >+=head1 NAME >+ >+Koha::Template::Plugin::Scalar - Return object set in scalar context >+ >+=head1 SYNOPSIS >+ >+If you need to force scalar context when calling a method on a object set. >+Especially useful to call ->search >+ >+=cut >+ >+=head1 API >+ >+=head2 Class Methods >+ >+=cut >+ >+sub Scalar { >+ my ( $self, $set, $method ) = @_; >+ $set = $set->$method; >+ return $set; >+} >+ >+1; >-- >2.20.1
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 26139
:
107949
|
108159
|
108379
|
108965
|
108966
|
109057