Skip to content

Commit 42edbf6

Browse files
committed
Refactored reservable/cartable object class
- Objects are only of reservable/cartable if they are from the library holdings - Online objects are never reservable/cartable - No answer is provided for any other types of object
1 parent 8b167c2 commit 42edbf6

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

ding_reservation/ding_reservation.module

+9-4
Original file line numberDiff line numberDiff line change
@@ -310,12 +310,17 @@ function ding_reservation_list_form_remove($form, &$form_state) {
310310
function ding_reservation_ting_object_is($object, $class) {
311311
if ($class == 'reservable' || $class == 'cartable') {
312312
if (ting_object_is($object, 'online')) {
313+
// Online objects are never reservable. Ding should provide users
314+
// with direct access to these if possible.
313315
return FALSE;
316+
} else {
317+
$vars = ting_object_preprocess($object);
318+
// Objects which belong to the library holdings are reservable.
319+
// We cannot answer for anything else.
320+
if (in_array(strtolower($vars['ting_source']), array('bibliotekets materialer'))) {
321+
return TRUE;
322+
}
314323
}
315-
elseif (in_array(drupal_strtolower($object->type), array('artikel', 'tidsskrift'))) {
316-
return FALSE;
317-
}
318-
return TRUE;
319324
}
320325
}
321326

0 commit comments

Comments
 (0)