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

(-)a/Koha/Items.pm (-11 / +127 lines)
Lines 36-41 use Koha::CirculationRules; Link Here
36
use base qw(Koha::Objects);
36
use base qw(Koha::Objects);
37
37
38
use Koha::SearchEngine::Indexer;
38
use Koha::SearchEngine::Indexer;
39
use Koha::DateUtils qw( dt_from_string);
39
40
40
=head1 NAME
41
=head1 NAME
41
42
Lines 192-207 sub filter_out_lost { Link Here
192
=head3 filter_by_bookable
193
=head3 filter_by_bookable
193
194
194
  my $filterd_items = $items->filter_by_bookable;
195
  my $filterd_items = $items->filter_by_bookable;
196
  my $filterd_items = $items->filter_by_bookable({
197
      start_date => '2024-01-01',
198
      end_date   => '2024-01-07'
199
  });
195
200
196
Returns a new resultset, containing only those items that are allowed to be booked.
201
Returns a new resultset, containing only those items that are allowed to be booked.
202
If start_date and end_date are provided, also filters out items that are not available
203
during the specified period (not booked and not checked out).
197
204
198
=cut
205
=cut
199
206
200
sub filter_by_bookable {
207
sub filter_by_bookable {
201
    my ($self) = @_;
208
    my ($self, $params) = @_;
202
209
210
    my $bookable_items;
203
    if ( !C4::Context->preference('item-level_itypes') ) {
211
    if ( !C4::Context->preference('item-level_itypes') ) {
204
        return $self->search(
212
        $bookable_items = $self->search(
205
            [
213
            [
206
                { bookable => 1 },
214
                { bookable => 1 },
207
                {
215
                {
Lines 212-228 sub filter_by_bookable { Link Here
212
            ],
220
            ],
213
            { join => 'biblioitem' }
221
            { join => 'biblioitem' }
214
        );
222
        );
223
    } else {
224
        $bookable_items = $self->search(
225
            [
226
                { bookable => 1 },
227
                {
228
                    bookable => undef,
229
                    itype    => { -in => [ Koha::ItemTypes->search( { bookable => 1 } )->get_column('itemtype') ] }
230
                },
231
            ]
232
        );
215
    }
233
    }
216
234
217
    return $self->search(
235
    return $self->_filter_by_availability($bookable_items, $params);
218
        [
236
}
219
            { bookable => 1 },
237
238
=head3 _filter_by_availability
239
240
Internal helper method to filter items by availability during a date range.
241
242
=cut
243
244
sub _filter_by_availability {
245
    my ($self, $bookable_items, $params) = @_;
246
247
    return $bookable_items unless $params && $params->{start_date} && $params->{end_date};
248
249
    my $start_date = dt_from_string( $params->{start_date} );
250
    my $end_date   = dt_from_string( $params->{end_date} );
251
252
    $start_date->set_hour(0)->set_minute(0)->set_second(0);
253
    $end_date->set_hour(23)->set_minute(59)->set_second(59);
254
255
    my $dtf = Koha::Database->new->schema->storage->datetime_parser;
256
    my @excluded_items;
257
258
    while ( my $item = $bookable_items->next ) {
259
260
        my $processing_rules = Koha::CirculationRules->get_effective_rules(
220
            {
261
            {
221
                bookable => undef,
262
                categorycode => '*',
222
                itype    => { -in => [ Koha::ItemTypes->search( { bookable => 1 } )->get_column('itemtype') ] }
263
                itemtype     => $item->effective_itemtype,
223
            },
264
                branchcode   => $item->homebranch,
224
        ]
265
                rules        => [ 'bookings_lead_period', 'bookings_trail_period' ]
225
    );
266
            }
267
        );
268
269
        my $item_start_date = $start_date->clone;
270
        my $item_end_date = $end_date->clone;
271
272
        if (defined $processing_rules->{'bookings_lead_period'} && $processing_rules->{'bookings_lead_period'} ne '') {
273
            my $lead_days = $processing_rules->{'bookings_lead_period'};
274
            $item_start_date->subtract(days => $lead_days);
275
            $item_start_date->set_hour(0)->set_minute(0)->set_second(0);
276
        }
277
278
        if (defined $processing_rules->{'bookings_trail_period'} && $processing_rules->{'bookings_trail_period'} ne '') {
279
            my $trail_days = $processing_rules->{'bookings_trail_period'};
280
            $item_end_date->add(days => $trail_days);
281
            $item_end_date->set_hour(23)->set_minute(59)->set_second(59);
282
        }
283
284
        my $existing_bookings = $item->bookings(
285
            {
286
                '-and' => [
287
                    {
288
                        '-or' => [
289
                            {
290
                                start_date => {
291
                                    '-between' => [
292
                                        $dtf->format_datetime($item_start_date),
293
                                        $dtf->format_datetime($item_end_date)
294
                                    ]
295
                                }
296
                            },
297
                            {
298
                                end_date => {
299
                                    '-between' => [
300
                                        $dtf->format_datetime($item_start_date),
301
                                        $dtf->format_datetime($item_end_date)
302
                                    ]
303
                                }
304
                            },
305
                            {
306
                                start_date => { '<' => $dtf->format_datetime($item_start_date) },
307
                                end_date   => { '>' => $dtf->format_datetime($item_end_date) }
308
                            }
309
                        ]
310
                    },
311
                    { status => { '-not_in' => [ 'cancelled', 'completed' ] } }
312
                ]
313
            }
314
        );
315
316
        my $checkout = $item->checkout;
317
        my $checkout_conflicts = 0;
318
        if ($checkout) {
319
            my $due_date = dt_from_string($checkout->date_due);
320
            $checkout_conflicts = 1 if $due_date >= $item_start_date;
321
        }
322
323
        if ($existing_bookings->count > 0 || $checkout_conflicts) {
324
            push @excluded_items, $item->itemnumber;
325
            # Debug - uncomment to see why items are excluded:
326
            # warn "EXCLUDED Item #" . $item->itemnumber . " - Bookings: " . $existing_bookings->count . ", Checkout conflicts: $checkout_conflicts, Lead: " . ($processing_rules->{'bookings_lead_period'} // 'none') . ", Trail: " . ($processing_rules->{'bookings_trail_period'} // 'none');
327
        } else {
328
            # Debug - uncomment to see items that pass:
329
            # warn "PASSED Item #" . $item->itemnumber . " - Lead: " . ($processing_rules->{'bookings_lead_period'} // 'none') . ", Trail: " . ($processing_rules->{'bookings_trail_period'} // 'none');
330
        }
331
    }
332
333
    $bookable_items->reset;
334
335
    if (@excluded_items) {
336
        return $bookable_items->search({
337
            'me.itemnumber' => { '-not_in' => \@excluded_items }
338
        });
339
    }
340
341
    return $bookable_items;
226
}
342
}
227
343
228
=head3 filter_by_checked_out
344
=head3 filter_by_checked_out
Lines 773-776 Martin Renvoize <martin.renvoize@ptfs-europe.com> Link Here
773
889
774
=cut
890
=cut
775
891
776
1;
892
1;
(-)a/Koha/REST/V1/Items.pm (+32 lines)
Lines 22-27 use Mojo::Base 'Mojolicious::Controller'; Link Here
22
use C4::Circulation qw( barcodedecode );
22
use C4::Circulation qw( barcodedecode );
23
23
24
use Koha::Items;
24
use Koha::Items;
25
use Koha::DateUtils;
26
use Koha::Database;
25
27
26
use List::MoreUtils qw( any );
28
use List::MoreUtils qw( any );
27
use Try::Tiny       qw( catch try );
29
use Try::Tiny       qw( catch try );
Lines 424-427 sub remove_from_bundle { Link Here
424
    };
426
    };
425
}
427
}
426
428
429
=head3 available_for_booking
430
431
Controller function that handles retrieving items available for booking
432
433
=cut
434
435
sub available_for_booking {
436
    my $c = shift->openapi->valid_input or return;
437
438
    return try {
439
        my $start_date = $c->param('start_date');
440
        my $end_date = $c->param('end_date');
441
442
        $c->req->params->remove('start_date');
443
        $c->req->params->remove('end_date');
444
        my $items_set = Koha::Items->new->filter_by_bookable(
445
            ($start_date && $end_date) ? {
446
                start_date => $start_date,
447
                end_date => $end_date,
448
            } : undef
449
        );
450
451
        my $items = $c->objects->search( $items_set );
452
        return $c->render( status => 200, openapi => $items );
453
454
    } catch {
455
        $c->unhandled_exception($_);
456
    };
457
}
458
427
1;
459
1;
(-)a/admin/columns_settings.yml (+21 lines)
Lines 2400-2405 modules: Link Here
2400
                -
2400
                -
2401
                    columnname: booking_dates
2401
                    columnname: booking_dates
2402
2402
2403
    available-bookings:
2404
        available-items:
2405
            default_sort_order: 2
2406
            columns:
2407
                -
2408
                    columnname: holding_library
2409
                -
2410
                    columnname: home_library
2411
                -
2412
                    columnname: title
2413
                -
2414
                    columnname: item_type
2415
                -
2416
                    columnname: barcode
2417
                -
2418
                    columnname: call_number
2419
                -
2420
                    columnname: location
2421
                -
2422
                    columnname: localuse
2423
2403
  opac:
2424
  opac:
2404
    biblio-detail:
2425
    biblio-detail:
2405
      holdingst:
2426
      holdingst:
(-)a/api/v1/swagger/paths/items_available_for_booking.yaml (+81 lines)
Line 0 Link Here
1
---
2
/items/available_for_booking:
3
  get:
4
    x-mojo-to: Items#available_for_booking
5
    operationId: listItemsAvailableForBooking
6
    tags:
7
      - items
8
    summary: List items available for booking
9
    parameters:
10
      - description: Start date for availability period (YYYY-MM-DD format)
11
        in: query
12
        name: start_date
13
        required: false
14
        type: string
15
      - description: End date for availability period (YYYY-MM-DD format)
16
        in: query
17
        name: end_date
18
        required: false
19
        type: string
20
      - name: x-koha-embed
21
        in: header
22
        required: false
23
        description: Embed list sent as a request header
24
        type: array
25
        items:
26
          type: string
27
          enum:
28
            - +strings
29
            - biblio
30
            - effective_bookable
31
            - home_library
32
            - holding_library
33
            - item_type
34
        collectionFormat: csv
35
      - $ref: "../swagger.yaml#/parameters/match"
36
      - $ref: "../swagger.yaml#/parameters/order_by"
37
      - $ref: "../swagger.yaml#/parameters/page"
38
      - $ref: "../swagger.yaml#/parameters/per_page"
39
      - $ref: "../swagger.yaml#/parameters/q_param"
40
      - $ref: "../swagger.yaml#/parameters/q_body"
41
      - $ref: "../swagger.yaml#/parameters/request_id_header"
42
    consumes:
43
      - application/json
44
    produces:
45
      - application/json
46
    responses:
47
      "200":
48
        description: A list of items available for booking
49
        schema:
50
          type: array
51
          items:
52
            $ref: "../swagger.yaml#/definitions/item"
53
      "400":
54
        description: |
55
          Bad request. Possible `error_code` attribute values:
56
57
            * `invalid_query`
58
        schema:
59
          $ref: "../swagger.yaml#/definitions/error"
60
      "401":
61
        description: Authentication required
62
        schema:
63
          $ref: "../swagger.yaml#/definitions/error"
64
      "403":
65
        description: Access forbidden
66
        schema:
67
          $ref: "../swagger.yaml#/definitions/error"
68
      "500":
69
        description: |
70
          Internal server error. Possible `error_code` attribute values:
71
72
          * `internal_server_error`
73
        schema:
74
          $ref: "../swagger.yaml#/definitions/error"
75
      "503":
76
        description: Under maintenance
77
        schema:
78
          $ref: "../swagger.yaml#/definitions/error"
79
    x-koha-authorization:
80
      permissions:
81
        circulate: manage_bookings
(-)a/api/v1/swagger/swagger.yaml (+2 lines)
Lines 463-468 paths: Link Here
463
    $ref: ./paths/item_types.yaml#/~1item_types
463
    $ref: ./paths/item_types.yaml#/~1item_types
464
  /items:
464
  /items:
465
    $ref: ./paths/items.yaml#/~1items
465
    $ref: ./paths/items.yaml#/~1items
466
  /items/available_for_booking:
467
    $ref: ./paths/items_available_for_booking.yaml#/~1items~1available_for_booking
466
  "/items/{item_id}":
468
  "/items/{item_id}":
467
    $ref: "./paths/items.yaml#/~1items~1{item_id}"
469
    $ref: "./paths/items.yaml#/~1items~1{item_id}"
468
  "/items/{item_id}/bookings":
470
  "/items/{item_id}/bookings":
(-)a/circ/available-bookings.pl (+52 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# Copyright 2024
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::Context;
25
use C4::Output qw( output_html_with_http_headers );
26
use C4::Auth   qw( get_template_and_user );
27
28
use Koha::DateUtils qw(dt_from_string);
29
30
my $input = CGI->new;
31
my ( $template, $borrowernumber, $cookie, $flags ) = get_template_and_user(
32
    {
33
        template_name => "circ/available-bookings.tt",
34
        query         => $input,
35
        type          => "intranet",
36
        flagsrequired => { circulate => 'manage_bookings' },
37
    }
38
);
39
40
my $branchcode = defined( $input->param('library') ) ? $input->param('library') : C4::Context->userenv->{'branch'};
41
42
my $today = dt_from_string();
43
my $startdate = $today->clone->truncate( to => 'day' );
44
my $enddate = $startdate->clone->add( days => 7 );
45
46
$template->param(
47
    branchcode => $branchcode,
48
    start_date_default => $startdate,
49
    end_date_default => $enddate,
50
);
51
52
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-nav.inc (-1 / +15 lines)
Lines 64-70 Link Here
64
        </li>
64
        </li>
65
    </ul>
65
    </ul>
66
66
67
    [% IF Koha.Preference('UseRecalls') and CAN_user_recalls %]
67
68
        <div class="col-sm-6 col-md-12">
69
        [% IF ( CAN_user_circulate_manage_bookings ) %]
70
        <h5>Bookings</h5>
71
        <ul>
72
            <li>
73
                <a href="/cgi-bin/koha/circ/pendingbookings.pl">Bookings to collect</a>
74
            </li>
75
            <li>
76
                <a href="/cgi-bin/koha/circ/available-bookings.pl">Items available for booking</a>
77
            </li>
78
        </ul>
79
        [% END %]
80
81
        [% IF Koha.Preference('UseRecalls') and CAN_user_recalls %]
68
        <h5>Recalls</h5>
82
        <h5>Recalls</h5>
69
        <ul>
83
        <ul>
70
            <li>
84
            <li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/available-bookings.tt (+276 lines)
Line 0 Link Here
1
[% USE raw %]
2
[% USE Asset %]
3
[% USE Branches %]
4
[% USE Koha %]
5
[% USE KohaDates %]
6
[% USE TablesSettings %]
7
[% USE To %]
8
[% USE ItemTypes %]
9
[% PROCESS 'i18n.inc' %]
10
[% SET footerjs = 1 %]
11
[% INCLUDE 'doc-head-open.inc' %]
12
<title>[% FILTER collapse %]
13
    [% t("Items available for booking") | html %] &rsaquo;
14
    [% t("Circulation") | html %] &rsaquo;
15
    [% t("Koha") | html %]
16
[% END %]</title>
17
[% INCLUDE 'doc-head-close.inc' %]
18
</head>
19
20
<body id="circ_available_for_booking" class="circ">
21
[% WRAPPER 'header.inc' %]
22
    [% INCLUDE 'circ-search.inc' %]
23
[% END %]
24
25
[% WRAPPER 'sub-header.inc' %]
26
    [% WRAPPER breadcrumbs %]
27
        [% WRAPPER breadcrumb_item %]
28
            <a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a>
29
        [% END %]
30
        [% WRAPPER breadcrumb_item bc_active= 1 %]
31
            <span>Items available for booking</span>
32
        [% END %]
33
    [% END #/ WRAPPER breadcrumbs %]
34
[% END #/ WRAPPER sub-header.inc %]
35
36
<div class="main container-fluid">
37
    <div class="row">
38
39
        <!-- Results -->
40
        <div class="col-md-10 order-md-2 order-sm1">
41
            <main>
42
                [% INCLUDE 'messages.inc' %]
43
                <h1>Items available for booking</h1>
44
                <p>Items with bookable status that are not booked and not checked out for the requested period.</p>
45
                <div id="searchresults">
46
                    <table id="available_items_table"></table>
47
                </div>
48
            </main>
49
        </div>
50
51
        <!-- Filters & Navigation -->
52
        <div class="col-md-2 order-sm-2 order-md-1">
53
            <aside>
54
                <form id="available_items_filter">
55
                    <fieldset class="rows">
56
                        <h4>Filter by</h4>
57
                        <ol>
58
                            <li>
59
                                <label for="start_date">Start date: </label>
60
                                <input type="text" size="10" id="start_date" name="start_date" value="[% start_date_default | html %]" class="flatpickr" data-date_to="end_date" required/>
61
                            </li>
62
                            <li>
63
                                <label for="end_date">End date: </label>
64
                                <input type="text" size="10" id="end_date" name="end_date" value="[% end_date_default | html %]" class="flatpickr" required/>
65
                            </li>
66
                            <li>
67
                                <label for="pickup_libraries">Pickup libraries:</label>
68
                                <select name="pickup_libraries" id="pickup_libraries" multiple size="10">
69
                                    [% SET libraries = Branches.all( only_from_group => 1 ) %]
70
                                    <option value="">All libraries</option>
71
                                    [% FOREACH l IN libraries %]
72
                                        <option value="[% l.branchcode | html %]">[% l.branchname | html %]</option>
73
                                    [% END %]
74
                                </select>
75
                            </li>
76
                            <li>
77
                                <label for="item_type">Item type:</label>
78
                                <select name="item_type" id="item_type" style="width: auto; min-width: 200px;">
79
                                    <option value="">Any</option>
80
                                    [% FOREACH itemtype IN ItemTypes.Get() %]
81
                                        <option value="[% itemtype.itemtype | html %]">[% itemtype.description | html %]</option>
82
                                    [% END %]
83
                                </select>
84
                            </li>
85
                        </ol>
86
                    </fieldset>
87
                    <fieldset class="action">
88
                        <input type="submit" name="run_report" value="Search" class="btn btn-primary" />
89
                        <input type="reset" name="clear_form" value="Clear" class="btn btn-default" />
90
                    </fieldset>
91
                </form>
92
93
                [% INCLUDE 'circ-nav.inc' %]
94
            </aside>
95
        </div>
96
    </div>
97
    <!-- /.row -->
98
</div>
99
100
[% MACRO jsinclude BLOCK %]
101
[% INCLUDE 'calendar.inc' %]
102
[% INCLUDE 'datatables.inc' %]
103
[% INCLUDE 'js-biblio-format.inc' %]
104
[% INCLUDE 'js-date-format.inc' %]
105
106
<script>
107
let table_settings = [% TablesSettings.GetTableSettings( 'circ', 'available-bookings', 'available-items', 'json' ) | $raw %];
108
109
$(document).ready(function() {
110
111
    let additional_filters = {
112
        'me.holding_library_id': function() {
113
            let selectedLibraries = $("#pickup_libraries").val();
114
            if (selectedLibraries && selectedLibraries.length > 0) {
115
                selectedLibraries = selectedLibraries.filter(lib => lib !== '');
116
                if (selectedLibraries.length > 0) {
117
                    return selectedLibraries;
118
                }
119
            }
120
            return;
121
        },
122
        'me.item_type_id': function() {
123
            let itemType = $("#item_type").val();
124
            if (itemType && itemType !== '') {
125
                return itemType;
126
            }
127
            return;
128
        }
129
    };
130
131
    [% SET libraries = Branches.all %]
132
    let all_libraries  = [% To.json(libraries) | $raw %].map(e => {
133
        e['_id'] = e.branchcode;
134
        e['_str'] = e.branchname;
135
        return e;
136
    });
137
    let filters_options = {};
138
139
    var available_items_table_url = '/api/v1/items/available_for_booking';
140
141
    var available_items_table = $("#available_items_table").kohaTable({
142
        "ajax": {
143
            "url": available_items_table_url
144
        },
145
        "embed": [
146
            "biblio",
147
            "+strings",
148
            "home_library",
149
            "holding_library",
150
            "item_type"
151
        ],
152
        "order": [[ 2, "asc" ]],
153
        "columns": [{
154
            "data": "home_library.name",
155
            "title": _("Homebranch"),
156
            "searchable": true,
157
            "orderable": true,
158
            "render": function( data, type, row, meta ) {
159
                return escape_str(row.home_library_id ? row.home_library.name : row.home_library_id);
160
            }
161
        },
162
        {
163
            "data": "holding_library.name",
164
            "title": _("Pickup library"),
165
            "searchable": true,
166
            "orderable": true,
167
            "render": function( data, type, row, meta ) {
168
                return escape_str(row.holding_library_id ? row.holding_library.name : row.holding_library_id);
169
            }
170
        },
171
        {
172
            "data": "biblio.title",
173
            "title": _("Title"),
174
            "searchable": true,
175
            "orderable": true,
176
            "render": function(data,type,row,meta) {
177
                if ( row.biblio ) {
178
                    return $biblio_to_html(row.biblio, {
179
                        link: 'detail'
180
                    });
181
                } else {
182
                    return 'No title';
183
                }
184
            }
185
        },
186
        {
187
            "data": "item_type_id",
188
            "title": _("Item type"),
189
            "searchable": true,
190
            "orderable": true,
191
            "render": function(data,type,row,meta) {
192
                if ( row.item_type && row.item_type.description ) {
193
                    return escape_str(row.item_type.description);
194
                } else if ( row._strings && row._strings.item_type_id ) {
195
                    return escape_str(row._strings.item_type_id.str);
196
                } else {
197
                    return escape_str(row.item_type_id || '');
198
                }
199
            }
200
        },
201
        {
202
            "data": "external_id",
203
            "title": _("Barcode"),
204
            "searchable": true,
205
            "orderable": true
206
        },
207
        {
208
            "data": "callnumber",
209
            "title": _("Callnumber"),
210
            "searchable": true,
211
            "orderable": true
212
        },
213
        {
214
            "data": "location",
215
            "title": _("Location"),
216
            "searchable": true,
217
            "orderable": true,
218
            "render": function(data,type,row,meta) {
219
                if ( row._strings && row._strings.location ) {
220
                    return row._strings.location.str;
221
                } else {
222
                    return row.location || '';
223
                }
224
            }
225
        },
226
        {
227
            "data": "localuse",
228
            "title": _("Local use"),
229
            "searchable": true,
230
            "orderable": true
231
        }]
232
    }, table_settings, 1, additional_filters, filters_options);
233
234
    $("#available_items_filter").on("submit", function(e){
235
        e.preventDefault();
236
237
        if (!$("#start_date").val() || !$("#end_date").val()) {
238
            alert("Please select both start and end dates");
239
            return false;
240
        }
241
        let newUrl = '/api/v1/items/available_for_booking';
242
        let params = [];
243
244
        let fromdate = $("#start_date");
245
        let todate = $("#end_date");
246
        if ( fromdate.val() !== '' && todate.val() !== '' ) {
247
          let fromDateStr = fromdate.val();
248
          let toDateStr = todate.val();
249
          params.push('start_date=' + encodeURIComponent(fromDateStr));
250
          params.push('end_date=' + encodeURIComponent(toDateStr));
251
252
        }
253
        if (params.length > 0) {
254
            newUrl += '?' + params.join('&');
255
        }
256
        available_items_table.DataTable().ajax.url(newUrl).load();
257
    });
258
259
    $("#available_items_filter input[type=reset]").on("click", function(e){
260
        $("#pickup_libraries").val([]);
261
        $("#item_type").val('');
262
        $("#start_date").val('[% start_date_default | html %]');
263
        $("#end_date").val('[% end_date_default | html %]');
264
265
        let resetUrl = '/api/v1/items/available_for_booking';
266
        if ('[% start_date_default %]' && '[% end_date_default %]') {
267
            resetUrl += '?start_date=[% start_date_default | uri %]&end_date=[% end_date_default | uri %]';
268
        }
269
        available_items_table.DataTable().ajax.url(resetUrl).load();
270
    });
271
272
});
273
</script>
274
[% END %]
275
276
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt (-1 / +3 lines)
Lines 100-105 Link Here
100
                        <li>
100
                        <li>
101
                            <a class="circ-button bookings-to-collect" href="/cgi-bin/koha/circ/pendingbookings.pl"><i class="fa-solid fa-calendar-days"></i> Bookings to collect</a>
101
                            <a class="circ-button bookings-to-collect" href="/cgi-bin/koha/circ/pendingbookings.pl"><i class="fa-solid fa-calendar-days"></i> Bookings to collect</a>
102
                        </li>
102
                        </li>
103
                        <li>
104
                            <a class="circ-button" href="/cgi-bin/koha/circ/available-bookings.pl"><i class="fa-solid fa-calendar-days"></i> Items available for bookings</a>
105
                        </li>
103
                    [% END %]
106
                    [% END %]
104
                </ul>
107
                </ul>
105
            </div>
108
            </div>
106
- 

Return to bug 41993