Bug 15530 - Editing a course item via a disabled course disables it even if it is...
[koha-ffzg.git] / C4 / Budgets.pm
index d90246c..79012ba 100644 (file)
@@ -528,8 +528,8 @@ sub GetBudgetHierarchy {
 
     # link child to parent
     my @first_parents;
-    foreach ( sort keys %links ) {
-        my $child = $links{$_};
+    foreach my $budget ( sort { $a->{budget_code} cmp $b->{budget_code} } values %links ) {
+        my $child = $links{$budget->{budget_id}};
         if ( $child->{'budget_parent_id'} ) {
             my $parent = $links{ $child->{'budget_parent_id'} };
             if ($parent) {