Lines 117-123
is( AddBudget(), undef, 'AddBuget without argument returns undef' );
Link Here
|
117 |
my $budgets = GetBudgets(); |
117 |
my $budgets = GetBudgets(); |
118 |
is( @$budgets, 0, 'GetBudgets returns the correct number of budgets' ); |
118 |
is( @$budgets, 0, 'GetBudgets returns the correct number of budgets' ); |
119 |
|
119 |
|
120 |
$bpid = AddBudgetPeriod($my_budgetperiod); |
120 |
$bpid = AddBudgetPeriod($my_budgetperiod); #this is an active budget |
|
|
121 |
|
121 |
my $my_budget = { |
122 |
my $my_budget = { |
122 |
budget_code => 'ABCD', |
123 |
budget_code => 'ABCD', |
123 |
budget_amount => '123.132000', |
124 |
budget_amount => '123.132000', |
Lines 176-184
is( @$budgets, 1, 'GetBudgets With Order Getting Active budgetPeriod OK');
Link Here
|
176 |
my $budget_name = GetBudgetName( $budget_id ); |
177 |
my $budget_name = GetBudgetName( $budget_id ); |
177 |
is($budget_name, $my_budget->{budget_name}, "Test the GetBudgetName routine"); |
178 |
is($budget_name, $my_budget->{budget_name}, "Test the GetBudgetName routine"); |
178 |
|
179 |
|
|
|
180 |
my $my_inactive_budgetperiod = { #let's add an inactive |
181 |
budget_period_startdate => '2010-01-01', |
182 |
budget_period_enddate => '2010-12-31', |
183 |
budget_period_description => 'MODIF_MAPERI', |
184 |
budget_period_active => 0, |
185 |
}; |
186 |
my $bpid_i = AddBudgetPeriod($my_inactive_budgetperiod); #this is an inactive budget |
187 |
|
188 |
my $my_budget_inactive = { |
189 |
budget_code => 'EFG', |
190 |
budget_amount => '123.132000', |
191 |
budget_name => 'Periodiques', |
192 |
budget_notes => 'This is a note', |
193 |
budget_period_id => $bpid_i, |
194 |
}; |
195 |
my $budget_id_inactive = AddBudget($my_budget_inactive); |
196 |
|
179 |
my $budget_code = $my_budget->{budget_code}; |
197 |
my $budget_code = $my_budget->{budget_code}; |
180 |
my $budget_by_code = GetBudgetByCode( $budget_code ); |
198 |
my $budget_by_code = GetBudgetByCode( $budget_code ); |
181 |
is($budget_by_code->{budget_id}, $budget_id, "GetBudgetByCode, check id"); |
199 |
is($budget_by_code->{budget_id}, $budget_id, "GetBudgetByCode, check id"); #this should match the active budget, not the inactive |
182 |
is($budget_by_code->{budget_notes}, $my_budget->{budget_notes}, "GetBudgetByCode, check notes"); |
200 |
is($budget_by_code->{budget_notes}, $my_budget->{budget_notes}, "GetBudgetByCode, check notes"); |
183 |
|
201 |
|
184 |
my $second_budget_id = AddBudget({ |
202 |
my $second_budget_id = AddBudget({ |
Lines 195-201
ok( $budgets->[0]->{budget_name} lt $budgets->[1]->{budget_name}, 'default sort
Link Here
|
195 |
|
213 |
|
196 |
is( DelBudget($budget_id), 1, 'DelBudget returns true' ); |
214 |
is( DelBudget($budget_id), 1, 'DelBudget returns true' ); |
197 |
$budgets = GetBudgets(); |
215 |
$budgets = GetBudgets(); |
198 |
is( @$budgets, 1, 'GetBudgets returns the correct number of budget periods' ); |
216 |
is( @$budgets, 2, 'GetBudgets returns the correct number of budget periods' ); |
199 |
|
217 |
|
200 |
|
218 |
|
201 |
# GetBudgetHierarchySpent and GetBudgetHierarchyOrdered |
219 |
# GetBudgetHierarchySpent and GetBudgetHierarchyOrdered |
202 |
- |
|
|