3 use Test::More tests => 10;
8 use_ok('C4::Acquisition');
9 my $supplierlist=eval{GetSuppliersWithLateIssues()};
10 ok(length($@)==0,"No SQL problem in GetSuppliersWithLateIssues");
14 my $bpid = AddBudgetPeriod({
15 budget_period_startdate => '01-01-2015',
16 budget_period_enddate => '31-12-2015',
17 budget_description => "budget desc"
20 my $budget_id = AddBudget({
21 budget_code => "ABCD",
22 budget_amount => "123.132",
23 budget_name => "Périodiques",
24 budget_notes => "This is a note",
25 budget_description => "Serials",
27 budget_period_id => $bpid
30 my $subscriptionid = NewSubscription(
31 undef, "", undef, undef, $budget_id, $biblionumber, '01-01-2013',undef,
32 undef, undef, undef, undef, undef, undef, undef, undef,
33 undef, undef, undef, undef, undef, undef, undef, undef,
34 undef, undef, undef, undef, undef, undef, undef, 1,
35 "notes", undef, undef, undef, undef, undef, undef, 0,
36 "intnotes", 0, undef, undef, 0, undef, '31-12-2013',
38 die unless $subscriptionid;
40 my $subscription = GetSubscription( $subscriptionid );
41 my ( $basketno, $ordernumber ) = NewOrder({
42 biblionumber => $subscription->{biblionumber},
43 entrydate => '01-01-2013',
47 notes => "This is a note",
53 subscriptionid => $subscription->{subscriptionid},
54 budget_id => $budget_id,
57 my $is_currently_on_order = subscriptionCurrentlyOnOrder( $subscription->{subscriptionid} );
58 is ( $is_currently_on_order, 1, "The subscription is currently on order");
60 my $order = GetLastOrderNotReceivedFromSubscriptionid( $subscription->{subscriptionid} );
61 is ( $order->{subscriptionid}, $subscription->{subscriptionid}, "test subscriptionid for the last order not received");
62 ok( $order->{ecost} == $cost, "test cost for the last order not received");
64 my ( $datereceived, $new_ordernumber ) = ModReceiveOrder(
65 $biblionumber, $ordernumber, 1, undef, $cost, $cost,
66 undef, $cost, $budget_id, '02-01-2013', undef);
68 $order = GetLastOrderReceivedFromSubscriptionid( $subscription->{subscriptionid} );
69 is ( $order->{subscriptionid}, $subscription->{subscriptionid}, "test subscriptionid for the last order received");
70 ok( $order->{ecost} == $cost, "test cost for the last order received");
72 $order = GetLastOrderNotReceivedFromSubscriptionid( $subscription->{subscriptionid} );
73 is ( $order, undef, "test no not received order for a received order");
76 DelSubscription( $subscription->{subscriptionid} );
77 DelOrder( $subscription->{biblionumber}, $ordernumber );
78 DelBudgetPeriod($bpid);
79 DelBudget($budget_id);