Bug 18906: Display all funds the logged in user can use

There are complex conditions to know if a librarian can use a fund, we
cannot do that with a SQL query, we need to use C4::Budgets::CanUserUseBudget

When this patch is applied then all funds are visible to both
superlibrarian patrons and patrons with all acq permissions

Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 19a7b498e1)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit d179da572b)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
This commit is contained in:
Jonathan Druart 2017-07-06 18:10:10 -03:00 committed by Katrin Fischer
parent fc4a184a5f
commit 65eb810850
1 changed files with 2 additions and 1 deletions

View File

@ -237,7 +237,7 @@ if ( $op eq 'list' ) {
);
my @budgets = @{
GetBudgetHierarchy( $$period{budget_period_id}, C4::Context->userenv->{branch}, ( $show_mine ? $borrower_id : 0 ))
GetBudgetHierarchy( $$period{budget_period_id}, undef, ( $show_mine ? $borrower_id : 0 ))
};
my $period_total = 0;
@ -248,6 +248,7 @@ if ( $op eq 'list' ) {
my @budgets_to_display;
foreach my $budget (@budgets) {
# PERMISSIONS
next unless CanUserUseBudget($borrowernumber, $budget, $staffflags);
unless(CanUserModifyBudget($borrowernumber, $budget, $staffflags)) {
$budget->{'budget_lock'} = 1;
}