@@ -, +, @@ my ($self) = @_; return Koha::Courses->search( { 'ci.itemnumber' => $self->itemnumber }, { join => { course_reserves => 'ci' } } ); --- Koha/Course/Reserve.pm | 19 +++++++- Koha/Item.pm | 17 +++++++ api/v1/swagger/definitions/item.yaml | 4 ++ api/v1/swagger/paths/biblios.yaml | 1 + .../prog/en/modules/catalogue/detail.tt | 45 +++++++++++-------- 5 files changed, 67 insertions(+), 19 deletions(-) --- a/Koha/Course/Reserve.pm +++ a/Koha/Course/Reserve.pm @@ -17,15 +17,32 @@ package Koha::Course::Reserve; use Modern::Perl; - use base qw(Koha::Object); +use Koha::Courses; + =head1 NAME Koha::Course::Reserve - Koha Course Reserve Object class =head1 API +=head2 Methods + +=head3 course + + my $course = $course_reserve->course; + +Return the course for this course reserve. + +=cut + +sub course { + my ($self) = @_; + my $rs = $self->_result->course; + return Koha::Course->_new_from_dbic($rs); +} + =head2 Internal methods =cut --- a/Koha/Item.pm +++ a/Koha/Item.pm @@ -35,6 +35,8 @@ use Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue; use Koha::Biblio::ItemGroups; use Koha::Checkouts; use Koha::CirculationRules; +use Koha::Courses; +use Koha::Course::Items; use Koha::CoverImages; use Koha::Exceptions; use Koha::Exceptions::Checkin; @@ -1787,6 +1789,21 @@ sub tracked_links { return Koha::TrackedLinks->_new_from_dbic($tracked_links); } +=head3 course_item + + my $course_item = $item->course_item; + +Returns a Koha::Course::Item object + +=cut + +sub course_item { + my ($self) = @_; + my $rs = $self->_result->course_item; + return unless $rs; + return Koha::Course::Item->_new_from_dbic($rs); +} + =head3 move_to_biblio $item->move_to_biblio($to_biblio[, $params]); --- a/api/v1/swagger/definitions/item.yaml +++ a/api/v1/swagger/definitions/item.yaml @@ -270,6 +270,10 @@ properties: type: - object - "null" + course_item: + type: + - object + - "null" _strings: type: - object --- a/api/v1/swagger/paths/biblios.yaml +++ a/api/v1/swagger/paths/biblios.yaml @@ -433,6 +433,7 @@ - item_type - in_bundle - bundle_host + - course_item.course_reserves.course - cover_image_ids - item_group_item.item_group.description - serialitem.serial --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -19,19 +19,6 @@ [% AmazonAssocTag = '' %] [% END %] -[% ShowCourseReserves = 0 | html %] -[% IF UseCourseReserves %] - [% FOREACH item IN itemloop %] - [% IF item.course_reserves %] - [% FOREACH r IN item.course_reserves %] - [% IF r.course.enabled == 'yes' %] - [% ShowCourseReserves = 1 | html %] - [% END %] - [% END %] - [% END %] - [% END %] -[% END %] - [% SET plugins_intranet_catalog_biblio_tabs = KohaPlugins.get_plugins_intranet_catalog_biblio_tab({ biblio => biblio, biblio_id => biblionumber }) %] [% SET footerjs = 1 %] @@ -379,7 +366,7 @@