X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=Koha%2FClubs.pm;h=28fa41e81ac0651b30c1086ebd780a5402a8cead;hb=e917b5788ccc406263b49eda7bce6177260f73e6;hp=a55331413171ccd28a24e0cb22c014ef1f70ced4;hpb=589aa069915c001792a71d900e26a20526d6b9d0;p=srvgit diff --git a/Koha/Clubs.pm b/Koha/Clubs.pm index a553314131..28fa41e81a 100644 --- a/Koha/Clubs.pm +++ b/Koha/Clubs.pm @@ -4,24 +4,25 @@ package Koha::Clubs; # # 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 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. +# 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, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# You should have received a copy of the GNU General Public License +# along with Koha; if not, see . use Modern::Perl; use Carp; use Koha::Database; +use Koha::DateUtils qw( dt_from_string ); use Koha::Club; @@ -56,8 +57,19 @@ sub get_enrollable { } } + my $dtf = Koha::Database->new->schema->storage->datetime_parser; + # Only clubs with no end date or an end date in the future can be enrolled in - $params->{'-or'} = [ date_end => { '>=' => \'CURRENT_DATE()' }, date_end => undef ]; + $params->{'-and'} = [ + -or => [ + date_end => { '>=' => $dtf->format_datetime( dt_from_string() ) }, + date_end => undef, + ], + -or => [ + 'me.branchcode' => $borrower->branchcode, + 'me.branchcode' => undef, + ] + ]; my $rs = $self->_resultset()->search( $params, { prefetch => 'club_template' } );