Bug 12461 - (QA Followup)
authorNick Clemens <nick@bywatersolutions.com>
Fri, 28 Apr 2017 10:43:44 +0000 (06:43 -0400)
committerKyle M Hall <kyle@bywatersolutions.com>
Fri, 28 Apr 2017 12:37:45 +0000 (08:37 -0400)
    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 <kyle@bywatersolutions.com>

Koha/Club.pm
Koha/Clubs.pm
clubs/club-enrollments.pl
koha-tmpl/intranet-tmpl/prog/en/modules/clubs/club-enrollments.tt
koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs.tt

index 0d93f8c..f55bfb5 100644 (file)
@@ -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
index a553314..7d62d22 100644 (file)
@@ -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' } );
 
index e3cd12d..01ef24d 100755 (executable)
@@ -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,
index 72af5b8..738b05f 100644 (file)
@@ -27,7 +27,7 @@
 <body id="club_enrollments" class="clubs">
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'cat-search.inc' %]
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo; Patron clubs &rsaquo; Club enrollments</div>
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo; <a href="clubs.pl">Patron clubs</a> &rsaquo; Club enrollments</div>
 
 <div id="doc3" class="yui-t2">
    <div id="bd">
index 14fded1..3727423 100644 (file)
@@ -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',