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

(-)a/api/v1/swagger/paths/biblios.yaml (-3 lines)
Lines 341-349 Link Here
341
    x-koha-authorization:
341
    x-koha-authorization:
342
      permissions:
342
      permissions:
343
        circulation: "1"
343
        circulation: "1"
344
    x-koha-embed:
345
      - item
346
      - patron
347
"/biblios/{biblio_id}/checkouts":
344
"/biblios/{biblio_id}/checkouts":
348
  get:
345
  get:
349
    x-mojo-to: Biblios#get_checkouts
346
    x-mojo-to: Biblios#get_checkouts
(-)a/api/v1/swagger/paths/bookings.yaml (+4 lines)
Lines 74-79 Link Here
74
    x-koha-authorization:
74
    x-koha-authorization:
75
      permissions:
75
      permissions:
76
        catalogue: 1
76
        catalogue: 1
77
    x-koha-embed:
78
      - biblio
79
      - item
80
      - patron
77
  post:
81
  post:
78
    operationId: addBooking
82
    operationId: addBooking
79
    parameters:
83
    parameters:
(-)a/circ/pendingbookings.pl (+49 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
use Koha::DateUtils qw(dt_from_string);
28
29
my $input = CGI->new;
30
my ( $template, $borrowernumber, $cookie, $flags ) = get_template_and_user(
31
    {
32
        template_name => "circ/pendingbookings.tt",
33
        query         => $input,
34
        type          => "intranet",
35
        flagsrequired => { circulation => 1 },
36
    }
37
);
38
39
my $today = dt_from_string();
40
my $startdate = $today->truncate( to => 'day' );
41
my $enddate = $startdate->clone->add( days => 1 );
42
43
$template->param(
44
    todaysdate          => $today,
45
    from                => $startdate,
46
    to                  => $enddate
47
);
48
49
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt (-1 / +4 lines)
Lines 75-81 Link Here
75
            </div>
75
            </div>
76
76
77
            <div class="col-sm-5 col-md-4">
77
            <div class="col-sm-5 col-md-4">
78
                <h3>Holds</h3>
78
                <h3>Holds & Bookings</h3>
79
79
80
                <ul class="buttons-list">
80
                <ul class="buttons-list">
81
                    <li>
81
                    <li>
Lines 95-100 Link Here
95
                    <li>
95
                    <li>
96
                        <a class="circ-button" href="/cgi-bin/koha/circ/reserveratios.pl"><i class="fa-solid fa-chart-line"></i> Hold ratios</a>
96
                        <a class="circ-button" href="/cgi-bin/koha/circ/reserveratios.pl"><i class="fa-solid fa-chart-line"></i> Hold ratios</a>
97
                    </li>
97
                    </li>
98
                    <li>
99
                        <a class="circ-button" href="/cgi-bin/koha/circ/pendingbookings.pl"><i class="fa fa-hand-grab-o"></i> Bookings to collect</a>
100
                    </li>
98
                </ul>
101
                </ul>
99
102
100
                [% IF Koha.Preference('UseRecalls') and CAN_user_recalls %]
103
                [% IF Koha.Preference('UseRecalls') and CAN_user_recalls %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingbookings.tt (-1 / +209 lines)
Line 0 Link Here
0
- 
1
[% USE raw %]
2
[% USE Asset %]
3
[% USE Koha %]
4
[% USE KohaDates %]
5
[% USE TablesSettings %]
6
[% PROCESS 'i18n.inc' %]
7
[% SET footerjs = 1 %]
8
[% INCLUDE 'doc-head-open.inc' %]
9
<title>[% FILTER collapse %]
10
    [% t("Bookings to collect") | html %] &rsaquo;
11
    [% t("Circulation") | html %] &rsaquo;
12
    [% t("Koha") | html %]
13
[% END %]</title>
14
[% INCLUDE 'doc-head-close.inc' %]
15
</head>
16
17
<body id="circ_pendingbookings" class="circ">
18
    [% INCLUDE 'header.inc' %]
19
    [% INCLUDE 'circ-search.inc' %]
20
21
    <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
22
        <ol>
23
            <li>
24
                <a href="/cgi-bin/koha/mainpage.pl">Home</a>
25
            </li>
26
            <li>
27
                <a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a>
28
            </li>
29
            <li>
30
                <a href="#" aria-current="page">
31
                Bookings to collect
32
            </a>
33
            </li>
34
        </ol>
35
    </nav>
36
37
    <div class="main container-fluid">
38
        <div class="row">
39
40
            <!-- Results -->
41
            <div class="col-sm-10 col-sm-push-2">
42
                <main>
43
                    <h2>Items required for bookings between <span id="from_date">[% from | $KohaDates %]</span> and <span id="to_date">[% to | $KohaDates %]</span></h2>
44
                    <h3>Reported on [% todaysdate | $KohaDates %]</h3>
45
                    <p>The following items have not been collected for bookings. Please retrieve them
46
                        and check them in.</p>
47
                    <div id="searchresults">
48
                        <table id="bookingst"></table>
49
                    </div>
50
                </main>
51
            </div>
52
53
            <!-- Filters -->
54
            <div class="col-sm-2 col-sm-pull-10">
55
                <aside>
56
                    <div id="filters">
57
                        <form id="bookingsf">
58
                            <fieldset class="brief">
59
                                <h4>Refine results</h4>
60
                                <ol>
61
                                    <li>
62
                                        <label for="from">Start date: </label>
63
                                        <input type="text" size="10" id="from" name="from" value="[% from | html %]" class="flatpickr" data-date_to="to"/>
64
                                    </li>
65
                                    <li>
66
                                        <label for="to">End date: </label>
67
                                        <input type="text" size="10" id="to" name="to" value="[% to | html %]" class="flatpickr"/>
68
                                    </li>
69
                                </ol>
70
71
                                <fieldset class="action">
72
                                    <input type="submit" name="run_report" value="Submit" class="submit"/>
73
                                </fieldset>
74
                            </fieldset>
75
                        </form>
76
                    </div>
77
                </aside>
78
            </div>
79
        </div>
80
        <!-- /.row -->
81
82
        [% MACRO jsinclude BLOCK %]
83
        [% INCLUDE 'calendar.inc' %]
84
        [% INCLUDE 'datatables.inc' %]
85
        [% INCLUDE 'columns_settings.inc' %]
86
        [% Asset.js("lib/jquery/plugins/jquery.dataTables.columnFilter.js") | $raw %]
87
        [% INCLUDE 'js-biblio-format.inc' %]
88
        [% INCLUDE 'js-date-format.inc' %]
89
        [% INCLUDE 'js-patron-format.inc' %]
90
        <script>
91
            let table_settings = [% TablesSettings.GetTableSettings( 'circ', 'bookings', 'bookings-to-collect', 'json' ) | $raw %];
92
            $(document).ready(function() {
93
94
                let additional_filters = {
95
                    start_date: function() {
96
                       let fromdate = $("#from");
97
                       let isoFrom;
98
                       if ( fromdate.val() !== '' ) {
99
                         isoFrom = fromdate.get(0)._flatpickr.selectedDates[0].toISOString().substring(0,10);
100
                       }
101
102
                       let todate = $("#to");
103
                       let isoTo;
104
                       if ( todate.val() !== '' ) {
105
                         isoTo = todate.get(0)._flatpickr.selectedDates[0].toISOString().substring(0,10);
106
                       }
107
108
                       return { '>=': isoFrom, '<=': isoTo };
109
                    }
110
                };
111
112
                var bookings_table_url = '/api/v1/bookings?';
113
                var bookings_table = $("#bookingst").kohaTable({
114
                    "ajax": {
115
                        "url": bookings_table_url
116
                    },
117
                    "embed": [
118
                        "biblio",
119
                        "item",
120
                        "patron"
121
                    ],
122
                    "order": [[ 1, "asc" ]],
123
                    "columns": [{
124
                        "data": "booking_id",
125
                        "title": "Booking ID",
126
                        "visible": false
127
                    },
128
                    {
129
                        "data": "biblio.title",
130
                        "title": "Title",
131
                        "searchable": true,
132
                        "orderable": true,
133
                        "render": function(data,type,row,meta) {
134
                            return $biblio_to_html(row.biblio, {
135
                                link: 'bookings'
136
                            });
137
                        }
138
                    },
139
                    {
140
                        "data": "item.external_id",
141
                        "title": "Item",
142
                        "searchable": true,
143
                        "orderable": true,
144
                        "defaultContent": "Any item",
145
                        "render": function(data,type,row,meta) {
146
                            if ( row.item ) {
147
                                return row.item.external_id + " (" + row.booking_id + ")";
148
                            } else {
149
                                return null;
150
                            }
151
                        }
152
                    },
153
                    {
154
                        "data": "item.callnumber",
155
                        "title": "Callnumber",
156
                        "searchable": true,
157
                        "orderable": true,
158
                        "render": function(data,type,row,meta) {
159
                            if ( row.item ) {
160
                                return row.item.callnumber;
161
                            } else {
162
                                return null;
163
                            }
164
                        }
165
                    },
166
                    {
167
                        "data": "patron.firstname:patron.surname",
168
                        "title": "Patron",
169
                        "searchable": true,
170
                        "orderable": true,
171
                        "render": function(data, type, row, meta) {
172
                            return $patron_to_html(row.patron, {
173
                                display_cardnumber: true,
174
                                url: true
175
                            });
176
                        }
177
                    },
178
                    {
179
                        "data": "start_date",
180
                        "name": "start_date",
181
                        "title": "Booking dates",
182
                        "type": "date",
183
                        "searchable": false,
184
                        "orderable": true,
185
                        "render": function(data, type, row, meta) {
186
                            return $date(row.start_date) + ' - ' + $date(row.end_date);
187
                        }
188
                    },
189
                    {
190
                        "name": "actions",
191
                        "title": "Actions",
192
                        "searchable": false,
193
                        "orderable": false,
194
                        "render": function(data,type,row,meta){
195
                            return "";
196
                        }
197
                    }]
198
                }, table_settings, 1, additional_filters);
199
200
                /** Date filtering */
201
                $("#bookingsf").on("submit", function(e){
202
                    /* stop form from submitting normally */
203
                    e.preventDefault();
204
                    bookings_table.DataTable().draw();
205
                });
206
            });
207
        </script>
208
        [% END %]
209
        [% INCLUDE 'intranet-bottom.inc' %]

Return to bug 33736