View | Details | Raw Unified | Return to bug 33568
Collapse All | Expand All

(-)a/Koha/Course/Reserve.pm (-1 / +18 lines)
Lines 17-31 package Koha::Course::Reserve; Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
21
use base qw(Koha::Object);
20
use base qw(Koha::Object);
22
21
22
use Koha::Courses;
23
23
=head1 NAME
24
=head1 NAME
24
25
25
Koha::Course::Reserve - Koha Course Reserve Object class
26
Koha::Course::Reserve - Koha Course Reserve Object class
26
27
27
=head1 API
28
=head1 API
28
29
30
=head2 Methods
31
32
=head3 course
33
34
    my $course = $course_reserve->course;
35
36
Return the course for this course reserve.
37
38
=cut
39
40
sub course {
41
    my ($self) = @_;
42
    my $rs = $self->_result->course;
43
    return Koha::Course->_new_from_dbic($rs);
44
}
45
29
=head2 Internal methods
46
=head2 Internal methods
30
47
31
=cut
48
=cut
(-)a/Koha/Item.pm (+17 lines)
Lines 35-40 use Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue; Link Here
35
use Koha::Biblio::ItemGroups;
35
use Koha::Biblio::ItemGroups;
36
use Koha::Checkouts;
36
use Koha::Checkouts;
37
use Koha::CirculationRules;
37
use Koha::CirculationRules;
38
use Koha::Courses;
39
use Koha::Course::Items;
38
use Koha::CoverImages;
40
use Koha::CoverImages;
39
use Koha::Exceptions;
41
use Koha::Exceptions;
40
use Koha::Exceptions::Checkin;
42
use Koha::Exceptions::Checkin;
Lines 1787-1792 sub tracked_links { Link Here
1787
    return Koha::TrackedLinks->_new_from_dbic($tracked_links);
1789
    return Koha::TrackedLinks->_new_from_dbic($tracked_links);
1788
}
1790
}
1789
1791
1792
=head3 course_item
1793
1794
  my $course_item = $item->course_item;
1795
1796
Returns a Koha::Course::Item object
1797
1798
=cut
1799
1800
sub course_item {
1801
    my ($self) = @_;
1802
    my $rs = $self->_result->course_item;
1803
    return unless $rs;
1804
    return Koha::Course::Item->_new_from_dbic($rs);
1805
}
1806
1790
=head3 move_to_biblio
1807
=head3 move_to_biblio
1791
1808
1792
  $item->move_to_biblio($to_biblio[, $params]);
1809
  $item->move_to_biblio($to_biblio[, $params]);
(-)a/api/v1/swagger/definitions/item.yaml (+4 lines)
Lines 270-275 properties: Link Here
270
    type:
270
    type:
271
      - object
271
      - object
272
      - "null"
272
      - "null"
273
  course_item:
274
    type:
275
      - object
276
      - "null"
273
  _strings:
277
  _strings:
274
    type:
278
    type:
275
      - object
279
      - object
(-)a/api/v1/swagger/paths/biblios.yaml (+1 lines)
Lines 433-438 Link Here
433
            - item_type
433
            - item_type
434
            - in_bundle
434
            - in_bundle
435
            - bundle_host
435
            - bundle_host
436
            - course_item.course_reserves.course
436
            - cover_image_ids
437
            - cover_image_ids
437
            - item_group_item.item_group.description
438
            - item_group_item.item_group.description
438
            - serialitem.serial
439
            - serialitem.serial
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (-19 / +27 lines)
Lines 19-37 Link Here
19
    [% AmazonAssocTag = '' %]
19
    [% AmazonAssocTag = '' %]
20
[% END %]
20
[% END %]
21
21
22
[% ShowCourseReserves = 0 | html %]
23
[% IF UseCourseReserves %]
24
    [% FOREACH item IN itemloop %]
25
       [% IF item.course_reserves %]
26
           [% FOREACH r IN item.course_reserves %]
27
               [% IF r.course.enabled == 'yes' %]
28
                   [% ShowCourseReserves = 1 | html %]
29
               [% END %]
30
           [% END %]
31
        [% END %]
32
    [% END %]
33
[% END %]
34
35
[% SET plugins_intranet_catalog_biblio_tabs = KohaPlugins.get_plugins_intranet_catalog_biblio_tab({ biblio => biblio, biblio_id => biblionumber }) %]
22
[% SET plugins_intranet_catalog_biblio_tabs = KohaPlugins.get_plugins_intranet_catalog_biblio_tab({ biblio => biblio, biblio_id => biblionumber }) %]
36
23
37
[% SET footerjs = 1 %]
24
[% SET footerjs = 1 %]
Lines 379-385 Link Here
379
            <th id="[% tab | html %]_itemnotes_nonpublic" data-colname="[% tab | html %]_itemnotes_nonpublic">Non-public notes</th>
366
            <th id="[% tab | html %]_itemnotes_nonpublic" data-colname="[% tab | html %]_itemnotes_nonpublic">Non-public notes</th>
380
            [% IF ( hostrecords ) %]<th id="[% tab | html %]_hostrecord" data-colname="[% tab | html %]_hostrecord">Host records</th>[% END %]
367
            [% IF ( hostrecords ) %]<th id="[% tab | html %]_hostrecord" data-colname="[% tab | html %]_hostrecord">Host records</th>[% END %]
381
            [% IF ( analyze ) %]<th id="[% tab | html %]_usedin" data-colname="[% tab | html %]_usedin">Used in</th><th></th>[% END %]
368
            [% IF ( analyze ) %]<th id="[% tab | html %]_usedin" data-colname="[% tab | html %]_usedin">Used in</th><th></th>[% END %]
382
            [% IF ( ShowCourseReserves ) %]<th id="[% tab | html %]_course_reserves" data-colname="[% tab | html %]_course_reserves">Course reserves</th>[% END %]
369
            [% IF Koha.Preference('UseCourseReserves') %]<th id="[% tab | html %]_course_reserves" data-colname="[% tab | html %]_course_reserves">Course reserves</th>[% END %]
383
            [% IF ( SpineLabelShowPrintOnBibDetails ) %]<th id="[% tab | html %]_spinelabel" data-colname="[% tab | html %]_spinelabel" class="NoSort">Spine label</th>[% END %]
370
            [% IF ( SpineLabelShowPrintOnBibDetails ) %]<th id="[% tab | html %]_spinelabel" data-colname="[% tab | html %]_spinelabel" class="NoSort">Spine label</th>[% END %]
384
            [% IF ( CAN_user_editcatalogue_edit_items ) %]<th id="[% tab | html %]_actions" data-colname="[% tab | html %]_actions"class="NoSort noExport">&nbsp;</th>[% END %]
371
            [% IF ( CAN_user_editcatalogue_edit_items ) %]<th id="[% tab | html %]_actions" data-colname="[% tab | html %]_actions"class="NoSort noExport">&nbsp;</th>[% END %]
385
            </tr>
372
            </tr>
Lines 2174-2179 Link Here
2174
        const av_damaged = new Map([% To.json(AuthorisedValues.GetDescriptionsByKohaField({ kohafield => 'items.damaged' })) | $raw %].map( av => [av.authorised_value, av.lib]));
2161
        const av_damaged = new Map([% To.json(AuthorisedValues.GetDescriptionsByKohaField({ kohafield => 'items.damaged' })) | $raw %].map( av => [av.authorised_value, av.lib]));
2175
        const av_not_for_loan= new Map([% To.json(AuthorisedValues.GetDescriptionsByKohaField({ kohafield => 'items.notforloan' })) | $raw %].map( av => [av.authorised_value, av.lib]));
2162
        const av_not_for_loan= new Map([% To.json(AuthorisedValues.GetDescriptionsByKohaField({ kohafield => 'items.notforloan' })) | $raw %].map( av => [av.authorised_value, av.lib]));
2176
        const av_restricted = new Map([% To.json(AuthorisedValues.GetDescriptionsByKohaField({ kohafield => 'items.restricted' })) | $raw %].map( av => [av.authorised_value, av.lib]));
2163
        const av_restricted = new Map([% To.json(AuthorisedValues.GetDescriptionsByKohaField({ kohafield => 'items.restricted' })) | $raw %].map( av => [av.authorised_value, av.lib]));
2164
        [% IF Koha.Preference('UseCourseReserves') %]
2165
            const av_courses_term = new Map([% To.json(AuthorisedValues.Get('TERM')) | $raw %].map( av => [av.authorised_value, av.lib]));
2166
        [% END %]
2177
        [% IF Koha.Preference('URLLinkText') %]
2167
        [% IF Koha.Preference('URLLinkText') %]
2178
            const url_link_text = "[% Koha.Preference('URLLinkText') | html %]";
2168
            const url_link_text = "[% Koha.Preference('URLLinkText') | html %]";
2179
        [% ELSE %]
2169
        [% ELSE %]
Lines 2197-2202 Link Here
2197
            embed.push('recall', 'recall.patron')
2187
            embed.push('recall', 'recall.patron')
2198
        [% END %]
2188
        [% END %]
2199
        embed.push('in_bundle', 'bundle_host');
2189
        embed.push('in_bundle', 'bundle_host');
2190
        [% IF Koha.Preference('UseCourseReserves') %]
2191
            embed.push('course_item.course_reserves.course');
2192
        [% END %]
2200
2193
2201
        function build_table (table_id, table_settings, filters) {
2194
        function build_table (table_id, table_settings, filters) {
2202
            [% IF hidden_count %]
2195
            [% IF hidden_count %]
Lines 2586-2598 Link Here
2586
                    }
2579
                    }
2587
                },
2580
                },
2588
                [% END %]
2581
                [% END %]
2589
                [% IF ( ShowCourseReserves ) %]
2582
                [% IF Koha.Preference('UseCourseReserves') %]
2590
                {
2583
                {
2591
                    data: "",
2584
                    data: "course_item.course_reserves.course.course_name",
2592
                    searchable: false, // FIXME
2585
                    searchable: true,
2593
                    orderable: true,
2586
                    orderable: true,
2594
                    render: function (data, type, row, meta) {
2587
                    render: function (data, type, row, meta) {
2595
                        return ""; // FIXME Display course reserves
2588
                        let nodes = '';
2589
                        if (!row.course_item) return nodes;
2590
                        row.course_item.course_reserves.forEach((cr, i) => {
2591
                            let c = cr.course;
2592
                            if ( c.enabled != 'yes' ) return;
2593
                            nodes += '<p>';
2594
                            nodes += '<a href="/cgi-bin/koha/course_reserves/course-details.pl?course_id=%s">'.format(c.course_id);
2595
                            nodes += c.course_name;
2596
                            if ( c.section ) {
2597
                                nodes += ' ' + c.section;
2598
                            }
2599
                            if ( c.term ) {
2600
                                nodes += ' ' + av_courses_term.get(c.term.toString());
2601
                            }
2602
                            nodes += '</p>';
2603
                        });
2604
                        return nodes;
2596
                    }
2605
                    }
2597
                },
2606
                },
2598
                [% END %]
2607
                [% END %]
2599
- 

Return to bug 33568