View | Details | Raw Unified | Return to bug 7498
Collapse All | Expand All

(-)a/C4/Budgets.pm (-6 / +8 lines)
Lines 1029-1046 amounts will be reset. Link Here
1029
=cut
1029
=cut
1030
1030
1031
sub CloneBudgetPeriod {
1031
sub CloneBudgetPeriod {
1032
    my ($params)                = @_;
1032
    my ($params)                  = @_;
1033
    my $budget_period_id        = $params->{budget_period_id};
1033
    my $budget_period_id          = $params->{budget_period_id};
1034
    my $budget_period_startdate = $params->{budget_period_startdate};
1034
    my $budget_period_startdate   = $params->{budget_period_startdate};
1035
    my $budget_period_enddate   = $params->{budget_period_enddate};
1035
    my $budget_period_enddate     = $params->{budget_period_enddate};
1036
    my $budget_period_description = $params->{budget_period_description};
1036
    my $mark_original_budget_as_inactive =
1037
    my $mark_original_budget_as_inactive =
1037
      $params->{mark_original_budget_as_inactive} || 0;
1038
      $params->{mark_original_budget_as_inactive} || 0;
1038
    my $reset_all_budgets = $params->{reset_all_budgets} || 0;
1039
    my $reset_all_budgets = $params->{reset_all_budgets} || 0;
1039
1040
1040
    my $budget_period = GetBudgetPeriod($budget_period_id);
1041
    my $budget_period = GetBudgetPeriod($budget_period_id);
1041
1042
1042
    $budget_period->{budget_period_startdate} = $budget_period_startdate;
1043
    $budget_period->{budget_period_startdate}   = $budget_period_startdate;
1043
    $budget_period->{budget_period_enddate}   = $budget_period_enddate;
1044
    $budget_period->{budget_period_enddate}     = $budget_period_enddate;
1045
    $budget_period->{budget_period_description} = $budget_period_description;
1044
    # The new budget (budget_period) should be active by default
1046
    # The new budget (budget_period) should be active by default
1045
    $budget_period->{budget_period_active}    = 1;
1047
    $budget_period->{budget_period_active}    = 1;
1046
    my $original_budget_period_id = $budget_period->{budget_period_id};
1048
    my $original_budget_period_id = $budget_period->{budget_period_id};
(-)a/admin/aqbudgetperiods.pl (+4 lines)
Lines 177-185 elsif ( $op eq 'delete_confirmed' ) { Link Here
177
177
178
# display the form for duplicating
178
# display the form for duplicating
179
elsif ( $op eq 'duplicate_form'){
179
elsif ( $op eq 'duplicate_form'){
180
    my $budgetperiod = GetBudgetPeriod($budget_period_id, $input);
180
    $template->param(
181
    $template->param(
181
        'duplicate_form' => '1',
182
        'duplicate_form' => '1',
182
        'budget_period_id' => $budget_period_id,
183
        'budget_period_id' => $budget_period_id,
184
        'budgetperiod' => $budgetperiod,
183
    );
185
    );
184
}
186
}
185
187
Lines 189-194 elsif ( $op eq 'duplicate_budget' ){ Link Here
189
191
190
    my $budget_period_startdate = dt_from_string $input->param('budget_period_startdate');
192
    my $budget_period_startdate = dt_from_string $input->param('budget_period_startdate');
191
    my $budget_period_enddate   = dt_from_string $input->param('budget_period_enddate');
193
    my $budget_period_enddate   = dt_from_string $input->param('budget_period_enddate');
194
    my $budget_period_description = $input->param('budget_period_description');
192
    my $mark_original_budget_as_inactive = $input->param('mark_original_budget_as_inactive');
195
    my $mark_original_budget_as_inactive = $input->param('mark_original_budget_as_inactive');
193
    my $reset_all_budgets = $input->param('reset_all_budgets');
196
    my $reset_all_budgets = $input->param('reset_all_budgets');
194
197
Lines 197-202 elsif ( $op eq 'duplicate_budget' ){ Link Here
197
            budget_period_id        => $budget_period_id,
200
            budget_period_id        => $budget_period_id,
198
            budget_period_startdate => $budget_period_startdate,
201
            budget_period_startdate => $budget_period_startdate,
199
            budget_period_enddate   => $budget_period_enddate,
202
            budget_period_enddate   => $budget_period_enddate,
203
            budget_period_description => $budget_period_description,
200
            mark_original_budget_as_inactive => $mark_original_budget_as_inactive,
204
            mark_original_budget_as_inactive => $mark_original_budget_as_inactive,
201
            reset_all_budgets => $reset_all_budgets,
205
            reset_all_budgets => $reset_all_budgets,
202
        }
206
        }
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt (+8 lines)
Lines 27-32 Link Here
27
            if( f.budget_period_startdate > f.budget_period_enddate ) {
27
            if( f.budget_period_startdate > f.budget_period_enddate ) {
28
              _alertString += "\n- " + _("Start date must be before end date");
28
              _alertString += "\n- " + _("Start date must be before end date");
29
            }
29
            }
30
            if (!(isNotNull(f.budget_period_description,1))){
31
              _alertString += "\n- " + _("Budget description missing");
32
            }
30
33
31
            if(_alertString.length==0){
34
            if(_alertString.length==0){
32
              f.submit();
35
              f.submit();
Lines 264-269 Link Here
264
    </li>
267
    </li>
265
268
266
    <li>
269
    <li>
270
    <label class="required" for="budget_period_description">Description</label>
271
    <input type="text" id="budget_period_description" name="budget_period_description" value="[% budgetperiod.budget_period_description %]" />
272
    </li>
273
274
    <li>
267
      <label for="mark_as_inactive">Mark the original budget as inactive</label>
275
      <label for="mark_as_inactive">Mark the original budget as inactive</label>
268
      <input type="checkbox" id="mark_as_inactive" name="mark_original_budget_as_inactive" />
276
      <input type="checkbox" id="mark_as_inactive" name="mark_original_budget_as_inactive" />
269
    </li>
277
    </li>
(-)a/t/db_dependent/Budgets.t (-2 / +5 lines)
Lines 1-5 Link Here
1
use Modern::Perl;
1
use Modern::Perl;
2
use Test::More tests => 107;
2
use Test::More tests => 108;
3
3
4
BEGIN {
4
BEGIN {
5
    use_ok('C4::Budgets')
5
    use_ok('C4::Budgets')
Lines 367-375 my $budget_period_id_cloned = C4::Budgets::CloneBudgetPeriod( Link Here
367
        budget_period_id        => $budget_period_id,
367
        budget_period_id        => $budget_period_id,
368
        budget_period_startdate => '2014-01-01',
368
        budget_period_startdate => '2014-01-01',
369
        budget_period_enddate   => '2014-12-31',
369
        budget_period_enddate   => '2014-12-31',
370
        budget_period_description => 'Budget Period Cloned',
370
    }
371
    }
371
);
372
);
372
373
374
my $budget_period_cloned = C4::Budgets::GetBudgetPeriod($budget_period_id_cloned);
375
is($budget_period_cloned->{budget_period_description}, 'Budget Period Cloned', 'Cloned budget\'s description is updated.');
376
373
my $budget_hierarchy        = GetBudgetHierarchy($budget_period_id);
377
my $budget_hierarchy        = GetBudgetHierarchy($budget_period_id);
374
my $budget_hierarchy_cloned = GetBudgetHierarchy($budget_period_id_cloned);
378
my $budget_hierarchy_cloned = GetBudgetHierarchy($budget_period_id_cloned);
375
379
376
- 

Return to bug 7498