Lines 132-137
my ( $template, $borrowernumber, $cookie, $userflags ) = get_template_and_user(
Link Here
|
132 |
$borrowernumber = $input->param('borrowernumber') if ( $input->param('borrowernumber') ); |
132 |
$borrowernumber = $input->param('borrowernumber') if ( $input->param('borrowernumber') ); |
133 |
$template->param('borrowernumber' => $borrowernumber); |
133 |
$template->param('borrowernumber' => $borrowernumber); |
134 |
my $branchfilter = $input->param('branchcode') || C4::Context->userenv->{'branch'}; |
134 |
my $branchfilter = $input->param('branchcode') || C4::Context->userenv->{'branch'}; |
|
|
135 |
my $loggedinborrower = Koha::Patrons->find($borrowernumber)->unblessed; |
135 |
|
136 |
|
136 |
######################################### |
137 |
######################################### |
137 |
## Operations |
138 |
## Operations |
Lines 472-507
my $patron_reason_loop = GetAuthorisedValues("OPAC_SUG");
Link Here
|
472 |
$template->param(patron_reason_loop=>$patron_reason_loop); |
473 |
$template->param(patron_reason_loop=>$patron_reason_loop); |
473 |
|
474 |
|
474 |
# Budgets for filtering |
475 |
# Budgets for filtering |
475 |
my $budgets = GetBudgets; |
476 |
unless ( $op eq 'save' || $op eq 'show' ) { |
476 |
my @budgets_loop; |
477 |
my $budgets = GetBudgets; |
477 |
foreach my $budget ( @{$budgets} ) { |
478 |
my @budgets_loop; |
478 |
next unless (CanUserUseBudget($borrowernumber, $budget, $userflags)); |
479 |
foreach my $budget ( @{$budgets} ) { |
479 |
|
480 |
next unless ( CanUserUseBudget( $loggedinborrower, $budget, $userflags ) ); |
480 |
## Please see file perltidy.ERR |
481 |
|
481 |
$budget->{'selected'} = 1 |
482 |
## Please see file perltidy.ERR |
482 |
if ($$suggestion_ref{'budgetid'} |
483 |
$budget->{'selected'} = 1 |
483 |
&& $budget->{'budget_id'} eq $$suggestion_ref{'budgetid'}); |
484 |
if ( $$suggestion_ref{'budgetid'} |
484 |
|
485 |
&& $budget->{'budget_id'} eq $$suggestion_ref{'budgetid'} ); |
485 |
push @budgets_loop, $budget; |
486 |
|
|
|
487 |
push @budgets_loop, $budget; |
488 |
} |
489 |
$template->param( budgetsloop => \@budgets_loop ); |
486 |
} |
490 |
} |
487 |
$template->param( budgetsloop => \@budgets_loop); |
|
|
488 |
|
491 |
|
489 |
# Budgets for suggestion add or edition |
492 |
# Budgets for suggestion add or edition |
490 |
my $sugg_budget_loop = []; |
493 |
if ( $op eq 'save' ) { |
491 |
my $sugg_budgets = GetBudgetHierarchy(); |
494 |
my $sugg_budget_loop = []; |
492 |
foreach my $r ( @{$sugg_budgets} ) { |
495 |
my $sugg_budgets = GetBudgetHierarchy(); |
493 |
next unless ( CanUserUseBudget( $borrowernumber, $r, $userflags ) ); |
496 |
foreach my $r ( @{$sugg_budgets} ) { |
494 |
my $selected = ( $$suggestion_ref{budgetid} && $r->{budget_id} eq $$suggestion_ref{budgetid} ) ? 1 : 0; |
497 |
next unless ( CanUserUseBudget( $loggedinborrower, $r, $userflags ) ); |
495 |
push @{$sugg_budget_loop}, |
498 |
my $selected = ( $$suggestion_ref{budgetid} && $r->{budget_id} eq $$suggestion_ref{budgetid} ) ? 1 : 0; |
496 |
{ |
499 |
push @{$sugg_budget_loop}, |
497 |
b_id => $r->{budget_id}, |
500 |
{ |
498 |
b_txt => $r->{budget_name}, |
501 |
b_id => $r->{budget_id}, |
499 |
b_active => $r->{budget_period_active}, |
502 |
b_txt => $r->{budget_name}, |
500 |
selected => $selected, |
503 |
b_active => $r->{budget_period_active}, |
501 |
}; |
504 |
selected => $selected, |
|
|
505 |
}; |
506 |
} |
507 |
@{$sugg_budget_loop} = sort { uc( $a->{b_txt} ) cmp uc( $b->{b_txt} ) } @{$sugg_budget_loop}; |
508 |
$template->param( sugg_budgets => $sugg_budget_loop ); |
502 |
} |
509 |
} |
503 |
@{$sugg_budget_loop} = sort { uc( $a->{b_txt} ) cmp uc( $b->{b_txt} ) } @{$sugg_budget_loop}; |
|
|
504 |
$template->param( sugg_budgets => $sugg_budget_loop); |
505 |
|
510 |
|
506 |
if( $suggestion_ref->{STATUS} ) { |
511 |
if( $suggestion_ref->{STATUS} ) { |
507 |
$template->param( |
512 |
$template->param( |
508 |
- |
|
|