From a277da701d8250907afa5ed69447236a78f65ad8 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Wed, 23 May 2018 12:43:55 +0000 Subject: [PATCH] Bug 20805: Update child to adult patron process broken on several patron-related pages This patch fixes a problem with several patron-related pages, where the "Update child to adult patron" menu item doesn't work. With some pages, the right category information wasn't being passed from the script to the template. With some, the right JavaScript variable weren't being passed from the template to the included JavaScript file. To test, apply the patch locate some patrons with "child" type patron categories. With each patron, go to one of the following pages and test the "update child" process in the toolbar's "More" menu. - Circulation -> - Batch check out - Notices - Statistics - Files - Housebound - Delete (test from the deletion confirmation screen). All test should be performed on a system with multiple adult patron categories configured AND on a system with only a single adult patron category. Signed-off-by: Katrin Fischer Signed-off-by: Marcel de Rooy Signed-off-by: Nick Clemens Signed-off-by: Martin Renvoize --- .../en/modules/circ/circulation_batch_checkouts.tt | 13 +++++++++++++ .../prog/en/modules/members/deletemem.tt | 11 +++++++++++ .../prog/en/modules/members/housebound.tt | 13 ++++++++++++- .../prog/en/modules/members/notices.tt | 13 ++++++++++++- members/deletemem.pl | 7 +++++++ members/files.pl | 7 +++++++ members/housebound.pl | 6 ++++++ members/notices.pl | 10 ++++++++-- members/statistics.pl | 7 +++++++ 9 files changed, 83 insertions(+), 4 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt index d45cb3d224..44ad27b0d0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt @@ -292,7 +292,19 @@ [% MACRO jsinclude BLOCK %] [% INCLUDE 'calendar.inc' %] [% INCLUDE 'datatables.inc' %] + [% Asset.js("lib/jquery/plugins/jquery-ui-timepicker-addon.min.js") %] + [% Asset.js("js/members-menu.js") %] [% END %] [% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/deletemem.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/deletemem.tt index 4d39a1bcf7..a37cd5c1a3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/deletemem.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/deletemem.tt @@ -64,6 +64,17 @@ [% MACRO jsinclude BLOCK %] [% Asset.js("js/members-menu.js") %] + [% END %] [% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/housebound.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/housebound.tt index 696760d01e..e28d35c689 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/housebound.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/housebound.tt @@ -427,14 +427,25 @@ [% MACRO jsinclude BLOCK %] [% INCLUDE 'calendar.inc' %] - [% Asset.js("js/members-menu.js") %] + [% Asset.js("js/members-menu.js") %] [% END %] [% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt index 81e940fb93..7053532beb 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt @@ -90,9 +90,19 @@ [% MACRO jsinclude BLOCK %] - [% Asset.js("js/members-menu.js") %] [% INCLUDE 'datatables.inc' %] + [% Asset.js("js/members-menu.js") %] [% END %] [% INCLUDE 'intranet-bottom.inc' %] diff --git a/members/deletemem.pl b/members/deletemem.pl index 1da27fc1df..bc0c92441b 100755 --- a/members/deletemem.pl +++ b/members/deletemem.pl @@ -31,6 +31,7 @@ use C4::Members; use Module::Load; use Koha::Patrons; use Koha::Token; +use Koha::Patron::Categories; if ( C4::Context->preference('NorwegianPatronDBEnable') && C4::Context->preference('NorwegianPatronDBEnable') == 1 ) { load Koha::NorwegianPatronDB, qw( NLMarkForDeletion NLSync ); @@ -100,6 +101,12 @@ if (C4::Context->preference("IndependentBranches")) { } } +if ( $patron->is_child ) { + my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']}); + $template->param( 'CATCODE_MULTI' => 1) if $patron_categories->count > 1; + $template->param( 'catcode' => $patron_categories->next->categorycode ) if $patron_categories->count == 1; +} + my $op = $input->param('op') || 'delete_confirm'; my $dbh = C4::Context->dbh; my $is_guarantor = $dbh->selectrow_array("SELECT COUNT(*) FROM borrowers WHERE guarantorid=?", undef, $member); diff --git a/members/files.pl b/members/files.pl index 7927eae1bf..2e38c0df00 100755 --- a/members/files.pl +++ b/members/files.pl @@ -30,6 +30,7 @@ use C4::Debug; use Koha::DateUtils; use Koha::Patrons; use Koha::Patron::Files; +use Koha::Patron::Categories; my $cgi = CGI->new; @@ -114,6 +115,12 @@ else { ); } + if ( $patron->is_child ) { + my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']}); + $template->param( 'CATCODE_MULTI' => 1) if $patron_categories->count > 1; + $template->param( 'catcode' => $patron_categories->next->categorycode ) if $patron_categories->count == 1; + } + $template->param( files => Koha::Patron::Files->new( borrowernumber => $borrowernumber ) ->GetFilesInfo(), diff --git a/members/housebound.pl b/members/housebound.pl index 574bacdbb1..69bdc1acaf 100755 --- a/members/housebound.pl +++ b/members/housebound.pl @@ -166,6 +166,12 @@ if ( C4::Context->preference('ExtendedPatronAttributes') and $patron ) { ); } +if ( $patron->is_child ) { + my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']}); + $template->param( 'CATCODE_MULTI' => 1) if $patron_categories->count > 1; + $template->param( 'catcode' => $patron_categories->next->categorycode ) if $patron_categories->count == 1; +} + $template->param( housebound_profile => $houseboundprofile, visit => $houseboundvisit, diff --git a/members/notices.pl b/members/notices.pl index f307393b63..765b402598 100755 --- a/members/notices.pl +++ b/members/notices.pl @@ -27,6 +27,7 @@ use C4::Members; use C4::Letters; use C4::Members::Attributes qw(GetBorrowerAttributes); use Koha::Patrons; +use Koha::Patron::Categories; my $input=new CGI; @@ -39,8 +40,7 @@ unless ( $patron ) { } my $borrower = $patron->unblessed; -my ($template, $loggedinuser, $cookie) -= get_template_and_user({template_name => "members/notices.tt", +my ($template, $loggedinuser, $cookie)= get_template_and_user({template_name => "members/notices.tt", query => $input, type => "intranet", authnotrequired => 0, @@ -51,6 +51,12 @@ my ($template, $loggedinuser, $cookie) my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in"; output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } ); +if ( $patron->is_child ) { + my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']}); + $template->param( 'CATCODE_MULTI' => 1) if $patron_categories->count > 1; + $template->param( 'catcode' => $patron_categories->next->categorycode ) if $patron_categories->count == 1; +} + # Allow resending of messages in Notices tab my $op = $input->param('op') || q{}; if ( $op eq 'resend_notice' ) { diff --git a/members/statistics.pl b/members/statistics.pl index 2e3087eddd..0b02e03c61 100755 --- a/members/statistics.pl +++ b/members/statistics.pl @@ -32,6 +32,7 @@ use C4::Members::Statistics; use C4::Members::Attributes qw(GetBorrowerAttributes); use C4::Output; use Koha::Patrons; +use Koha::Patron::Categories; my $input = new CGI; @@ -84,6 +85,12 @@ if (C4::Context->preference('ExtendedPatronAttributes')) { ); } +if ( $patron->is_child ) { + my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']}); + $template->param( 'CATCODE_MULTI' => 1) if $patron_categories->count > 1; + $template->param( 'catcode' => $patron_categories->next->categorycode ) if $patron_categories->count == 1; +} + $template->param( patron => $patron, statisticsview => 1, -- 2.39.5