Lines 1-10
Link Here
|
1 |
#!/usr/bin/perl |
1 |
#!/usr/bin/perl |
2 |
use strict; |
2 |
use Modern::Perl; |
3 |
use warnings; |
|
|
4 |
|
3 |
|
5 |
use Test::More; |
4 |
use Test::More tests => 4; |
6 |
|
5 |
|
7 |
use_ok('C4::Serials'); |
6 |
use_ok('C4::Serials'); |
|
|
7 |
use_ok('C4::Budgets'); |
8 |
|
8 |
my $supplierlist=eval{GetSuppliersWithLateIssues()}; |
9 |
my $supplierlist=eval{GetSuppliersWithLateIssues()}; |
9 |
ok(length($@)==0,"No SQL problem in GetSuppliersWithLateIssues"); |
10 |
ok(length($@)==0,"No SQL problem in GetSuppliersWithLateIssues"); |
10 |
done_testing(); |
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 |
|
40 |
# Can edit a subscription |
41 |
my @USERENV = ( |
42 |
1, |
43 |
'test', |
44 |
'MASTERTEST', |
45 |
'Test', |
46 |
'Test', |
47 |
't', |
48 |
0, |
49 |
0, |
50 |
); |
51 |
|
52 |
C4::Context->_new_userenv ('DUMMY_SESSION_ID'); |
53 |
C4::Context->set_userenv ( @USERENV ); |
54 |
my $userenv = C4::Context->userenv; |
55 |
|
56 |
my $subscription = GetSubscription( $subscriptionid ); |
57 |
|
58 |
is( C4::Serials::can_edit_subscription($subscription), 1, "User can edit a subscription with an empty branchcode"); |
59 |
#TODO add UT when C4::Auth->set_permissions (or setuserflags) will exist. |
60 |
|
61 |
|
62 |
# cleaning |
63 |
DelSubscription( $subscription->{subscriptionid} ); |
64 |
DelBudgetPeriod($bpid); |
65 |
DelBudget($budget_id); |
11 |
- |
|
|