Bugzilla – Attachment 77541 Details for
Bug 15408
Timestamp on funds not updated when you duplicate a budget
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15408: Remove fund's timestamp when cloning a budget
Bug-15408-Remove-funds-timestamp-when-cloning-a-bu.patch (text/plain), 2.66 KB, created by
Jonathan Druart
on 2018-08-07 19:10:12 UTC
(
hide
)
Description:
Bug 15408: Remove fund's timestamp when cloning a budget
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2018-08-07 19:10:12 UTC
Size:
2.66 KB
patch
obsolete
>From ddd517607c1f5a88d1e1b219eecb5d396545b961 Mon Sep 17 00:00:00 2001 >From: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com> >Date: Fri, 3 Feb 2017 15:22:36 +0000 >Subject: [PATCH] Bug 15408: Remove fund's timestamp when cloning a budget > >To duplicate the budget, the function CloneBudgetHierarchy create a new budget >from the old without the parameter timestamp, so that the database generates a >new one. > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> > >Added unit tests to patch > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> > >Modified to run properly the QA tests > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > C4/Budgets.pm | 1 + > t/db_dependent/Budgets.t | 13 ++++++++++++- > 2 files changed, 13 insertions(+), 1 deletion(-) > >diff --git a/C4/Budgets.pm b/C4/Budgets.pm >index e0b7dc1ee3..caacd7cd9c 100644 >--- a/C4/Budgets.pm >+++ b/C4/Budgets.pm >@@ -1221,6 +1221,7 @@ sub CloneBudgetHierarchy { > my $tidy_budget = > { map { join( ' ', @columns ) =~ /$_/ ? ( $_ => $budget->{$_} ) : () } > keys %$budget }; >+ delete $tidy_budget->{timestamp}; > my $new_budget_id = AddBudget( > { > %$tidy_budget, >diff --git a/t/db_dependent/Budgets.t b/t/db_dependent/Budgets.t >index e28e20cb45..32e077d6e0 100755 >--- a/t/db_dependent/Budgets.t >+++ b/t/db_dependent/Budgets.t >@@ -1,6 +1,6 @@ > #!/usr/bin/perl > use Modern::Perl; >-use Test::More tests => 145; >+use Test::More tests => 146; > > BEGIN { > use_ok('C4::Budgets') >@@ -14,6 +14,7 @@ use Koha::Acquisition::Orders; > use Koha::Patrons; > > use t::lib::TestBuilder; >+use Koha::DateUtils; > > use YAML; > >@@ -488,6 +489,16 @@ my $budget_period_id_cloned = C4::Budgets::CloneBudgetPeriod( > my $budget_period_cloned = C4::Budgets::GetBudgetPeriod($budget_period_id_cloned); > is($budget_period_cloned->{budget_period_description}, 'Budget Period Cloned', 'Cloned budget\'s description is updated.'); > >+my $budget_cloned = C4::Budgets::GetBudgets({ budget_period_id => $budget_period_id_cloned }); >+my $test = $budget_cloned->[0]->{timestamp}; >+my $budget_time = Koha::DateUtils::dt_from_string($test); >+my $local_time = Koha::DateUtils::dt_from_string(); >+ >+ >+is(DateTime::compare($budget_time, $local_time), 0, "New budget got the right timestamp"); >+ >+ >+ > my $budget_hierarchy = GetBudgetHierarchy($budget_period_id); > my $budget_hierarchy_cloned = GetBudgetHierarchy($budget_period_id_cloned); > >-- >2.11.0
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 15408
:
59886
|
59887
|
59890
|
59974
|
60244
|
60337
|
60338
|
60339
|
62985
|
62986
|
62987
|
65181
|
65182
|
65183
|
77524
|
77525
|
77526
|
77527
|
77539
|
77540
| 77541 |
77542