3 use Test::More tests=>17;
5 BEGIN {use_ok('C4::Budgets') }
19 ok($bpid=AddBudgetPeriod(
20 { budget_period_startdate => '2008-01-01'
21 , budget_period_enddate => '2008-12-31'
22 , budget_description => "MAPERI"}),
23 "AddBudgetPeriod with iso dates OK");
25 ok($budgetperiod=GetBudgetPeriod($bpid),
26 "GetBudgetPeriod($bpid) returned ".Dump($budgetperiod));
27 ok(!GetBudgetPeriod(0) ,"GetBudgetPeriod(0) returned undef : noactive BudgetPeriod");
28 $$budgetperiod{budget_period_active}=1;
29 ok($mod_status=ModBudgetPeriod($budgetperiod),"ModBudgetPeriod OK");
30 ok($active_period=GetBudgetPeriod(0),"GetBudgetPeriod(0) returned".Dump($active_period));
31 ok(scalar(GetBudgetPeriods())>0,"GetBudgetPeriods OK");#Should at least return the Budget inserted
32 ok($del_status=DelBudgetPeriod($bpid),"DelBudgetPeriod returned $del_status");
39 if (C4::Context->preference('dateformat') eq "metric"){
40 ok($bpid=AddBudgetPeriod(
41 { budget_period_startdate =>'01-01-2008'
42 , budget_period_enddate =>'31-12-2008'
43 , budget_description =>"MAPERI"}),
44 "AddBudgetPeriod returned $bpid");
45 } elsif (C4::Context->preference('dateformat') eq "us"){
46 ok($bpid=AddBudgetPeriod(
47 { budget_period_startdate =>'01-01-2008'
48 , budget_period_enddate =>'12-31-2008'
49 , budget_description =>"MAPERI"}),
50 "AddBudgetPeriod returned $bpid");
53 ok($bpid=AddBudgetPeriod(
54 {budget_period_startdate=>'2008-01-01'
55 ,budget_period_enddate =>'2008-12-31'
56 ,budget_description =>"MAPERI"
58 "AddBudgetPeriod returned $bpid");
62 ok($budget_id=AddBudget(
63 { budget_code => "ABCD"
64 , budget_amount => "123.132"
65 , budget_name => "Périodiques"
66 , budget_notes => "This is a note"
67 , budget_description=> "Serials"
69 , budget_period_id => $bpid
72 "AddBudget returned $budget_id");
73 #budget_code | varchar(30) | YES | | NULL | |
74 #| budget_amount | decimal(28,6) | NO | | 0.000000 | |
75 #| budget_id | int(11) | NO | PRI | NULL | |
76 #| budget_branchcode | varchar(10) | YES | | NULL | |
77 #| budget_parent_id | int(11) | YES | | NULL | |
78 #| budget_name | varchar(80) | YES | | NULL | |
79 #| budget_encumb | decimal(28,6) | YES | | 0.000000 | |
80 #| budget_expend | decimal(28,6) | YES | | 0.000000 | |
81 #| budget_notes | mediumtext | YES | | NULL | |
82 #| timestamp | timestamp | NO | | CURRENT_TIMESTAMP | |
83 #| budget_period_id | int(11) | YES | MUL | NULL | |
84 #| sort1_authcat | varchar(80) | YES | | NULL | |
85 #| sort2_authcat | varchar(80) | YES | | NULL | |
86 #| budget_owner_id | int(11) | YES | | NULL | |
87 #| budget_permission | int(1) | YES | | 0 | |
90 ok($budget=GetBudget($budget_id) ,"GetBudget OK");
91 $$budget{budget_permission}=1;
92 ok($mod_status=ModBudget($budget),"ModBudget OK");
95 ok(GetBudgets({budget_period_id=>$bpid})>0,
96 "GetBudgets With Filter OK");
97 ok(GetBudgets({budget_period_id=>$bpid},[{"budget_name"=>0}])>0,
98 "GetBudgets With Order OK");
99 ok(GetBudgets({budget_period_id=>GetBudgetPeriod($bpid)->{budget_period_id}},[{"budget_name"=>0}])>0,
100 "GetBudgets With Order
101 Getting Active budgetPeriod OK");
102 ok($del_status=DelBudget($budget_id),
103 "DelBudget returned $del_status");