From 709358e0c98a583b48f0fee13adb45c00f51b5ff Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 28 Apr 2017 06:43:44 -0400 Subject: [PATCH] Bug 12461 - (QA Followup) Club enrollments should only list active enrollments Confirms should warn of cascading delete Branch limited clubs should only be available to members of that branch Fix breadcrumbs Signed-off-by: Kyle M Hall --- Koha/Club.pm | 2 +- Koha/Clubs.pm | 5 ++++- clubs/club-enrollments.pl | 2 +- .../intranet-tmpl/prog/en/modules/clubs/club-enrollments.tt | 2 +- koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs.tt | 4 ++-- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Koha/Club.pm b/Koha/Club.pm index 0d93f8c73b..f55bfb54a8 100644 --- a/Koha/Club.pm +++ b/Koha/Club.pm @@ -72,7 +72,7 @@ sub club_enrollments { return unless $self->id(); - return scalar Koha::Club::Enrollments->search( { club_id => $self->id() } ); + return scalar Koha::Club::Enrollments->search( { club_id => $self->id(), date_canceled => undef } ); } =head3 club_fields diff --git a/Koha/Clubs.pm b/Koha/Clubs.pm index a553314131..7d62d2299b 100644 --- a/Koha/Clubs.pm +++ b/Koha/Clubs.pm @@ -57,7 +57,10 @@ sub get_enrollable { } # 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 => { '>=' => \'CURRENT_DATE()' }, date_end => undef], + -or => [ 'me.branchcode' => $borrower->branchcode, 'me.branchcode' => undef ] + ]; my $rs = $self->_resultset()->search( $params, { prefetch => 'club_template' } ); diff --git a/clubs/club-enrollments.pl b/clubs/club-enrollments.pl index e3cd12d24a..01ef24d19f 100755 --- a/clubs/club-enrollments.pl +++ b/clubs/club-enrollments.pl @@ -38,7 +38,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( ); my $id = $cgi->param('id'); -my $club = Koha::Clubs->find($id); +my $club = Koha::Clubs->find( $id ); $template->param( club => $club, diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/club-enrollments.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/club-enrollments.tt index 72af5b8450..738b05fd83 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/club-enrollments.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/club-enrollments.tt @@ -27,7 +27,7 @@ [% INCLUDE 'header.inc' %] [% INCLUDE 'cat-search.inc' %] - +
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs.tt index 14fded174c..372742340a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs.tt @@ -29,7 +29,7 @@ }); function ConfirmDeleteTemplate( id, name, a ) { - if ( confirm( _("Are you sure you want to delete the club template %s?" ).format(name) ) ) { + if ( confirm( _("Are you sure you want to delete the club template %s? This will delete all clubs using this template and cancel patron enrollments" ).format(name) ) ) { $.ajax({ type: "POST", url: '/cgi-bin/koha/svc/club/template/delete', @@ -47,7 +47,7 @@ } function ConfirmDeleteClub( id, name, a ) { - if ( confirm( _("Are you sure you want to delete the club %s?" ).format(name) ) ) { + if ( confirm( _("Are you sure you want to delete the club %s? This will cancel all patron enrollments in this club." ).format(name) ) ) { $.ajax({ type: "POST", url: '/cgi-bin/koha/svc/club/delete', -- 2.39.5