Bug 40066: Restore budget check to booksellers.pl

Test plan:
1) Navigate to a vendor record and select the baskets view from the left menu
2) Click "add to basket" in the table
3) A modal will display requiring the user to define a budget and fund
4) Apply patch and restart_all
5) Repeat steps 1 and 2
6) You will get the modal to add to the basket

Signed-off-by: David Nind <david@davidnind.com>

Amended-by: Jonathan Druart
Remove import of GetBudget

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Matt Blenkinsop 2025-06-04 10:16:46 +01:00 committed by Lucas Gass
parent 53a9631335
commit 3293ae32bc
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
1 changed files with 11 additions and 0 deletions

View File

@ -45,6 +45,7 @@ use C4::Output qw( output_html_with_http_headers );
use CGI qw ( -utf8 );
use C4::Acquisition qw( GetBasket GetBasketsInfosByBookseller CanUserManageBasket GetBasketgroup );
use C4::Budgets qw( GetBudgetHierarchy CanUserUseBudget );
use Koha::Acquisition::Booksellers;
use Koha::Patrons;
@ -110,12 +111,22 @@ if ($booksellerid) {
basketcount => $vendor->baskets->count,
subscriptioncount => $vendor->subscriptions->count,
};
}
my $budgets = GetBudgetHierarchy;
my $has_budgets = 0;
foreach my $r ( @{$budgets} ) {
next unless ( CanUserUseBudget( $loggedinuser, $r, $userflags ) );
$has_budgets = 1;
last;
}
$template->param(
loop_suppliers => $loop_suppliers,
booksellerid => $booksellerid,
count => $vendor ? 1 : 0,
has_budgets => $has_budgets,
);
$template->{VARS}->{'allbaskets'} = $allbaskets;