View | Details | Raw Unified | Return to bug 9937
Collapse All | Expand All

(-)a/t/db_dependent/Acquisition/OrderFromSubscription.t (+80 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
use Test::More tests => 10;
4
use Data::Dumper;
5
6
use_ok('C4::Serials');
7
use_ok('C4::Budgets');
8
use_ok('C4::Acquisition');
9
my $supplierlist=eval{GetSuppliersWithLateIssues()};
10
ok(length($@)==0,"No SQL problem in GetSuppliersWithLateIssues");
11
12
my $biblionumber = 1;
13
my $budgetid;
14
my $bpid = AddBudgetPeriod({
15
    budget_period_startdate => '01-01-2015',
16
    budget_period_enddate   => '31-12-2015',
17
    budget_description      => "budget desc"
18
});
19
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",
26
    budget_active      => 1,
27
    budget_period_id   => $bpid
28
});
29
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',
37
);
38
die unless $subscriptionid;
39
my $cost = 42.00;
40
my $subscription = GetSubscription( $subscriptionid );
41
my ( $basketno, $ordernumber ) = NewOrder({
42
    biblionumber => $subscription->{biblionumber},
43
    entrydate => '01-01-2013',
44
    quantity => 1,
45
    currency => 'USD',
46
    listprice => $cost,
47
    notes => "This is a note",
48
    basketno => 1,
49
    rrp => $cost,
50
    ecost => $cost,
51
    gstrate => 0.0500,
52
    orderstatus => 0,
53
    subscriptionid => $subscription->{subscriptionid},
54
    budget_id => $budget_id,
55
});
56
57
my $is_currently_on_order = subscriptionCurrentlyOnOrder( $subscription->{subscriptionid} );
58
is ( $is_currently_on_order, 1, "The subscription is currently on order");
59
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");
63
64
my ( $datereceived, $new_ordernumber ) = ModReceiveOrder(
65
    $biblionumber, $ordernumber, 1, undef, $cost, $cost,
66
    undef, $cost, $budget_id, '02-01-2013', undef);
67
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");
71
72
$order = GetLastOrderNotReceivedFromSubscriptionid( $subscription->{subscriptionid} );
73
is ( $order, undef, "test no not received order for a received order");
74
75
# cleaning
76
DelSubscription( $subscription->{subscriptionid} );
77
DelOrder( $subscription->{biblionumber}, $ordernumber );
78
DelBudgetPeriod($bpid);
79
DelBudget($budget_id);
80
(-)a/t/db_dependent/Budgets.t (-5 / +5 lines)
Lines 1-9 Link Here
1
use strict;
1
use strict;
2
use warnings;
2
use warnings;
3
use Test::More tests=>17;
3
use Test::More tests=>18;
4
4
5
BEGIN {use_ok('C4::Budgets') }
5
BEGIN {use_ok('C4::Budgets') }
6
use C4::Budgets;
7
use C4::Dates;
6
use C4::Dates;
8
7
9
use YAML;
8
use YAML;
Lines 99-105 ok(GetBudgets({budget_period_id=>$bpid},[{"budget_name"=>0}])>0, Link Here
99
ok(GetBudgets({budget_period_id=>GetBudgetPeriod($bpid)->{budget_period_id}},[{"budget_name"=>0}])>0,
98
ok(GetBudgets({budget_period_id=>GetBudgetPeriod($bpid)->{budget_period_id}},[{"budget_name"=>0}])>0,
100
	"GetBudgets With Order 
99
	"GetBudgets With Order 
101
	Getting Active budgetPeriod OK");
100
	Getting Active budgetPeriod OK");
102
ok($del_status=DelBudget($budget_id),
103
	"DelBudget returned $del_status");
104
101
102
my $budget_name = GetBudgetName( $budget_id );
103
is($budget_name, $budget->{budget_name}, "Test the GetBudgetName routine");
105
104
106
- 
105
ok($del_status=DelBudget($budget_id),
106
	"DelBudget returned $del_status");

Return to bug 9937