From 3326d458e1930fabc3737d1a3928d75c652757cc Mon Sep 17 00:00:00 2001 From: Aleisha Date: Tue, 23 Feb 2016 04:06:30 +0000 Subject: [PATCH] Bug 15823: Can still access patron discharge slip without having the syspref on To test: 1) Ensure syspref useDischarge is disabled 2) Go to http://localhost:8081/cgi-bin/koha/members/discharge.pl?borrowernumber=X&discharge=1 3) Validate that you are still able to generate a discharge slip for this patron 4) Apply patch and refresh page 5) Confirm that you are redirected to the circulation.pl page for the user and that an error message is there. Sponsored-by: Catalyst IT --- circ/circulation.pl | 1 + koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt | 5 ++++- members/discharge.pl | 11 +++++++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/circ/circulation.pl b/circ/circulation.pl index e6ba9a2..5e97d84 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -649,6 +649,7 @@ $template->param( canned_bor_notes_loop => $canned_notes, debarments => GetDebarments({ borrowernumber => $borrowernumber }), todaysdate => output_pref( { dt => dt_from_string()->set(hour => 23)->set(minute => 59), dateformat => 'sql' } ), + nopermission => $query->param('nopermission'), ); output_html_with_http_headers $query, $cookie, $template->output; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt index 6fd722c..8d57199 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -117,7 +117,6 @@ $(document).ready(function() { $(':radio', this).attr('checked', 'true') } }); - }); //]]> @@ -207,6 +206,10 @@ $(document).ready(function() {
The patron has unpaid charges for holds, rentals etc of [% alert.OTHER_CHARGES %]
[% END %] +[% IF ( nopermission ) %] +
Staff members are not allowed to discharge borrowers, nor borrowers to request a discharge.
+[% END %] + [% IF ( NEEDSCONFIRMATION ) %]
diff --git a/members/discharge.pl b/members/discharge.pl index 466c119..dcf9a9a 100755 --- a/members/discharge.pl +++ b/members/discharge.pl @@ -41,6 +41,7 @@ use Koha::Borrower::Discharge; use Koha::DateUtils; my $input = new CGI; + my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user({ template_name => 'members/discharge.tt', query => $input, @@ -49,7 +50,13 @@ my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user({ flagsrequired => { 'borrowers' => '*' }, }); -my $borrowernumber; +my $borrowernumber = $input->param('borrowernumber'); + +unless ( C4::Context->preference('useDischarge') ) { + print $input->redirect("/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber&nopermission=1"); + exit; +} else { + my $data; if ( $input->param('borrowernumber') ) { $borrowernumber = $input->param('borrowernumber'); @@ -131,7 +138,7 @@ if ( $input->param('borrowernumber') ) { can_be_discharged => $can_be_discharged, validated_discharges => $validated_discharges, ); -} +}} $template->param( dischargeview => 1, ); -- 1.7.10.4