Koha/clubs/club-enrollments.pl
Hammat Wele b6cd0ef0d2
Bug 25079: Show club enrollment question answers in staff client
When a patron is enrolled in a patron club, koha collects answers to library-defined enrollment questions.
Those answers go into the database but are not viewable outside of reports.

This patch make those answers viewable on club-enrollments.pl.

Test plan
1. Apply the patch

2. Create a club template
    2.1. Go to Tools > Patron clubs
    2.2. Click on 'New Club Template'
    2.3. Fill the form
    2.4. on the 'Club fields' section, Click on Add new field
    2.5. Fill in the form
    2.6. on the 'Enrollment fields' section, Click on Add new field
    2.7. Fill in the form
    2.8. Click on Save button

3. Creation of the club
    3.1. Go to Tools > Patron clubs > 'Clubs' section (bottom)
    3.2. Click on the 'New Club' button and select the club template create on step 1
    3.3. Fill in the form
    3.4. Click on Save button

4. Club enrollement
    On the intranet (or the OPAC if permitted)
    4.1. Search for a pratron and open the patron folder
    4.2. Click on the 'Clubs' tab
    4.3. Find the name of the club and click on 'Enroll'
    4.4. Fill the questionnaire
    4.5. Confirm registration

5. Check registrations on the intranet
    5.1. Go to Tools > Patron clubs
    5.2. In the bottom 'Clubs' section, find the name of the club
    5.3. check the 'Enrolled patrons' column
       ---> should not be equal to zero.
    5.4 Click on 'Action' and choose the option “Enrollments”
       ---> The Enrollment fields created on step 2.6. are viewable in the table with their values

Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-06-23 11:00:54 -03:00

50 lines
1.6 KiB
Perl
Executable file

#!/usr/bin/perl
# Copyright 2013 ByWater Solutions
#
# 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 CGI;
use C4::Auth qw( get_template_and_user );
use C4::Output qw( output_html_with_http_headers );
use Koha::Clubs;
use Koha::Club::Enrollment::Fields;
my $cgi = CGI->new;
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{
template_name => 'clubs/club-enrollments.tt',
query => $cgi,
type => 'intranet',
flagsrequired => { clubs => 'edit_clubs' },
}
);
my $id = $cgi->param('id');
my $club = Koha::Clubs->find( $id );
my @club_template_enrollment_fields = $club->club_template()->club_template_enrollment_fields()->as_list;
my @club_enrollment_fields = Koha::Club::Enrollment::Fields->search({'club_template_enrollment_field_id'=> { -in => [map { $_->id } @club_template_enrollment_fields] }})->as_list;
$template->param(
club => $club,
club_enrollment_fields => \@club_enrollment_fields,
);
output_html_with_http_headers( $cgi, $cookie, $template->output );