Lines 1-5
Link Here
|
1 |
use Modern::Perl; |
1 |
use Modern::Perl; |
2 |
use Test::More tests => 31; |
2 |
use Test::More tests => 33; |
3 |
|
3 |
|
4 |
BEGIN {use_ok('C4::Budgets') } |
4 |
BEGIN {use_ok('C4::Budgets') } |
5 |
use C4::Context; |
5 |
use C4::Context; |
Lines 350-355
is( $budget_period->{budget_period_active}, 1,
Link Here
|
350 |
'CloneBudgetPeriod does not mark as inactive the budgetperiod if not needed' |
350 |
'CloneBudgetPeriod does not mark as inactive the budgetperiod if not needed' |
351 |
); |
351 |
); |
352 |
|
352 |
|
|
|
353 |
$budget_hierarchy_cloned = GetBudgetHierarchy($budget_period_id_cloned); |
354 |
my $number_of_budgets_not_reset = 0; |
355 |
for my $budget (@$budget_hierarchy_cloned) { |
356 |
$number_of_budgets_not_reset++ if $budget->{budget_amount} > 0; |
357 |
} |
358 |
is( $number_of_budgets_not_reset, 5, |
359 |
'CloneBudgetPeriod does not reset budgets (funds) if not needed' ); |
360 |
|
353 |
$budget_period_id_cloned = C4::Budgets::CloneBudgetPeriod( |
361 |
$budget_period_id_cloned = C4::Budgets::CloneBudgetPeriod( |
354 |
{ |
362 |
{ |
355 |
budget_period_id => $budget_period_id, |
363 |
budget_period_id => $budget_period_id, |
Lines 375-380
is( $budget_period->{budget_period_active}, 0,
Link Here
|
375 |
'CloneBudgetPeriod (with inactive param) marks as inactive the budgetperiod' |
383 |
'CloneBudgetPeriod (with inactive param) marks as inactive the budgetperiod' |
376 |
); |
384 |
); |
377 |
|
385 |
|
|
|
386 |
# CloneBudgetPeriod with param reset_all_budgets |
387 |
$budget_period_id_cloned = C4::Budgets::CloneBudgetPeriod( |
388 |
{ |
389 |
budget_period_id => $budget_period_id, |
390 |
budget_period_startdate => '2014-01-01', |
391 |
budget_period_enddate => '2014-12-31', |
392 |
reset_all_budgets => 1, |
393 |
} |
394 |
); |
395 |
|
396 |
$budget_hierarchy_cloned = GetBudgetHierarchy($budget_period_id_cloned); |
397 |
$number_of_budgets_not_reset = 0; |
398 |
for my $budget (@$budget_hierarchy_cloned) { |
399 |
$number_of_budgets_not_reset++ if $budget->{budget_amount} > 0; |
400 |
} |
401 |
is( $number_of_budgets_not_reset, 0, |
402 |
'CloneBudgetPeriod has reset all budgets (funds)' ); |
403 |
|
404 |
|
378 |
sub _get_dependencies { |
405 |
sub _get_dependencies { |
379 |
my ($budget_hierarchy) = @_; |
406 |
my ($budget_hierarchy) = @_; |
380 |
my $graph; |
407 |
my $graph; |
381 |
- |
|
|