3 use Test::More tests=>18;
5 BEGIN {use_ok('C4::Budgets') }
20 ok($bpid=AddBudgetPeriod(
21 { budget_period_startdate => '2008-01-01'
22 , budget_period_enddate => '2008-12-31'
23 , budget_description => "MAPERI"}),
24 "AddBudgetPeriod with iso dates OK");
26 if (C4::Context->preference('dateformat') eq "metric"){
27 ok($bpid=AddBudgetPeriod(
28 { budget_period_startdate => '01-01-2008'
29 , budget_period_enddate => '31-12-2008'
30 , budget_description => "MAPERI"}),
31 "AddBudgetPeriod returned $bpid");
33 elsif (C4::Context->preference('dateformat') eq "us"){
34 ok($bpid=AddBudgetPeriod(
35 { budget_period_startdate => '01-01-2008'
36 , budget_period_enddate => '12-31-2008'
37 , budget_description => "MAPERI"}),
38 "AddBudgetPeriod returned $bpid");
41 ok($budgetperiod=GetBudgetPeriod($bpid),
42 "GetBudgetPeriod($bpid) returned ".Dump($budgetperiod));
43 ok(!GetBudgetPeriod(0) ,"GetBudgetPeriod(0) returned undef : noactive BudgetPeriod");
44 $$budgetperiod{budget_period_active}=1;
45 ok($mod_status=ModBudgetPeriod($budgetperiod),"ModBudgetPeriod OK");
46 ok($active_period=GetBudgetPeriod(0),"GetBudgetPeriod(0) returned".Dump($active_period));
47 ok(scalar(GetBudgetPeriods())>0,"GetBudgetPeriods OK");#Should at least return the Budget inserted
48 ok($del_status=DelBudgetPeriod($bpid),"DelBudgetPeriod returned $del_status");
55 if (C4::Context->preference('dateformat') eq "metric"){
56 ok($bpid=AddBudgetPeriod(
57 { budget_period_startdate =>'01-01-2008'
58 , budget_period_enddate =>'31-12-2008'
59 , budget_description =>"MAPERI"}),
60 "AddBudgetPeriod returned $bpid");
61 } elsif (C4::Context->preference('dateformat') eq "us"){
62 ok($bpid=AddBudgetPeriod(
63 { budget_period_startdate =>'01-01-2008'
64 , budget_period_enddate =>'12-31-2008'
65 , budget_description =>"MAPERI"}),
66 "AddBudgetPeriod returned $bpid");
69 ok($bpid=AddBudgetPeriod(
70 {budget_period_startdate=>'2008-01-01'
71 ,budget_period_enddate =>'2008-12-31'
72 ,budget_description =>"MAPERI"
74 "AddBudgetPeriod returned $bpid");
78 ok($budget_id=AddBudget(
79 { budget_code => "ABCD"
80 , budget_amount => "123.132"
81 , budget_name => "Périodiques"
82 , budget_notes => "This is a note"
83 , budget_description=> "Serials"
85 , budget_period_id => $bpid
88 "AddBudget returned $budget_id");
89 #budget_code | varchar(30) | YES | | NULL | |
90 #| budget_amount | decimal(28,6) | NO | | 0.000000 | |
91 #| budget_id | int(11) | NO | PRI | NULL | |
92 #| budget_branchcode | varchar(10) | YES | | NULL | |
93 #| budget_parent_id | int(11) | YES | | NULL | |
94 #| budget_name | varchar(80) | YES | | NULL | |
95 #| budget_encumb | decimal(28,6) | YES | | 0.000000 | |
96 #| budget_expend | decimal(28,6) | YES | | 0.000000 | |
97 #| budget_notes | mediumtext | YES | | NULL | |
98 #| budget_description | mediumtext | YES | | NULL | |
99 #| timestamp | timestamp | NO | | CURRENT_TIMESTAMP | |
100 #| budget_period_id | int(11) | YES | MUL | NULL | |
101 #| sort1_authcat | varchar(80) | YES | | NULL | |
102 #| sort2_authcat | varchar(80) | YES | | NULL | |
103 #| budget_owner_id | int(11) | YES | | NULL | |
104 #| budget_permission | int(1) | YES | | 0 | |
107 ok($budget=GetBudget($budget_id) ,"GetBudget OK");
108 $$budget{budget_permission}=1;
109 ok($mod_status=ModBudget($budget),"ModBudget OK");
112 ok(GetBudgets({budget_period_id=>$bpid})>0,
113 "GetBudgets With Filter OK");
114 ok(GetBudgets({budget_period_id=>$bpid},{"budget_description"=>0})>0,
115 "GetBudgets With Order OK");
116 ok(GetBudgets({budget_period_id=>GetBudgetPeriod(0)->{budget_period_id}},{"budget_description"=>0})>0,
117 "GetBudgets With Order
118 Getting Active budgetPeriod OK");
119 ok($del_status=DelBudget($budget_id),
120 "DelBudget returned $del_status");