[Koha-patches] [PATCH] Bug 7871: prevents crash when suggestion linked to erased budget

Adrien Saurat adrien.saurat at biblibre.com
Tue Apr 3 09:57:43 CEST 2012


---
 suggestion/suggestion.pl |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/suggestion/suggestion.pl b/suggestion/suggestion.pl
index 7f197d8..f7c50b5 100755
--- a/suggestion/suggestion.pl
+++ b/suggestion/suggestion.pl
@@ -205,7 +205,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 $bud = GetBudget( $suggestion->{budgetid} );
+                $suggestion->{budget_name} = $bud->{budget_name} if $bud;
+            }
             foreach my $date qw(suggesteddate manageddate accepteddate) {
                 if ($suggestion->{$date} and $suggestion->{$date} ne "0000-00-00" && $suggestion->{$date} ne "" ) {
                     $suggestion->{$date} = format_date( $suggestion->{$date} );
-- 
1.7.4.1



More information about the Koha-patches mailing list