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