Bugzilla – Attachment 130145 Details for
Bug 29844
Remove uses of wantarray in Koha::Objects
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29844: Simplify Koha::Clubs->get_enrollable
Bug-29844-Simplify-KohaClubs-getenrollable.patch (text/plain), 5.24 KB, created by
Tomás Cohen Arazi (tcohen)
on 2022-02-03 13:58:33 UTC
(
hide
)
Description:
Bug 29844: Simplify Koha::Clubs->get_enrollable
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2022-02-03 13:58:33 UTC
Size:
5.24 KB
patch
obsolete
>From 4132f77eb6448d4a896227c1dc005713c2f1cac8 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 3 Feb 2022 10:54:25 -0300 >Subject: [PATCH] Bug 29844: Simplify Koha::Clubs->get_enrollable > >This patch removes the wantarray use in Koha::Clubs->get_enrollable and >adjusts the callers. > >Also, reference to some unused params in Koha::Patron clubs-related >methods are removed as well. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/Clubs.pm | 14 +------------- > Koha/Patron.pm | 4 ++-- > .../prog/en/modules/circ/circulation.tt | 4 ++-- > .../prog/en/modules/members/moremember.tt | 4 ++-- > .../opac-tmpl/bootstrap/en/modules/opac-user.tt | 4 ++-- > 5 files changed, 9 insertions(+), 21 deletions(-) > >diff --git a/Koha/Clubs.pm b/Koha/Clubs.pm >index f78e766eba..2f60648959 100644 >--- a/Koha/Clubs.pm >+++ b/Koha/Clubs.pm >@@ -70,19 +70,7 @@ sub get_enrollable { > ] > ]; > >- my $rs = $self->_resultset()->search( $params, { prefetch => 'club_template' } ); >- >- if (wantarray) { >- my $class = ref($self) ? ref($self) : $self; >- >- return $class->_wrap( $rs->all() ); >- >- } >- else { >- my $class = ref($self) ? ref($self) : $self; >- >- return $class->_new_from_dbic($rs); >- } >+ return $self->search( $params, { prefetch => 'club_template' } ); > } > > =head3 filter_out_empty >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index 1f0ca44c3c..add13d1501 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -1355,7 +1355,7 @@ sub first_valid_email_address { > =cut > > sub get_club_enrollments { >- my ( $self, $return_scalar ) = @_; >+ my ( $self ) = @_; > > return Koha::Club::Enrollments->search( { borrowernumber => $self->borrowernumber(), date_canceled => undef } ); > } >@@ -1365,7 +1365,7 @@ sub get_club_enrollments { > =cut > > sub get_enrollable_clubs { >- my ( $self, $is_enrollable_from_opac, $return_scalar ) = @_; >+ my ( $self, $is_enrollable_from_opac ) = @_; > > my $params; > $params->{is_enrollable_from_opac} = $is_enrollable_from_opac >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >index a5ada8c27b..13d80518d3 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >@@ -805,8 +805,8 @@ > > <li><a id="debarments-tab-link" href="#reldebarments">[% debarments.count | html %] Restrictions</a></li> > >- [% SET enrollments = patron.get_club_enrollments(1) %] >- [% SET enrollable = patron.get_enrollable_clubs(0,1) %] >+ [% SET enrollments = patron.get_club_enrollments %] >+ [% SET enrollable = patron.get_enrollable_clubs(0) %] <!-- 0 => not OPAC --> > [% IF CAN_user_clubs && ( enrollable.count || enrollments.count ) %] > <li> > <a id="clubs-tab-link" href="#clubs-tab"> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >index 951c3e1023..81602072d0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >@@ -732,8 +732,8 @@ > <li> > <a id="debarments-tab-link" href="#reldebarments">[% debarments.size | html %] Restrictions</a> > </li> >- [% SET enrollments = patron.get_club_enrollments(1) %] >- [% SET enrollable = patron.get_enrollable_clubs(0,1) %] >+ [% SET enrollments = patron.get_club_enrollments %] >+ [% SET enrollable = patron.get_enrollable_clubs(0) %] <!-- 0 => not OPAC --> > [% IF CAN_user_clubs && ( enrollable.count || enrollments.count ) %] > <li> > <a id="clubs-tab-link" href="#clubs-tab"> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >index 45ce195e88..352111cd4e 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >@@ -10,8 +10,8 @@ > [% SET OpacNav = AdditionalContents.get( location => "OpacNav", lang => lang, library => logged_in_user.branchcode, blocktitle => 0 ) %] > [% SET OpacNavBottom = AdditionalContents.get( location => "OpacNavBottom", lang => lang, library => logged_in_user.branchcode, blocktitle => 0 ) %] > >-[% SET borrower_club_enrollments = logged_in_user.get_club_enrollments(1) %] >-[% SET borrower_enrollable_clubs = logged_in_user.get_enrollable_clubs(1,1) %] >+[% SET borrower_club_enrollments = logged_in_user.get_club_enrollments %] >+[% SET borrower_enrollable_clubs = logged_in_user.get_enrollable_clubs(1) %] <!-- 1 => OPAC --> > > [% INCLUDE 'doc-head-open.inc' %] > <title>Your library home › [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title> >-- >2.32.0
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 29844
:
129285
|
129286
|
129287
|
129290
|
129291
|
129292
|
129293
|
129295
|
129996
|
129997
|
129998
|
129999
|
130098
|
130099
|
130100
|
130101
|
130129
|
130130
|
130131
|
130132
|
130133
|
130134
|
130135
|
130136
|
130137
|
130138
|
130139
|
130143
|
130145
|
130146
|
130481
|
130947
|
131032