From 542b204a7d0ca793087ef4e83510f8a4fe80d85c Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Wed, 4 Jun 2025 10:16:46 +0100 Subject: [PATCH] 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 Amended-by: Jonathan Druart Remove import of GetBudget Signed-off-by: Jonathan Druart --- acqui/booksellers.pl | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/acqui/booksellers.pl b/acqui/booksellers.pl index e4bcbaeaada..3efb73095c6 100755 --- a/acqui/booksellers.pl +++ b/acqui/booksellers.pl @@ -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; -- 2.34.1