3 use Test::More tests => 12;
6 use_ok('C4::Acquisition');
10 my $supplierlist=eval{GetSuppliersWithLateIssues()};
11 ok(length($@)==0,"No SQL problem in GetSuppliersWithLateIssues");
13 my $booksellerid = C4::Bookseller::AddBookseller(
16 address1 => "bookseller's address",
22 my ($biblionumber, $biblioitemnumber) = AddBiblio(MARC::Record->new, '');
24 my $bpid = AddBudgetPeriod({
25 budget_period_startdate => '01-01-2015',
26 budget_period_enddate => '12-31-2015',
27 budget_description => "budget desc"
30 my $budget_id = AddBudget({
31 budget_code => "ABCD",
32 budget_amount => "123.132",
33 budget_name => "Périodiques",
34 budget_notes => "This is a note",
35 budget_description => "Serials",
37 budget_period_id => $bpid
40 my $subscriptionid = NewSubscription(
41 undef, "", undef, undef, $budget_id, $biblionumber, '01-01-2013',undef,
42 undef, undef, undef, undef, undef, undef, undef, undef,
43 undef, undef, undef, undef, undef, undef, undef, undef,
44 undef, undef, undef, undef, undef, undef, undef, 1,
45 "notes", undef, undef, undef, undef, undef, undef, 0,
46 "intnotes", 0, undef, undef, 0, undef, '31-12-2013',
48 die unless $subscriptionid;
50 my ($basket, $basketno);
51 ok($basketno = NewBasket($booksellerid, 1), "NewBasket( $booksellerid , 1 ) returns $basketno");
54 my $subscription = GetSubscription( $subscriptionid );
56 ( $basketno, $ordernumber ) = NewOrder({
57 biblionumber => $subscription->{biblionumber},
58 entrydate => '01-01-2013',
62 notes => "This is a note",
63 basketno => $basketno,
68 subscriptionid => $subscription->{subscriptionid},
69 budget_id => $budget_id,
72 my $is_currently_on_order = subscriptionCurrentlyOnOrder( $subscription->{subscriptionid} );
73 is ( $is_currently_on_order, 1, "The subscription is currently on order");
75 my $order = GetLastOrderNotReceivedFromSubscriptionid( $subscription->{subscriptionid} );
76 is ( $order->{subscriptionid}, $subscription->{subscriptionid}, "test subscriptionid for the last order not received");
77 ok( $order->{ecost} == $cost, "test cost for the last order not received");
79 my ( $datereceived, $new_ordernumber ) = ModReceiveOrder(
80 $biblionumber, $ordernumber, 1, undef, $cost, $cost,
81 undef, $cost, $budget_id, '02-01-2013', undef);
83 $order = GetLastOrderReceivedFromSubscriptionid( $subscription->{subscriptionid} );
84 is ( $order->{subscriptionid}, $subscription->{subscriptionid}, "test subscriptionid for the last order received");
85 ok( $order->{ecost} == $cost, "test cost for the last order received");
87 $order = GetLastOrderNotReceivedFromSubscriptionid( $subscription->{subscriptionid} );
88 is ( $order, undef, "test no not received order for a received order");
92 DelSubscription( $subscription->{subscriptionid} );
93 DelOrder( $subscription->{biblionumber}, $ordernumber );
94 DelBudgetPeriod($bpid);
95 DelBudget($budget_id);
96 DelBasket( $basketno );
97 DelBiblio($biblionumber);