Lines 167-172
DelCourseReserve( cr_id => $cr_id2 );
Link Here
|
167 |
$item = Koha::Items->find($itemnumber); |
167 |
$item = Koha::Items->find($itemnumber); |
168 |
is($item->ccode, '', 'Item ccode should be set back to empty'); |
168 |
is($item->ccode, '', 'Item ccode should be set back to empty'); |
169 |
|
169 |
|
|
|
170 |
subtest 'Ensure item info is preserved' => sub { |
171 |
plan tests => 8; |
172 |
|
173 |
my $course = $builder->build({ |
174 |
source => 'Course', |
175 |
value => { |
176 |
enabled => 'no', |
177 |
} |
178 |
}); |
179 |
my $item = $builder->build_sample_item({ ccode=>"grasshopper", location=>"transylvania"}); |
180 |
#Add course item but change nothing |
181 |
my $course_item_id = ModCourseItem( |
182 |
itemnumber => $item->itemnumber, |
183 |
itype => '', |
184 |
ccode => '', |
185 |
holdingbranch => '', |
186 |
location => '', |
187 |
); |
188 |
#Add course reserve |
189 |
my $course_reserve_id = ModCourseReserve( |
190 |
course_id => $course->{course_id}, |
191 |
ci_id => $course_item_id, |
192 |
staff_note => '', |
193 |
public_note => '', |
194 |
); |
195 |
#Remove course reservei |
196 |
DelCourseReserve( cr_id => $course_reserve_id ); |
197 |
my $item_after = Koha::Items->find( $item->itemnumber ); |
198 |
is( $item->itype, $item_after->itype, "Itemtype is unchanged after adding to and removing from course reserves for inactive course"); |
199 |
is( $item->location, $item_after->location, "Location is unchanged after adding to and removing from course reserves for inactive course"); |
200 |
is( $item->holdingbranch, $item_after->holdingbranch, "Holdingbranch is unchanged after adding to and removing from course reserves for inactive course"); |
201 |
is( $item->ccode, $item_after->ccode, "Collection is unchanged after adding to and removing from course reserves for inactive course"); |
202 |
|
203 |
$course = $builder->build({ |
204 |
source => 'Course', |
205 |
value => { |
206 |
enabled => 'yes', |
207 |
} |
208 |
}); |
209 |
$item = $builder->build_sample_item({ ccode=>"grasshopper", location=>"transylvania"}); |
210 |
#Add course item but change nothing |
211 |
$course_item_id = ModCourseItem( |
212 |
itemnumber => $item->itemnumber, |
213 |
itype => '', |
214 |
ccode => '', |
215 |
holdingbranch => '', |
216 |
location => '', |
217 |
); |
218 |
#Add course reserve |
219 |
$course_reserve_id = ModCourseReserve( |
220 |
course_id => $course->{course_id}, |
221 |
ci_id => $course_item_id, |
222 |
staff_note => '', |
223 |
public_note => '', |
224 |
); |
225 |
#Remove course reserve |
226 |
DelCourseReserve( cr_id => $course_reserve_id ); |
227 |
$item_after = Koha::Items->find( $item->itemnumber ); |
228 |
is( $item->itype, $item_after->itype, "Itemtype is unchanged after adding to and removing from course reserves for inactive course"); |
229 |
is( $item->location, $item_after->location, "Location is unchanged after adding to and removing from course reserves for inactive course"); |
230 |
is( $item->holdingbranch, $item_after->holdingbranch, "Holdingbranch is unchanged after adding to and removing from course reserves for inactive course"); |
231 |
is( $item->ccode, $item_after->ccode, "Collection is unchanged after adding to and removing from course reserves for inactive course"); |
232 |
|
233 |
}; |
234 |
|
235 |
|
236 |
|
237 |
|
238 |
|
170 |
$schema->storage->txn_rollback; |
239 |
$schema->storage->txn_rollback; |
171 |
|
240 |
|
172 |
sub create_dependent_objects { |
241 |
sub create_dependent_objects { |
173 |
- |
|
|