[Koha-patches] [PATCH][SIGNED-OFF] Corrects an error when showing a suggestion linked to a deleted budget.

paul.poulain at biblibre.com paul.poulain at biblibre.com
Mon Apr 4 13:59:33 CEST 2011


From: Frédérick Capovilla <frederick.capovilla at sys-tech.net>

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 at biblibre.com>
---
 suggestion/suggestion.pl |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/suggestion/suggestion.pl b/suggestion/suggestion.pl
index 44d65ed..cb8c5f9 100755
--- a/suggestion/suggestion.pl
+++ b/suggestion/suggestion.pl
@@ -184,7 +184,10 @@ if ($op=~/else/) {
     
         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}) ;
-- 
1.7.1



More information about the Koha-patches mailing list