If a suggestion is associated to a budget that was deleted, an error was
returned because we try to get the name of a budget that doesn't exist.
With this fix, the page is shown without errors.
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
my $suggestions = &SearchSuggestion($suggestion_ref);
foreach my $suggestion (@$suggestions){
- $suggestion->{budget_name}=GetBudget($suggestion->{budgetid})->{budget_name} if $suggestion->{budgetid};
+ if($suggestion->{budgetid}) {
+ my $budget = GetBudget($suggestion->{budgetid});
+ $suggestion->{budget_name}=$budget->{budget_name} if $budget;
+ }
foreach my $date qw(suggesteddate manageddate accepteddate){
if ($suggestion->{$date} ne "0000-00-00" && $suggestion->{$date} ne "" ){
$suggestion->{$date}=format_date($suggestion->{$date}) ;