From 2344fd74c450e0c65a6803c4b1bcaa76facb120f 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 --- .../prog/en/modules/circ/circulation_batch_checkouts.tt | 13 +++++++++++++ .../intranet-tmpl/prog/en/modules/members/deletemem.tt | 11 +++++++++++ .../intranet-tmpl/prog/en/modules/members/housebound.tt | 13 ++++++++++++- koha-tmpl/intranet-tmpl/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 d45cb3d..44ad27b 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 4d39a1b..a37cd5c 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 696760d..e28d35c 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 81e940f..7053532 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 1da27fc..bc0c924 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 7927eae..2e38c0d 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 574bacd..69bdc1a 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 f307393..765b402 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 2e3087e..0b02e03 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.1.4