Bugzilla – Attachment 44624 Details for
Bug 14388
add sorting to funds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 14388: Funds should be sorted by budget_code
PASSED-QA-Bug-14388-Funds-should-be-sorted-by-budg.patch (text/plain), 3.32 KB, created by
Katrin Fischer
on 2015-11-08 21:57:50 UTC
(
hide
)
Description:
[PASSED QA] Bug 14388: Funds should be sorted by budget_code
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2015-11-08 21:57:50 UTC
Size:
3.32 KB
patch
obsolete
>From e7b8f667f44ce338d4d76bbb0528a8308e37f6fa Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@koha-community.org> >Date: Thu, 2 Jul 2015 16:42:16 +0100 >Subject: [PATCH] [PASSED QA] Bug 14388: Funds should be sorted by budget_code > >Before this patch, the funds were sorted by budget_id, which does not >make any sense. > >This patch adds a sort by budget_code on the fund list (acqui/acqui-home.pl and >admin/aqbudgets.pl) > >Test plan: >On both pages (acqui/acqui-home.pl and admin/aqbudgets.pl) confirm that >the funds are now sorted by fund code (DB column budget_code) > >Signed-off-by: Nicole Engard <nengard@bywatersolutions.com> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > C4/Budgets.pm | 4 ++-- > t/db_dependent/Budgets.t | 22 +++++++++++++--------- > 2 files changed, 15 insertions(+), 11 deletions(-) > >diff --git a/C4/Budgets.pm b/C4/Budgets.pm >index d90246c..79012ba 100644 >--- a/C4/Budgets.pm >+++ b/C4/Budgets.pm >@@ -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) { >diff --git a/t/db_dependent/Budgets.t b/t/db_dependent/Budgets.t >index 522cb1c..9c34a8f 100755 >--- a/t/db_dependent/Budgets.t >+++ b/t/db_dependent/Budgets.t >@@ -1,5 +1,5 @@ > use Modern::Perl; >-use Test::More tests => 120; >+use Test::More tests => 122; > > BEGIN { > use_ok('C4::Budgets') >@@ -232,22 +232,22 @@ my $budget_id2 = AddBudget( > budget_amount => $budget_2_total, > } > ); >-my $budget_id11 = AddBudget( >+my $budget_id12 = AddBudget( > { >- budget_code => 'budget_11', >- budget_name => 'budget_11', >+ budget_code => 'budget_12', >+ budget_name => 'budget_12', > budget_period_id => $budget_period_id, > budget_parent_id => $budget_id1, >- budget_amount => $budget_11_total, >+ budget_amount => $budget_12_total, > } > ); >-my $budget_id12 = AddBudget( >+my $budget_id11 = AddBudget( > { >- budget_code => 'budget_12', >- budget_name => 'budget_12', >+ budget_code => 'budget_11', >+ budget_name => 'budget_11', > budget_period_id => $budget_period_id, > budget_parent_id => $budget_id1, >- budget_amount => $budget_12_total, >+ budget_amount => $budget_11_total, > } > ); > my $budget_id111 = AddBudget( >@@ -431,6 +431,10 @@ $budget_period_id_cloned = C4::Budgets::CloneBudgetPeriod( > ); > > $budget_hierarchy = GetBudgetHierarchy($budget_period_id); >+is( $budget_hierarchy->[0]->{children}->[0]->{budget_name}, 'budget_11', 'GetBudgetHierarchy should return budgets ordered by name, first child is budget_11' ); >+is( $budget_hierarchy->[0]->{children}->[1]->{budget_name}, 'budget_12', 'GetBudgetHierarchy should return budgets ordered by name, second child is budget_12' ); >+ >+$budget_hierarchy = GetBudgetHierarchy($budget_period_id); > $budget_hierarchy_cloned = GetBudgetHierarchy($budget_period_id_cloned); > > is( scalar(@$budget_hierarchy_cloned), scalar(@$budget_hierarchy), >-- >1.9.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 14388
:
40765
|
40855
|
44248
|
44538
| 44624