Lines 37-64
my $order3 = {
Link Here
|
37 |
|
37 |
|
38 |
$userenv->{branch} = 'B1'; |
38 |
$userenv->{branch} = 'B1'; |
39 |
|
39 |
|
|
|
40 |
# User can receive any orders thanks to his permissions |
40 |
ok( CanUserReceiveOrder($borrower, $order1, {superlibrarian => 1}) ); |
41 |
ok( CanUserReceiveOrder($borrower, $order1, {superlibrarian => 1}) ); |
41 |
ok( CanUserReceiveOrder($borrower, $order1, {acquisition => 1}) ); |
42 |
ok( CanUserReceiveOrder($borrower, $order1, {acquisition => 1}) ); |
42 |
ok( CanUserReceiveOrder($borrower, $order1, {acquisition => { order_receive_all => 1 }}) ); |
43 |
ok( CanUserReceiveOrder($borrower, $order1, {acquisition => { order_receive_all => 1 }}) ); |
43 |
|
44 |
|
|
|
45 |
# User cannot receive any order because of his lack of permission |
44 |
ok( not CanUserReceiveOrder($borrower, $order1, {}) ); |
46 |
ok( not CanUserReceiveOrder($borrower, $order1, {}) ); |
45 |
ok( not CanUserReceiveOrder($borrower, $order1, {acquisition => 0}) ); |
47 |
ok( not CanUserReceiveOrder($borrower, $order1, {acquisition => 0}) ); |
46 |
ok( not CanUserReceiveOrder($borrower, $order1, {acquisition => { order_receive => 0 }}) ); |
48 |
ok( not CanUserReceiveOrder($borrower, $order1, {acquisition => { order_receive => 0 }}) ); |
47 |
|
49 |
|
|
|
50 |
# User with order_receive permission can receive only orders of his branch (B1) |
51 |
# and orders that don't belong to any branch |
48 |
ok( CanUserReceiveOrder($borrower, $order1, {acquisition => { order_receive => 1 }}) ); |
52 |
ok( CanUserReceiveOrder($borrower, $order1, {acquisition => { order_receive => 1 }}) ); |
49 |
ok( CanUserReceiveOrder($borrower, $order2, {acquisition => { order_receive => 1 }}) ); |
53 |
ok( CanUserReceiveOrder($borrower, $order2, {acquisition => { order_receive => 1 }}) ); |
50 |
ok( not CanUserReceiveOrder($borrower, $order3, {acquisition => { order_receive => 1 }}) ); |
54 |
ok( not CanUserReceiveOrder($borrower, $order3, {acquisition => { order_receive => 1 }}) ); |
51 |
|
55 |
|
52 |
$userenv->{branch} = 'B2'; |
56 |
$userenv->{branch} = 'B2'; |
53 |
|
57 |
|
|
|
58 |
# User can receive any order thanks to his permissions |
54 |
ok( CanUserReceiveOrder($borrower, $order1, {superlibrarian => 1}) ); |
59 |
ok( CanUserReceiveOrder($borrower, $order1, {superlibrarian => 1}) ); |
55 |
ok( CanUserReceiveOrder($borrower, $order1, {acquisition => 1}) ); |
60 |
ok( CanUserReceiveOrder($borrower, $order1, {acquisition => 1}) ); |
56 |
ok( CanUserReceiveOrder($borrower, $order1, {acquisition => { order_receive_all => 1 }}) ); |
61 |
ok( CanUserReceiveOrder($borrower, $order1, {acquisition => { order_receive_all => 1 }}) ); |
57 |
|
62 |
|
|
|
63 |
# User cannot receive any order because of his lack of permission |
58 |
ok( not CanUserReceiveOrder($borrower, $order1, {}) ); |
64 |
ok( not CanUserReceiveOrder($borrower, $order1, {}) ); |
59 |
ok( not CanUserReceiveOrder($borrower, $order1, {acquisition => 0}) ); |
65 |
ok( not CanUserReceiveOrder($borrower, $order1, {acquisition => 0}) ); |
60 |
ok( not CanUserReceiveOrder($borrower, $order1, {acquisition => { order_receive => 0 }}) ); |
66 |
ok( not CanUserReceiveOrder($borrower, $order1, {acquisition => { order_receive => 0 }}) ); |
61 |
|
67 |
|
|
|
68 |
# User with order_receive permission can receive only orders of his branch (B2) |
69 |
# and orders that don't belong to any branch |
62 |
ok( CanUserReceiveOrder($borrower, $order1, {acquisition => { order_receive => 1 }}) ); |
70 |
ok( CanUserReceiveOrder($borrower, $order1, {acquisition => { order_receive => 1 }}) ); |
63 |
ok( not CanUserReceiveOrder($borrower, $order2, {acquisition => { order_receive => 1 }}) ); |
71 |
ok( not CanUserReceiveOrder($borrower, $order2, {acquisition => { order_receive => 1 }}) ); |
64 |
ok( CanUserReceiveOrder($borrower, $order3, {acquisition => { order_receive => 1 }}) ); |
72 |
ok( CanUserReceiveOrder($borrower, $order3, {acquisition => { order_receive => 1 }}) ); |
65 |
- |
|
|