|
Lines 7-12
use C4::Dates;
Link Here
|
| 7 |
|
7 |
|
| 8 |
use YAML; |
8 |
use YAML; |
| 9 |
|
9 |
|
|
|
10 |
# Start transaction |
| 11 |
my $dbh = C4::Context->dbh; |
| 12 |
$dbh->{AutoCommit} = 0; |
| 13 |
$dbh->{RaiseError} = 1; |
| 14 |
|
| 10 |
# |
15 |
# |
| 11 |
# Budget Periods : |
16 |
# Budget Periods : |
| 12 |
# |
17 |
# |
|
Lines 15-20
my $budgetperiod;
Link Here
|
| 15 |
my $active_period; |
20 |
my $active_period; |
| 16 |
my $mod_status; |
21 |
my $mod_status; |
| 17 |
my $del_status; |
22 |
my $del_status; |
|
|
23 |
|
| 24 |
|
| 25 |
my $orig_num_active = count_active_budget_periods(); |
| 18 |
ok($bpid=AddBudgetPeriod( |
26 |
ok($bpid=AddBudgetPeriod( |
| 19 |
{ budget_period_startdate => '2008-01-01' |
27 |
{ budget_period_startdate => '2008-01-01' |
| 20 |
, budget_period_enddate => '2008-12-31' |
28 |
, budget_period_enddate => '2008-12-31' |
|
Lines 23-33
ok($bpid=AddBudgetPeriod(
Link Here
|
| 23 |
|
31 |
|
| 24 |
ok($budgetperiod=GetBudgetPeriod($bpid), |
32 |
ok($budgetperiod=GetBudgetPeriod($bpid), |
| 25 |
"GetBudgetPeriod($bpid) returned ".Dump($budgetperiod)); |
33 |
"GetBudgetPeriod($bpid) returned ".Dump($budgetperiod)); |
| 26 |
ok(!GetBudgetPeriod(0) ,"GetBudgetPeriod(0) returned undef : noactive BudgetPeriod"); |
34 |
my $num_active = count_active_budget_periods(); |
| 27 |
$$budgetperiod{budget_period_active}=1; |
35 |
ok($num_active == $orig_num_active, 'new budget is in inactive by default'); |
|
|
36 |
$budgetperiod->{budget_period_active}=1; |
| 28 |
ok($mod_status=ModBudgetPeriod($budgetperiod),"ModBudgetPeriod OK"); |
37 |
ok($mod_status=ModBudgetPeriod($budgetperiod),"ModBudgetPeriod OK"); |
| 29 |
ok($active_period=GetBudgetPeriod(0),"GetBudgetPeriod(0) returned".Dump($active_period)); |
38 |
$num_active = count_active_budget_periods(); |
| 30 |
ok(scalar(GetBudgetPeriods())>0,"GetBudgetPeriods OK");#Should at least return the Budget inserted |
39 |
ok($num_active == ($orig_num_active + 1), 'making new budget active increased the number of active budgets by 1'); |
|
|
40 |
ok(scalar(@{ GetBudgetPeriods() }) > 0,"GetBudgetPeriods OK");#Should at least return the Budget inserted |
| 31 |
ok($del_status=DelBudgetPeriod($bpid),"DelBudgetPeriod returned $del_status"); |
41 |
ok($del_status=DelBudgetPeriod($bpid),"DelBudgetPeriod returned $del_status"); |
| 32 |
|
42 |
|
| 33 |
# |
43 |
# |
|
Lines 104-106
is($budget_name, $budget->{budget_name}, "Test the GetBudgetName routine");
Link Here
|
| 104 |
|
114 |
|
| 105 |
ok($del_status=DelBudget($budget_id), |
115 |
ok($del_status=DelBudget($budget_id), |
| 106 |
"DelBudget returned $del_status"); |
116 |
"DelBudget returned $del_status"); |
| 107 |
- |
117 |
|
|
|
118 |
sub count_active_budget_periods { |
| 119 |
my $budget_periods = GetBudgetPeriods({budget_period_active => 1}); |
| 120 |
return scalar(@$budget_periods); |
| 121 |
} |