|
Lines 23-29
use C4::CourseReserves qw/ModCourseItem ModCourseReserve DelCourseReserve GetCou
Link Here
|
| 23 |
use C4::Context; |
23 |
use C4::Context; |
| 24 |
use Koha::Items; |
24 |
use Koha::Items; |
| 25 |
|
25 |
|
| 26 |
use Test::More tests => 29; |
26 |
use Test::More tests => 34; |
| 27 |
|
27 |
|
| 28 |
BEGIN { |
28 |
BEGIN { |
| 29 |
require_ok('C4::CourseReserves'); |
29 |
require_ok('C4::CourseReserves'); |
|
Lines 41-46
my $ci_id = ModCourseItem(
Link Here
|
| 41 |
itemnumber => $itemnumber, |
41 |
itemnumber => $itemnumber, |
| 42 |
itype => 'BK_foo', |
42 |
itype => 'BK_foo', |
| 43 |
ccode => 'BOOK', |
43 |
ccode => 'BOOK', |
|
|
44 |
homebranch => 'B2', |
| 44 |
holdingbranch => 'B2', |
45 |
holdingbranch => 'B2', |
| 45 |
location => 'TH', |
46 |
location => 'TH', |
| 46 |
); |
47 |
); |
|
Lines 62-73
my $cr_id = ModCourseReserve(
Link Here
|
| 62 |
my $course_item = GetCourseItem( ci_id => $ci_id ); |
63 |
my $course_item = GetCourseItem( ci_id => $ci_id ); |
| 63 |
is($course_item->{itype}, 'CD_foo', 'Course item itype should be CD_foo'); |
64 |
is($course_item->{itype}, 'CD_foo', 'Course item itype should be CD_foo'); |
| 64 |
is($course_item->{ccode}, 'CD', 'Course item ccode should be CD'); |
65 |
is($course_item->{ccode}, 'CD', 'Course item ccode should be CD'); |
|
|
66 |
is($course_item->{homebranch}, 'B1', 'Course item home branch should be B1'); |
| 65 |
is($course_item->{holdingbranch}, 'B1', 'Course item holding branch should be B1'); |
67 |
is($course_item->{holdingbranch}, 'B1', 'Course item holding branch should be B1'); |
| 66 |
is($course_item->{location}, 'HR', 'Course item location should be HR'); |
68 |
is($course_item->{location}, 'HR', 'Course item location should be HR'); |
| 67 |
|
69 |
|
| 68 |
my $item = Koha::Items->find($itemnumber); |
70 |
my $item = Koha::Items->find($itemnumber); |
| 69 |
is($item->itype, 'BK_foo', 'Item type in course should be BK_foo'); |
71 |
is($item->itype, 'BK_foo', 'Item type in course should be BK_foo'); |
| 70 |
is($item->ccode, 'BOOK', 'Item ccode in course should be BOOK'); |
72 |
is($item->ccode, 'BOOK', 'Item ccode in course should be BOOK'); |
|
|
73 |
is($item->homebranch, 'B2', 'Item home branch in course should be B2'); |
| 71 |
is($item->holdingbranch, 'B2', 'Item holding branch in course should be B2'); |
74 |
is($item->holdingbranch, 'B2', 'Item holding branch in course should be B2'); |
| 72 |
is($item->location, 'TH', 'Item location in course should be TH'); |
75 |
is($item->location, 'TH', 'Item location in course should be TH'); |
| 73 |
|
76 |
|
|
Lines 75-80
ModCourseItem(
Link Here
|
| 75 |
itemnumber => $itemnumber, |
78 |
itemnumber => $itemnumber, |
| 76 |
itype => 'BK_foo', |
79 |
itype => 'BK_foo', |
| 77 |
ccode => 'DVD', |
80 |
ccode => 'DVD', |
|
|
81 |
homebranch => 'B3', |
| 78 |
holdingbranch => 'B3', |
82 |
holdingbranch => 'B3', |
| 79 |
location => 'TH', |
83 |
location => 'TH', |
| 80 |
); |
84 |
); |
|
Lines 89-100
ModCourseReserve(
Link Here
|
| 89 |
$course_item = GetCourseItem( ci_id => $ci_id ); |
93 |
$course_item = GetCourseItem( ci_id => $ci_id ); |
| 90 |
is($course_item->{itype}, 'CD_foo', 'Course item itype should be CD_foo'); |
94 |
is($course_item->{itype}, 'CD_foo', 'Course item itype should be CD_foo'); |
| 91 |
is($course_item->{ccode}, 'CD', 'Course item ccode should be CD'); |
95 |
is($course_item->{ccode}, 'CD', 'Course item ccode should be CD'); |
|
|
96 |
is($course_item->{homebranch}, 'B1', 'Course item home branch should be B1'); |
| 92 |
is($course_item->{holdingbranch}, 'B1', 'Course item holding branch should be B1'); |
97 |
is($course_item->{holdingbranch}, 'B1', 'Course item holding branch should be B1'); |
| 93 |
is($course_item->{location}, 'HR', 'Course item location should be HR'); |
98 |
is($course_item->{location}, 'HR', 'Course item location should be HR'); |
| 94 |
|
99 |
|
| 95 |
$item = Koha::Items->find($itemnumber); |
100 |
$item = Koha::Items->find($itemnumber); |
| 96 |
is($item->itype, 'BK_foo', 'Item type in course should be BK_foo'); |
101 |
is($item->itype, 'BK_foo', 'Item type in course should be BK_foo'); |
| 97 |
is($item->ccode, 'DVD', 'Item ccode in course should be DVD'); |
102 |
is($item->ccode, 'DVD', 'Item ccode in course should be DVD'); |
|
|
103 |
is($item->homebranch, 'B3', 'Item home branch in course should be B3'); |
| 98 |
is($item->holdingbranch, 'B3', 'Item holding branch in course should be B3'); |
104 |
is($item->holdingbranch, 'B3', 'Item holding branch in course should be B3'); |
| 99 |
is($item->location, 'TH', 'Item location in course should be TH'); |
105 |
is($item->location, 'TH', 'Item location in course should be TH'); |
| 100 |
|
106 |
|
|
Lines 102-107
DelCourseReserve( cr_id => $cr_id );
Link Here
|
| 102 |
$item = Koha::Items->find($itemnumber); |
108 |
$item = Koha::Items->find($itemnumber); |
| 103 |
is($item->itype, 'CD_foo', 'Item type removed from course should be set back to CD_foo'); |
109 |
is($item->itype, 'CD_foo', 'Item type removed from course should be set back to CD_foo'); |
| 104 |
is($item->ccode, 'CD', 'Item ccode removed from course should be set back to CD'); |
110 |
is($item->ccode, 'CD', 'Item ccode removed from course should be set back to CD'); |
|
|
111 |
is($item->homebranch, 'B1', 'Item home branch removed from course should be set back B1'); |
| 105 |
is($item->holdingbranch, 'B1', 'Item holding branch removed from course should be set back B1'); |
112 |
is($item->holdingbranch, 'B1', 'Item holding branch removed from course should be set back B1'); |
| 106 |
is($item->location, 'HR', 'Item location removed from course should be TH'); |
113 |
is($item->location, 'HR', 'Item location removed from course should be TH'); |
| 107 |
|
114 |
|
|
Lines 115-120
my $ci_id2 = ModCourseItem(
Link Here
|
| 115 |
itemnumber => $itemnumber, |
122 |
itemnumber => $itemnumber, |
| 116 |
itype => 'CD_foo', |
123 |
itype => 'CD_foo', |
| 117 |
ccode => 'BOOK', |
124 |
ccode => 'BOOK', |
|
|
125 |
homebranch => 'B1', |
| 118 |
holdingbranch => 'B1', |
126 |
holdingbranch => 'B1', |
| 119 |
location => 'HR', |
127 |
location => 'HR', |
| 120 |
); |
128 |
); |
|
Lines 136-141
ModCourseItem(
Link Here
|
| 136 |
itemnumber => $itemnumber, |
144 |
itemnumber => $itemnumber, |
| 137 |
itype => 'CD_foo', |
145 |
itype => 'CD_foo', |
| 138 |
ccode => 'DVD', |
146 |
ccode => 'DVD', |
|
|
147 |
homebranch => 'B1', |
| 139 |
holdingbranch => 'B1', |
148 |
holdingbranch => 'B1', |
| 140 |
location => 'HR', |
149 |
location => 'HR', |
| 141 |
); |
150 |
); |
| 142 |
- |
|
|