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-50
my $ci_id = ModCourseItem(
Link Here
|
41 |
itemnumber => $itemnumber, |
41 |
itemnumber => $itemnumber, |
42 |
itype_enabled => 1, |
42 |
itype_enabled => 1, |
43 |
ccode_enabled => 1, |
43 |
ccode_enabled => 1, |
|
|
44 |
homebranch_enabled => 1, |
44 |
holdingbranch_enabled => 1, |
45 |
holdingbranch_enabled => 1, |
45 |
location_enabled => 1, |
46 |
location_enabled => 1, |
46 |
itype => 'BK_foo', |
47 |
itype => 'BK_foo', |
47 |
ccode => 'BOOK', |
48 |
ccode => 'BOOK', |
|
|
49 |
homebranch => 'B2', |
48 |
holdingbranch => 'B2', |
50 |
holdingbranch => 'B2', |
49 |
location => 'TH', |
51 |
location => 'TH', |
50 |
); |
52 |
); |
Lines 67-78
my $cr_id = ModCourseReserve(
Link Here
|
67 |
my $course_item = GetCourseItem( ci_id => $ci_id ); |
69 |
my $course_item = GetCourseItem( ci_id => $ci_id ); |
68 |
is($course_item->{itype_storage}, 'CD_foo', 'Course item itype storage should be CD_foo'); |
70 |
is($course_item->{itype_storage}, 'CD_foo', 'Course item itype storage should be CD_foo'); |
69 |
is($course_item->{ccode_storage}, 'CD', 'Course item ccode storage should be CD'); |
71 |
is($course_item->{ccode_storage}, 'CD', 'Course item ccode storage should be CD'); |
|
|
72 |
is($course_item->{homebranch_storage}, 'B1', 'Course item holding branch storage should be B1'); |
70 |
is($course_item->{holdingbranch_storage}, 'B1', 'Course item holding branch storage should be B1'); |
73 |
is($course_item->{holdingbranch_storage}, 'B1', 'Course item holding branch storage should be B1'); |
71 |
is($course_item->{location_storage}, 'HR', 'Course item location storage should be HR'); |
74 |
is($course_item->{location_storage}, 'HR', 'Course item location storage should be HR'); |
72 |
|
75 |
|
73 |
my $item = Koha::Items->find($itemnumber); |
76 |
my $item = Koha::Items->find($itemnumber); |
74 |
is($item->effective_itemtype, 'BK_foo', 'Item type in course should be BK_foo'); |
77 |
is($item->effective_itemtype, 'BK_foo', 'Item type in course should be BK_foo'); |
75 |
is($item->ccode, 'BOOK', 'Item ccode in course should be BOOK'); |
78 |
is($item->ccode, 'BOOK', 'Item ccode in course should be BOOK'); |
|
|
79 |
is($item->homebranch, 'B2', 'Item home branch in course should be B2'); |
76 |
is($item->holdingbranch, 'B2', 'Item holding branch in course should be B2'); |
80 |
is($item->holdingbranch, 'B2', 'Item holding branch in course should be B2'); |
77 |
is($item->location, 'TH', 'Item location in course should be TH'); |
81 |
is($item->location, 'TH', 'Item location in course should be TH'); |
78 |
|
82 |
|
Lines 80-89
ModCourseItem(
Link Here
|
80 |
itemnumber => $itemnumber, |
84 |
itemnumber => $itemnumber, |
81 |
itype_enabled => 1, |
85 |
itype_enabled => 1, |
82 |
ccode_enabled => 1, |
86 |
ccode_enabled => 1, |
|
|
87 |
homebranch_enabled => 1, |
83 |
holdingbranch_enabled => 1, |
88 |
holdingbranch_enabled => 1, |
84 |
location_enabled => 1, |
89 |
location_enabled => 1, |
85 |
itype => 'BK_foo', |
90 |
itype => 'BK_foo', |
86 |
ccode => 'DVD', |
91 |
ccode => 'DVD', |
|
|
92 |
homebranch => 'B3', |
87 |
holdingbranch => 'B3', |
93 |
holdingbranch => 'B3', |
88 |
location => 'TH', |
94 |
location => 'TH', |
89 |
); |
95 |
); |
Lines 98-109
ModCourseReserve(
Link Here
|
98 |
$course_item = GetCourseItem( ci_id => $ci_id ); |
104 |
$course_item = GetCourseItem( ci_id => $ci_id ); |
99 |
is($course_item->{itype_storage}, 'CD_foo', 'Course item itype storage should be CD_foo'); |
105 |
is($course_item->{itype_storage}, 'CD_foo', 'Course item itype storage should be CD_foo'); |
100 |
is($course_item->{ccode_storage}, 'CD', 'Course item ccode storage should be CD'); |
106 |
is($course_item->{ccode_storage}, 'CD', 'Course item ccode storage should be CD'); |
|
|
107 |
is($course_item->{homebranch_storage}, 'B1', 'Course item home branch storage should be B1'); |
101 |
is($course_item->{holdingbranch_storage}, 'B1', 'Course item holding branch storage should be B1'); |
108 |
is($course_item->{holdingbranch_storage}, 'B1', 'Course item holding branch storage should be B1'); |
102 |
is($course_item->{location_storage}, 'HR', 'Course item location storage should be HR'); |
109 |
is($course_item->{location_storage}, 'HR', 'Course item location storage should be HR'); |
103 |
|
110 |
|
104 |
$item = Koha::Items->find($itemnumber); |
111 |
$item = Koha::Items->find($itemnumber); |
105 |
is($item->effective_itemtype, 'BK_foo', 'Item type in course should be BK_foo'); |
112 |
is($item->effective_itemtype, 'BK_foo', 'Item type in course should be BK_foo'); |
106 |
is($item->ccode, 'DVD', 'Item ccode in course should be DVD'); |
113 |
is($item->ccode, 'DVD', 'Item ccode in course should be DVD'); |
|
|
114 |
is($item->homebranch, 'B3', 'Item home branch in course should be B3'); |
107 |
is($item->holdingbranch, 'B3', 'Item holding branch in course should be B3'); |
115 |
is($item->holdingbranch, 'B3', 'Item holding branch in course should be B3'); |
108 |
is($item->location, 'TH', 'Item location in course should be TH'); |
116 |
is($item->location, 'TH', 'Item location in course should be TH'); |
109 |
|
117 |
|
Lines 111-116
DelCourseReserve( cr_id => $cr_id );
Link Here
|
111 |
$item = Koha::Items->find($itemnumber); |
119 |
$item = Koha::Items->find($itemnumber); |
112 |
is($item->effective_itemtype, 'CD_foo', 'Item type removed from course should be set back to CD_foo'); |
120 |
is($item->effective_itemtype, 'CD_foo', 'Item type removed from course should be set back to CD_foo'); |
113 |
is($item->ccode, 'CD', 'Item ccode removed from course should be set back to CD'); |
121 |
is($item->ccode, 'CD', 'Item ccode removed from course should be set back to CD'); |
|
|
122 |
is($item->homebranch, 'B1', 'Item home branch removed from course should be set back B1'); |
114 |
is($item->holdingbranch, 'B1', 'Item holding branch removed from course should be set back B1'); |
123 |
is($item->holdingbranch, 'B1', 'Item holding branch removed from course should be set back B1'); |
115 |
is($item->location, 'HR', 'Item location removed from course should be TH'); |
124 |
is($item->location, 'HR', 'Item location removed from course should be TH'); |
116 |
|
125 |
|
Lines 124-133
my $ci_id2 = ModCourseItem(
Link Here
|
124 |
itemnumber => $itemnumber, |
133 |
itemnumber => $itemnumber, |
125 |
itype_enabled => 1, |
134 |
itype_enabled => 1, |
126 |
ccode_enabled => 1, |
135 |
ccode_enabled => 1, |
|
|
136 |
homebranch_enabled => 1, |
127 |
holdingbranch_enabled => 1, |
137 |
holdingbranch_enabled => 1, |
128 |
location_enabled => 1, |
138 |
location_enabled => 1, |
129 |
itype => 'CD_foo', |
139 |
itype => 'CD_foo', |
130 |
ccode => 'BOOK', |
140 |
ccode => 'BOOK', |
|
|
141 |
homebranch => 'B1', |
131 |
holdingbranch => 'B1', |
142 |
holdingbranch => 'B1', |
132 |
location => 'HR', |
143 |
location => 'HR', |
133 |
); |
144 |
); |
Lines 149-158
ModCourseItem(
Link Here
|
149 |
itemnumber => $itemnumber, |
160 |
itemnumber => $itemnumber, |
150 |
itype_enabled => 1, |
161 |
itype_enabled => 1, |
151 |
ccode_enabled => 1, |
162 |
ccode_enabled => 1, |
|
|
163 |
homebranch_enabled => 1, |
152 |
holdingbranch_enabled => 1, |
164 |
holdingbranch_enabled => 1, |
153 |
location_enabled => 1, |
165 |
location_enabled => 1, |
154 |
itype => 'CD_foo', |
166 |
itype => 'CD_foo', |
155 |
ccode => 'DVD', |
167 |
ccode => 'DVD', |
|
|
168 |
homebranch => 'B1', |
156 |
holdingbranch => 'B1', |
169 |
holdingbranch => 'B1', |
157 |
location => 'HR', |
170 |
location => 'HR', |
158 |
); |
171 |
); |
Lines 171-176
ModCourseItem(
Link Here
|
171 |
itemnumber => $itemnumber, |
184 |
itemnumber => $itemnumber, |
172 |
itype_enabled => 1, |
185 |
itype_enabled => 1, |
173 |
ccode_enabled => 1, |
186 |
ccode_enabled => 1, |
|
|
187 |
homebranch_enabled => 0, # LEAVE UNCHANGED |
174 |
holdingbranch_enabled => 0, # LEAVE UNCHANGED |
188 |
holdingbranch_enabled => 0, # LEAVE UNCHANGED |
175 |
location_enabled => 1, |
189 |
location_enabled => 1, |
176 |
itype => 'BK', |
190 |
itype => 'BK', |
177 |
- |
|
|