Bug 22724: Check permissions in the script before displaying template

Signed-off-by: Liz Rea <wizzyrea@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 3034c02826)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Nick Clemens 2019-05-16 10:54:03 +00:00 committed by Martin Renvoize
parent 776151fdf3
commit 2e705d3680
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
1 changed files with 9 additions and 8 deletions

View File

@ -37,7 +37,10 @@ use Koha::Token;
my $input = CGI->new();
my $updatecharges_permissions = $input->param('writeoff_individual') ? 'writeoff' : 'remaining_permissions';
my $writeoff_individual = $input->param('writeoff_individual');
my $type = scalar $input->param('type') || 'payment';
my $updatecharges_permissions = ($writeoff_individual || $type eq 'writeoff') ? 'writeoff' : 'remaining_permissions';
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{ template_name => 'members/paycollect.tt',
query => $input,
@ -63,19 +66,17 @@ my $total_due = $patron->account->outstanding_debits->total_outstanding;
my $total_paid = $input->param('paid');
my $individual = $input->param('pay_individual');
my $writeoff = $input->param('writeoff_individual');
my $select_lines = $input->param('selected');
my $pay_individual = $input->param('pay_individual');
my $select = $input->param('selected_accts');
my $payment_note = uri_unescape scalar $input->param('payment_note');
my $payment_type = scalar $input->param('payment_type');
my $type = scalar $input->param('type') || 'payment',
my $accountlines_id;
if ( $individual || $writeoff ) {
if ($individual) {
if ( $pay_individual || $writeoff_individual ) {
if ($pay_individual) {
$template->param( pay_individual => 1 );
} elsif ($writeoff) {
} elsif ($writeoff_individual) {
$template->param( writeoff_individual => 1 );
}
my $accounttype = $input->param('accounttype');
@ -118,7 +119,7 @@ if ( $total_paid and $total_paid ne '0.00' ) {
token => scalar $input->param('csrf_token'),
});
if ($individual) {
if ($pay_individual) {
my $line = Koha::Account::Lines->find($accountlines_id);
Koha::Account->new( { patron_id => $borrowernumber } )->pay(
{