Bugzilla – Attachment 30562 Details for
Bug 7498
Cloning a budget: enable change of description
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
This file builds on the work done for Bug 12164
Bug-7498-Cloning-a-budget-enable-change-of-description.patch (text/plain), 6.00 KB, created by
Charles Farmer
on 2014-08-06 21:12:39 UTC
(
hide
)
Description:
This file builds on the work done for Bug 12164
Filename:
MIME Type:
Creator:
Charles Farmer
Created:
2014-08-06 21:12:39 UTC
Size:
6.00 KB
patch
obsolete
>From 859faf713d40b1983e1d634458fa043c2a95218b Mon Sep 17 00:00:00 2001 >From: charles <charles@inlibro.com> >Date: Wed, 6 Aug 2014 16:44:19 -0400 >Subject: [PATCH] Bug 7498 - Cloning a budget, enable change of description > >Patch sponsored by the CCSR ( http://www.ccsr.qc.ca ) > >This new patch builds on the work of Bug 12164 by allowing the user to enter a new name (budget_period_description) for the cloned budget. > >A test was added to t/db_dependent/Budgets.t. >--- > C4/Budgets.pm | 14 ++++++++------ > admin/aqbudgetperiods.pl | 4 ++++ > .../prog/en/modules/admin/aqbudgetperiods.tt | 10 +++++++++- > t/db_dependent/Budgets.t | 6 +++++- > 4 files changed, 26 insertions(+), 8 deletions(-) > >diff --git a/C4/Budgets.pm b/C4/Budgets.pm >index e0e8f72..1a7f7e4 100644 >--- a/C4/Budgets.pm >+++ b/C4/Budgets.pm >@@ -1029,18 +1029,20 @@ amounts will be reset. > =cut > > sub CloneBudgetPeriod { >- my ($params) = @_; >- my $budget_period_id = $params->{budget_period_id}; >- my $budget_period_startdate = $params->{budget_period_startdate}; >- my $budget_period_enddate = $params->{budget_period_enddate}; >+ my ($params) = @_; >+ my $budget_period_id = $params->{budget_period_id}; >+ my $budget_period_startdate = $params->{budget_period_startdate}; >+ my $budget_period_enddate = $params->{budget_period_enddate}; >+ my $budget_period_description = $params->{budget_period_description}; > my $mark_original_budget_as_inactive = > $params->{mark_original_budget_as_inactive} || 0; > my $reset_all_budgets = $params->{reset_all_budgets} || 0; > > my $budget_period = GetBudgetPeriod($budget_period_id); > >- $budget_period->{budget_period_startdate} = $budget_period_startdate; >- $budget_period->{budget_period_enddate} = $budget_period_enddate; >+ $budget_period->{budget_period_startdate} = $budget_period_startdate; >+ $budget_period->{budget_period_enddate} = $budget_period_enddate; >+ $budget_period->{budget_period_description} = $budget_period_description; > # The new budget (budget_period) should be active by default > $budget_period->{budget_period_active} = 1; > my $original_budget_period_id = $budget_period->{budget_period_id}; >diff --git a/admin/aqbudgetperiods.pl b/admin/aqbudgetperiods.pl >index 808f9cb..d92ce37 100755 >--- a/admin/aqbudgetperiods.pl >+++ b/admin/aqbudgetperiods.pl >@@ -177,9 +177,11 @@ elsif ( $op eq 'delete_confirmed' ) { > > # display the form for duplicating > elsif ( $op eq 'duplicate_form'){ >+ my $budgetperiod = GetBudgetPeriod($budget_period_id, $input); > $template->param( > 'duplicate_form' => '1', > 'budget_period_id' => $budget_period_id, >+ 'budgetperiod' => $budgetperiod, > ); > } > >@@ -189,6 +191,7 @@ elsif ( $op eq 'duplicate_budget' ){ > > my $budget_period_startdate = dt_from_string $input->param('budget_period_startdate'); > my $budget_period_enddate = dt_from_string $input->param('budget_period_enddate'); >+ my $budget_period_description = $input->param('budget_period_description'); > my $mark_original_budget_as_inactive = $input->param('mark_original_budget_as_inactive'); > my $reset_all_budgets = $input->param('reset_all_budgets'); > >@@ -197,6 +200,7 @@ elsif ( $op eq 'duplicate_budget' ){ > budget_period_id => $budget_period_id, > budget_period_startdate => $budget_period_startdate, > budget_period_enddate => $budget_period_enddate, >+ budget_period_description => $budget_period_description, > mark_original_budget_as_inactive => $mark_original_budget_as_inactive, > reset_all_budgets => $reset_all_budgets, > } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt >index 31139ab..0b0648a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt >@@ -27,7 +27,10 @@ > if( f.budget_period_startdate > f.budget_period_enddate ) { > _alertString += "\n- " + _("Start date must be before end date"); > } >- >+ if (!(isNotNull(f.budget_period_description,1))){ >+ _alertString += "\n- " + _("Budget description missing"); >+ } >+ > if(_alertString.length==0){ > f.submit(); > } else { >@@ -262,6 +265,11 @@ > <input type="text" size="10" id="to" name="budget_period_enddate" value="[% budget_period_enddate | $KohaDates %]" class="datepickerto" /> > <div class="hint">[% INCLUDE 'date-format.inc' %]</div> > </li> >+ >+ <li> >+ <label class="required" for="budget_period_description">Description</label> >+ <input type="text" id="budget_period_description" name="budget_period_description" value="[% budgetperiod.budget_period_description %]" /> >+ </li> > > <li> > <label for="mark_as_inactive">Mark the original budget as inactive</label> >diff --git a/t/db_dependent/Budgets.t b/t/db_dependent/Budgets.t >index a565c8d..1584436 100755 >--- a/t/db_dependent/Budgets.t >+++ b/t/db_dependent/Budgets.t >@@ -1,5 +1,5 @@ > use Modern::Perl; >-use Test::More tests => 107; >+use Test::More tests => 108; > > BEGIN { > use_ok('C4::Budgets') >@@ -367,9 +367,13 @@ my $budget_period_id_cloned = C4::Budgets::CloneBudgetPeriod( > budget_period_id => $budget_period_id, > budget_period_startdate => '2014-01-01', > budget_period_enddate => '2014-12-31', >+ budget_period_description => 'Budget Period Cloned', > } > ); > >+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_hierarchy = GetBudgetHierarchy($budget_period_id); > my $budget_hierarchy_cloned = GetBudgetHierarchy($budget_period_id_cloned); > >-- >1.7.9.5 >
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 7498
:
17871
|
18341
|
18816
|
18817
|
29614
|
30562
|
30785
|
30827