Lines 1-10
Link Here
|
1 |
#!/usr/bin/perl |
1 |
#!/usr/bin/perl |
2 |
use Modern::Perl; |
2 |
use Modern::Perl; |
3 |
|
3 |
|
4 |
use Test::More tests => 4; |
4 |
use Test::More tests => 5; |
5 |
|
5 |
|
6 |
use MARC::Record; |
6 |
use MARC::Record; |
|
|
7 |
|
7 |
use C4::Biblio qw( AddBiblio ); |
8 |
use C4::Biblio qw( AddBiblio ); |
|
|
9 |
use C4::Context; |
8 |
use_ok('C4::Serials'); |
10 |
use_ok('C4::Serials'); |
9 |
use_ok('C4::Budgets'); |
11 |
use_ok('C4::Budgets'); |
10 |
|
12 |
|
Lines 12-17
my $dbh = C4::Context->dbh;
Link Here
|
12 |
$dbh->{AutoCommit} = 0; |
14 |
$dbh->{AutoCommit} = 0; |
13 |
$dbh->{RaiseError} = 1; |
15 |
$dbh->{RaiseError} = 1; |
14 |
|
16 |
|
|
|
17 |
|
15 |
my $supplierlist=eval{GetSuppliersWithLateIssues()}; |
18 |
my $supplierlist=eval{GetSuppliersWithLateIssues()}; |
16 |
ok(length($@)==0,"No SQL problem in GetSuppliersWithLateIssues"); |
19 |
ok(length($@)==0,"No SQL problem in GetSuppliersWithLateIssues"); |
17 |
|
20 |
|
Lines 39-54
my $budget_id = AddBudget({
Link Here
|
39 |
}); |
42 |
}); |
40 |
|
43 |
|
41 |
my $subscriptionid = NewSubscription( |
44 |
my $subscriptionid = NewSubscription( |
42 |
undef, "", undef, undef, $budget_id, $biblionumber, '01-01-2013',undef, |
45 |
undef, "", undef, undef, $budget_id, $biblionumber, |
43 |
undef, undef, undef, undef, undef, undef, undef, undef, |
46 |
'2013-01-01', undef, undef, undef, undef, |
44 |
undef, undef, undef, undef, undef, undef, undef, undef, |
47 |
undef, undef, undef, undef, undef, undef, |
45 |
undef, undef, undef, undef, undef, undef, undef, 1, |
48 |
1, "notes",undef, '2013-01-01', undef, undef, |
46 |
"notes", undef, undef, undef, undef, undef, undef, 0, |
49 |
undef, undef, 0, "intnotes", 0, |
47 |
"intnotes", 0, undef, undef, 0, undef, '12-31-2013', |
50 |
undef, undef, 0, undef, '2013-12-31', 0 |
48 |
); |
51 |
); |
49 |
die unless $subscriptionid; |
52 |
die unless $subscriptionid; |
50 |
|
53 |
|
51 |
# Can edit a subscription |
54 |
|
|
|
55 |
my $subscription = GetSubscription( $subscriptionid ); |
56 |
is( C4::Serials::can_edit_subscription($subscription), 0, "cannot edit a subscription without userenv set"); |
57 |
|
52 |
my @USERENV = ( |
58 |
my @USERENV = ( |
53 |
1, |
59 |
1, |
54 |
'test', |
60 |
'test', |
Lines 62-70
my @USERENV = (
Link Here
|
62 |
|
68 |
|
63 |
C4::Context->_new_userenv ('DUMMY_SESSION_ID'); |
69 |
C4::Context->_new_userenv ('DUMMY_SESSION_ID'); |
64 |
C4::Context->set_userenv ( @USERENV ); |
70 |
C4::Context->set_userenv ( @USERENV ); |
65 |
my $userenv = C4::Context->userenv; |
|
|
66 |
|
71 |
|
67 |
my $subscription = GetSubscription( $subscriptionid ); |
72 |
# Can edit a subscription |
|
|
73 |
my $userenv = C4::Context->userenv; |
68 |
|
74 |
|
69 |
is( C4::Serials::can_edit_subscription($subscription), 1, "User can edit a subscription with an empty branchcode"); |
75 |
is( C4::Serials::can_edit_subscription($subscription), 1, "User can edit a subscription with an empty branchcode"); |
70 |
#TODO add UT when C4::Auth->set_permissions (or setuserflags) will exist. |
76 |
#TODO add UT when C4::Auth->set_permissions (or setuserflags) will exist. |
71 |
- |
|
|