Bug 4833: (QA follow-up) Add budgetname to SearchSuggestion
This patch adds the budgetname to the return of SearchSuggestion to improve performance. To test: - Same test plan as for the first patch - Verify fund names show in the table - Run t/db_dependent/Suggestions.t Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
parent
3d3944cba3
commit
f2d886c3b3
|
|
@ -109,7 +109,8 @@ sub SearchSuggestion {
|
|||
B2.branchname AS branchnamesuggestedby,
|
||||
U2.email AS emailmanagedby,
|
||||
U2.branchcode AS branchcodemanagedby,
|
||||
U2.borrowernumber AS borrnummanagedby
|
||||
U2.borrowernumber AS borrnummanagedby,
|
||||
BU.budget_name AS budget_name
|
||||
FROM suggestions
|
||||
LEFT JOIN borrowers AS U1 ON suggestedby=U1.borrowernumber
|
||||
LEFT JOIN branches AS B1 ON B1.branchcode=U1.branchcode
|
||||
|
|
@ -117,6 +118,7 @@ sub SearchSuggestion {
|
|||
LEFT JOIN borrowers AS U2 ON managedby=U2.borrowernumber
|
||||
LEFT JOIN branches AS B2 ON B2.branchcode=U2.branchcode
|
||||
LEFT JOIN categories AS C2 ON C2.categorycode=U2.categorycode
|
||||
LEFT JOIN aqbudgets AS BU ON budgetid=BU.budget_id
|
||||
WHERE 1=1
|
||||
}
|
||||
);
|
||||
|
|
|
|||
|
|
@ -138,13 +138,6 @@ my $suggestions_loop = SearchSuggestion(
|
|||
}
|
||||
);
|
||||
|
||||
foreach my $suggestion (@$suggestions_loop) {
|
||||
if ($suggestion->{budgetid}){
|
||||
my $bud = GetBudget( $suggestion->{budgetid} );
|
||||
$suggestion->{budget_name} = $bud->{budget_name} if $bud;
|
||||
}
|
||||
}
|
||||
|
||||
my $vendor = Koha::Acquisition::Booksellers->find( $booksellerid );
|
||||
$template->param(
|
||||
suggestions_loop => $suggestions_loop,
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
use Modern::Perl;
|
||||
|
||||
use DateTime::Duration;
|
||||
use Test::More tests => 107;
|
||||
use Test::More tests => 109;
|
||||
use Test::Warn;
|
||||
|
||||
use t::lib::Mocks;
|
||||
|
|
@ -26,7 +26,7 @@ use t::lib::TestBuilder;
|
|||
|
||||
use C4::Context;
|
||||
use C4::Letters;
|
||||
use C4::Budgets qw( AddBudgetPeriod AddBudget );
|
||||
use C4::Budgets qw( AddBudgetPeriod AddBudget GetBudget );
|
||||
use Koha::Database;
|
||||
use Koha::DateUtils qw( dt_from_string output_pref );
|
||||
use Koha::Libraries;
|
||||
|
|
@ -369,6 +369,12 @@ $search_suggestion = SearchSuggestion({
|
|||
});
|
||||
is( @$search_suggestion, 3, 'SearchSuggestion (budgetid = "__ANY__") returns the correct number of suggestions' );
|
||||
|
||||
$search_suggestion = SearchSuggestion({ budgetid => $budget_id });
|
||||
is( @$search_suggestion[0]->{budget_name}, GetBudget($budget_id)->{budget_name}, 'SearchSuggestion returns the correct budget name');
|
||||
$search_suggestion = SearchSuggestion({ budgetid => "__NONE__" });
|
||||
is( @$search_suggestion[0]->{budget_name}, undef, 'SearchSuggestion returns the correct budget name');
|
||||
|
||||
|
||||
my $del_suggestion = {
|
||||
title => 'my deleted title',
|
||||
STATUS => 'CHECKED',
|
||||
|
|
|
|||
Loading…
Reference in New Issue