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

(-)a/api/v1/swagger/paths/biblios.yaml (+3 lines)
Lines 343-348 Link Here
343
    x-koha-authorization:
343
    x-koha-authorization:
344
      permissions:
344
      permissions:
345
        circulation: "1"
345
        circulation: "1"
346
    x-koha-embed:
347
      - item
348
      - patron
346
"/biblios/{biblio_id}/checkouts":
349
"/biblios/{biblio_id}/checkouts":
347
  get:
350
  get:
348
    x-mojo-to: Biblios#get_checkouts
351
    x-mojo-to: Biblios#get_checkouts
(-)a/bookings/list.pl (+46 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# Copyright PTFS Europe 2021
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# Koha is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
20
use Modern::Perl;
21
22
use CGI qw ( -utf8 );
23
24
use C4::Output qw( output_html_with_http_headers );
25
use C4::Auth qw( get_template_and_user );
26
27
my $input = CGI->new;
28
my ( $template, $borrowernumber, $cookie, $flags ) = get_template_and_user(
29
    {
30
        template_name => "bookings/list.tt",
31
        query         => $input,
32
        type          => "intranet",
33
        flagsrequired => { circulation => 1 },
34
    }
35
);
36
37
my $biblionumber = $input->param('biblionumber');
38
my $biblio       = Koha::Biblios->find($biblionumber);
39
40
$template->param(
41
    biblionumber => $biblionumber,
42
    biblio       => $biblio,
43
    bookingsview => 1,
44
);
45
46
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-view-menu.inc (+8 lines)
Lines 50-55 Link Here
50
            <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% biblio_object_id | url  %]">Items</a>
50
            <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% biblio_object_id | url  %]">Items</a>
51
        </li>
51
        </li>
52
52
53
        [%- IF ( bookingsview ) -%]
54
        <li class="active">
55
        [%- ELSE -%]
56
        <li>
57
        [%- END -%]
58
            <a href="/cgi-bin/koha/bookings/list.pl?biblionumber=[% biblio_object_id | url  %]">Bookings</a>
59
        </li>
60
53
        [%- IF ( CAN_user_reserveforothers ) -%]
61
        [%- IF ( CAN_user_reserveforothers ) -%]
54
        [%- IF ( holdsview ) -%]
62
        [%- IF ( holdsview ) -%]
55
        <li class="active">
63
        <li class="active">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/bookings/list.tt (-1 / +141 lines)
Line 0 Link Here
0
- 
1
[% USE raw %]
2
[% USE Asset %]
3
[% USE KohaDates %]
4
[% SET footerjs = 1 %]
5
[% INCLUDE 'doc-head-open.inc' %]
6
<title>Bookings for [% INCLUDE 'biblio-title-head.inc' %] &rsaquo; Bookings &rsaquo; Circulation &rsaquo; Koha</title>
7
[% INCLUDE 'doc-head-close.inc' %]
8
</head>
9
10
<body id="circ_request" class="catalog">
11
12
[% INCLUDE 'header.inc' %]
13
[% INCLUDE 'circ-search.inc' %]
14
15
<nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
16
    <ol>
17
        <li>
18
            <a href="/cgi-bin/koha/mainpage.pl">Home</a>
19
        </li>
20
        <li>
21
            <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a>
22
        </li>
23
        <li>
24
            [% INCLUDE 'biblio-title.inc' link =1 %]
25
        </li>
26
        <li>
27
            <a href="#" aria-current="page">
28
                Bookings
29
            </a>
30
        </li>
31
    </ol>
32
</nav>
33
34
<div class="main container-fluid">
35
    <div class="row">
36
        <div class="col-sm-10 col-sm-push-2">
37
            <main>
38
                <div class="row">
39
                    <div class="btn-toolbar">
40
                        <div class="btn-group">
41
                            <button id="placbooking" class="btn btn-default" data-toggle="modal" data-target="#placeBookingModal" data-biblionumber="[% biblionumber | html %]"><i class="fa fa-calendar"></i> Place booking</button>
42
                        </div>
43
                    </div>
44
                    <h1>Bookings for [% INCLUDE 'biblio-title-head.inc' %]</h1>
45
                    <div class="page-section">
46
                        <table id="bookings_table"></table>
47
                    </div>
48
                </div>
49
            </main>
50
        </div> <!-- /.col-sm-10.col-sm-push-2 -->
51
52
        <div class="col-sm-2 col-sm-pull-10">
53
            <aside>
54
                [% INCLUDE 'biblio-view-menu.inc' %]
55
            </aside>
56
        </div> <!-- /.col-sm-2.col-sm-pull-10 -->
57
    </div> <!-- /.row -->
58
59
    [% INCLUDE modals/place_booking.inc %]
60
61
    [% MACRO jsinclude BLOCK %]
62
    [% Asset.js("lib/dayjs/dayjs.min.js") | $raw %]
63
    [% INCLUDE 'datatables.inc' %]
64
    [% INCLUDE 'columns_settings.inc' %]
65
    [% INCLUDE 'calendar.inc' %]
66
    [% INCLUDE 'select2.inc' %]
67
    [% INCLUDE 'js-date-format.inc' %]
68
    [% Asset.js("js/place_booking_modal.js") | $raw %]
69
<script>
70
    var bookings_table;
71
    $(document).ready(function(){
72
        var bookings_table_url = "/api/v1/biblios/[% biblionumber | uri %]/bookings";
73
        bookings_table = $('#bookings_table').kohaTable({
74
            "ajax": {
75
                "url": bookings_table_url
76
            },
77
            "embed": [
78
                "item",
79
                "patron"
80
            ],
81
            "columns": [{
82
                "data": "booking_id",
83
                "title": "Booking ID",
84
                "visible": false,
85
                "searchable": false,
86
                "orderable": false
87
            },
88
            {
89
                "data": "item.external_id",
90
                "title": "Item",
91
                "searchable": true,
92
                "orderable": true,
93
                "defaultContent": "Any item",
94
                "render": function(data,type,row,meta) {
95
                    if ( row.item ) {
96
                        return row.item.external_id;
97
                    } else {
98
                        return null;
99
                    }
100
                }
101
            },
102
            {
103
                "data": "patron.firstname:patron.surname",
104
                "title": "Patron",
105
                "searchable": true,
106
                "orderable": true,
107
                "render": function(data, type, row, meta) {
108
                    var fullname;
109
                    if ( row.patron.firstname == null ) {
110
                        fullname = row.patron.surname;
111
                    }
112
                    else {
113
                        fullname = row.patron.firstname + " " + row.patron.surname;
114
                    }
115
                    return escape_str(fullname);
116
                }
117
            },
118
            {
119
                "data": "start_date",
120
                "title": "Start date",
121
                "searchable": true,
122
                "orderable": true,
123
                "render": function(data, type, row, meta) {
124
                    return $date(row.start_date);
125
                }
126
            },
127
            {
128
                "data": "end_date",
129
                "title": "End date",
130
                "searchable": true,
131
                "orderable": true,
132
                "render": function(data, type, row, meta) {
133
                    return $date(row.end_date);
134
                }
135
            }]
136
        }, [], 1);
137
    });
138
</script>
139
    [% END %]
140
141
[% INCLUDE 'intranet-bottom.inc' %]

Return to bug 29002