From e9a8c09e70834ab3ddf965594688709317663cee Mon Sep 17 00:00:00 2001 From: Hammat Wele Date: Wed, 12 Apr 2023 00:32:02 +0000 Subject: [PATCH] Bug 25079: Add a 'edit' functionality to the Clubs tool in the staff interface A club enrollment can be cancel but it can't be edited This patch add a 'edit' functionality to the Clubs tool in the staff interface Test plan 1. Create a club template 1.1. Go to Tools > Patron clubs 1.2. Click on 'New Club Template' 1.3. Fill the form 1.4. on the 'Club fields' section, Click on Add new field 1.5. Fill in the form 1.6. on the 'Enrollment fields' section, Click on Add new field 1.7. Fill in the form 1.8. Click on Save button 2. Creation of the club 2.1. Go to Tools > Patron clubs > 'Clubs' section (bottom) 2.2. Click on the 'New Club' button and select the club template create on step 1 2.3. Fill in the form 2.4. Click on Save button 3. Club enrollement On the intranet 3.1. Search for a pratron and open the patron folder 3.2. Click on the 'Clubs' tab 3.3. Find the name of the club and click on 'Enroll' 3.4. Fill the questionnaire 3.5. Confirm registration ---> Note that the enrollement can be canceled but it cannot be modified 4. Apply the patch 5. Click one more time on the 'Clubs' tab ---> Note that the enrollement can now be modified Signed-off-by: Sam Lau --- clubs/patron-enroll.pl | 9 ++++-- .../prog/en/modules/clubs/patron-clubs-tab.tt | 7 +++-- .../prog/en/modules/clubs/patron-enroll.tt | 29 +++++++++++++++++-- opac/svc/club/enroll | 2 +- svc/club/enroll | 29 +++++++++++++++++-- 5 files changed, 66 insertions(+), 10 deletions(-) diff --git a/clubs/patron-enroll.pl b/clubs/patron-enroll.pl index 367b3c0f4b..b0f66bdb08 100755 --- a/clubs/patron-enroll.pl +++ b/clubs/patron-enroll.pl @@ -24,6 +24,7 @@ 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; @@ -38,12 +39,16 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( my $id = $cgi->param('id'); my $borrowernumber = $cgi->param('borrowernumber'); +my $enrollent_id = scalar $cgi->param('enrollent_id'); my $club = Koha::Clubs->find($id); +my @club_enrollment_fields = Koha::Club::Enrollment::Fields->search({'club_enrollment_id'=> $enrollent_id})->as_list; $template->param( - club => $club, - borrowernumber => $borrowernumber, + club => $club, + borrowernumber => $borrowernumber, + enrollent_id => $enrollent_id || 0, + club_enrollment_fields => \@club_enrollment_fields, ); output_html_with_http_headers( $cgi, $cookie, $template->output ); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/patron-clubs-tab.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/patron-clubs-tab.tt index ddfe228327..325f2bfa38 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/patron-clubs-tab.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/patron-clubs-tab.tt @@ -21,6 +21,9 @@ [% e.date_enrolled | $KohaDates %] [% IF CAN_user_clubs_enroll %] + @@ -72,9 +75,9 @@ $("#table_clubnoenrollmemnts, #table_clubenrollments").dataTable($.extend(true, })); [% IF CAN_user_clubs_enroll %] -function loadEnrollmentForm( id ) { +function loadEnrollmentForm( id, enrollent_id = 0 ) { $("body").css("cursor", "progress"); - $('#clubs-tab').load('/cgi-bin/koha/clubs/patron-enroll.pl?borrowernumber=[% borrowernumber | html %]&id=' + id, function() { + $('#clubs-tab').load('/cgi-bin/koha/clubs/patron-enroll.pl?borrowernumber=[% borrowernumber | html %]&id=' + id +'&enrollent_id='+ enrollent_id, function() { $("body").css("cursor", "default"); }); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/patron-enroll.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/patron-enroll.tt index 13f209ba46..49608155cf 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/patron-enroll.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/patron-enroll.tt @@ -1,7 +1,7 @@ [% USE AuthorisedValues %] [% SET AuthorisedValuesCategories = AuthorisedValues.GetCategories %] -

+

Enroll in [% club.name | html %]

@@ -9,8 +9,30 @@
+
    + [% IF club_enrollment_fields %] + [% FOREACH f IN club.club_template.club_template_enrollment_fields %] + [% FOREACH c IN club_enrollment_fields %] + [% IF f.id == c.club_template_enrollment_field_id %] +
  1. + + [% IF f.authorised_value_category %] + + [% ELSE %] + + [% END %] + [% f.description %] +
  2. + [% END %] + [% END %] + [% END %] + [% ELSE %] [% FOREACH f IN club.club_template.club_template_enrollment_fields %]
  3. @@ -26,7 +48,7 @@ [% f.description | html %]
  4. [% END %] - + [% END %]
  5. Finish enrollment Cancel @@ -37,6 +59,9 @@