Bugzilla – Attachment 194544 Details for
Bug 41993
Add a page to show items available for bookings
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 41993: (follow-up) Tidy and other QA fixes
Bug-41993-follow-up-Tidy-and-other-QA-fixes.patch (text/plain), 28.53 KB, created by
Owen Leonard
on 2026-03-05 17:17:49 UTC
(
hide
)
Description:
Bug 41993: (follow-up) Tidy and other QA fixes
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2026-03-05 17:17:49 UTC
Size:
28.53 KB
patch
obsolete
>From 3ee016b41a319ecbddd1240ebf2ce1384675697e Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Thu, 5 Mar 2026 11:48:33 -0500 >Subject: [PATCH] Bug 41993: (follow-up) Tidy and other QA fixes > >Fixing issues raised by the QA tool >--- > Koha/Items.pm | 33 +- > Koha/REST/V1/Items.pm | 12 +- > .../paths/items_available_for_booking.yaml | 2 +- > circ/available-bookings.pl | 12 +- > .../prog/en/includes/circ-nav.inc | 126 +++---- > .../en/modules/circ/available-bookings.tt | 337 +++++++++--------- > 6 files changed, 263 insertions(+), 259 deletions(-) > mode change 100644 => 100755 circ/available-bookings.pl > >diff --git a/Koha/Items.pm b/Koha/Items.pm >index 4eec60514e5..36f9aae3190 100644 >--- a/Koha/Items.pm >+++ b/Koha/Items.pm >@@ -205,7 +205,7 @@ during the specified period (not booked and not checked out). > =cut > > sub filter_by_bookable { >- my ($self, $params) = @_; >+ my ( $self, $params ) = @_; > > my $bookable_items; > if ( !C4::Context->preference('item-level_itypes') ) { >@@ -232,7 +232,7 @@ sub filter_by_bookable { > ); > } > >- return $self->_filter_by_availability($bookable_items, $params); >+ return $self->_filter_by_availability( $bookable_items, $params ); > } > > =head3 _filter_by_availability >@@ -242,7 +242,7 @@ Internal helper method to filter items by availability during a date range. > =cut > > sub _filter_by_availability { >- my ($self, $bookable_items, $params) = @_; >+ my ( $self, $bookable_items, $params ) = @_; > > return $bookable_items unless $params && $params->{start_date} && $params->{end_date}; > >@@ -267,17 +267,20 @@ sub _filter_by_availability { > ); > > my $item_start_date = $start_date->clone; >- my $item_end_date = $end_date->clone; >+ my $item_end_date = $end_date->clone; > >- if (defined $processing_rules->{'bookings_lead_period'} && $processing_rules->{'bookings_lead_period'} ne '') { >+ if ( defined $processing_rules->{'bookings_lead_period'} && $processing_rules->{'bookings_lead_period'} ne '' ) >+ { > my $lead_days = $processing_rules->{'bookings_lead_period'}; >- $item_start_date->subtract(days => $lead_days); >+ $item_start_date->subtract( days => $lead_days ); > $item_start_date->set_hour(0)->set_minute(0)->set_second(0); > } > >- if (defined $processing_rules->{'bookings_trail_period'} && $processing_rules->{'bookings_trail_period'} ne '') { >+ if ( defined $processing_rules->{'bookings_trail_period'} >+ && $processing_rules->{'bookings_trail_period'} ne '' ) >+ { > my $trail_days = $processing_rules->{'bookings_trail_period'}; >- $item_end_date->add(days => $trail_days); >+ $item_end_date->add( days => $trail_days ); > $item_end_date->set_hour(23)->set_minute(59)->set_second(59); > } > >@@ -313,18 +316,20 @@ sub _filter_by_availability { > } > ); > >- my $checkout = $item->checkout; >+ my $checkout = $item->checkout; > my $checkout_conflicts = 0; > if ($checkout) { >- my $due_date = dt_from_string($checkout->date_due); >+ my $due_date = dt_from_string( $checkout->date_due ); > $checkout_conflicts = 1 if $due_date >= $item_start_date; > } > >- if ($existing_bookings->count > 0 || $checkout_conflicts) { >+ if ( $existing_bookings->count > 0 || $checkout_conflicts ) { > push @excluded_items, $item->itemnumber; >+ > # Debug - uncomment to see why items are excluded: > # 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'); > } else { >+ > # Debug - uncomment to see items that pass: > # warn "PASSED Item #" . $item->itemnumber . " - Lead: " . ($processing_rules->{'bookings_lead_period'} // 'none') . ", Trail: " . ($processing_rules->{'bookings_trail_period'} // 'none'); > } >@@ -333,9 +338,7 @@ sub _filter_by_availability { > $bookable_items->reset; > > if (@excluded_items) { >- return $bookable_items->search({ >- 'me.itemnumber' => { '-not_in' => \@excluded_items } >- }); >+ return $bookable_items->search( { 'me.itemnumber' => { '-not_in' => \@excluded_items } } ); > } > > return $bookable_items; >@@ -889,4 +892,4 @@ Martin Renvoize <martin.renvoize@ptfs-europe.com> > > =cut > >-1; >\ No newline at end of file >+1; >diff --git a/Koha/REST/V1/Items.pm b/Koha/REST/V1/Items.pm >index 9ddcb46d787..cd4ba22eb63 100644 >--- a/Koha/REST/V1/Items.pm >+++ b/Koha/REST/V1/Items.pm >@@ -437,18 +437,20 @@ sub available_for_booking { > > return try { > my $start_date = $c->param('start_date'); >- my $end_date = $c->param('end_date'); >+ my $end_date = $c->param('end_date'); > > $c->req->params->remove('start_date'); > $c->req->params->remove('end_date'); > my $items_set = Koha::Items->new->filter_by_bookable( >- ($start_date && $end_date) ? { >+ ( $start_date && $end_date ) >+ ? { > start_date => $start_date, >- end_date => $end_date, >- } : undef >+ end_date => $end_date, >+ } >+ : undef > ); > >- my $items = $c->objects->search( $items_set ); >+ my $items = $c->objects->search($items_set); > return $c->render( status => 200, openapi => $items ); > > } catch { >diff --git a/api/v1/swagger/paths/items_available_for_booking.yaml b/api/v1/swagger/paths/items_available_for_booking.yaml >index 8ac5142c928..187499cb337 100644 >--- a/api/v1/swagger/paths/items_available_for_booking.yaml >+++ b/api/v1/swagger/paths/items_available_for_booking.yaml >@@ -78,4 +78,4 @@ > $ref: "../swagger.yaml#/definitions/error" > x-koha-authorization: > permissions: >- circulate: manage_bookings >\ No newline at end of file >+ circulate: manage_bookings >diff --git a/circ/available-bookings.pl b/circ/available-bookings.pl >old mode 100644 >new mode 100755 >index d22014175c6..fba05b9b6c5 >--- a/circ/available-bookings.pl >+++ b/circ/available-bookings.pl >@@ -15,7 +15,7 @@ > # GNU General Public License for more details. > # > # You should have received a copy of the GNU General Public License >-# along with Koha; if not, see <http://www.gnu.org/licenses>. >+# along with Koha; if not, see <https://www.gnu.org/licenses>. > > use Modern::Perl; > >@@ -39,14 +39,14 @@ my ( $template, $borrowernumber, $cookie, $flags ) = get_template_and_user( > > my $branchcode = defined( $input->param('library') ) ? $input->param('library') : C4::Context->userenv->{'branch'}; > >-my $today = dt_from_string(); >+my $today = dt_from_string(); > my $startdate = $today->clone->truncate( to => 'day' ); >-my $enddate = $startdate->clone->add( days => 7 ); >+my $enddate = $startdate->clone->add( days => 7 ); > > $template->param( >- branchcode => $branchcode, >+ branchcode => $branchcode, > start_date_default => $startdate, >- end_date_default => $enddate, >+ end_date_default => $enddate, > ); > >-output_html_with_http_headers $input, $cookie, $template->output; >\ No newline at end of file >+output_html_with_http_headers $input, $cookie, $template->output; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-nav.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-nav.inc >index 9d8832e5638..97cff2f81f7 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-nav.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-nav.inc >@@ -64,77 +64,77 @@ > </li> > </ul> > >- >- <div class="col-sm-6 col-md-12"> >+ <div class="col-sm-6 col-md-12"> > [% IF ( CAN_user_circulate_manage_bookings ) %] >- <h5>Bookings</h5> >- <ul> >- <li> >- <a href="/cgi-bin/koha/circ/pendingbookings.pl">Bookings to collect</a> >- </li> >- <li> >- <a href="/cgi-bin/koha/circ/available-bookings.pl">Items available for booking</a> >- </li> >- </ul> >+ <h5>Bookings</h5> >+ <ul> >+ <li> >+ <a href="/cgi-bin/koha/circ/pendingbookings.pl">Bookings to collect</a> >+ </li> >+ <li> >+ <a href="/cgi-bin/koha/circ/available-bookings.pl">Items available for booking</a> >+ </li> >+ </ul> > [% END %] > > [% IF Koha.Preference('UseRecalls') and CAN_user_recalls %] >- <h5>Recalls</h5> >- <ul> >- <li> >- <a href="/cgi-bin/koha/recalls/recalls_queue.pl" title="All active recalls">Recalls queue</a> >- </li> >- <li> >- <a href="/cgi-bin/koha/recalls/recalls_to_pull.pl" title="Recalls that could be filled but have not been set waiting">Recalls to pull</a> >- </li> >- <li> >- <a href="/cgi-bin/koha/recalls/recalls_overdue.pl" title="Recalled items that are overdue to be returned">Overdue recalls</a> >- </li> >- <li> >- <a href="/cgi-bin/koha/recalls/recalls_waiting.pl" title="Recalled items awaiting pickup">Recalls awaiting pickup</a> >- </li> >- <li> >- <a href="/cgi-bin/koha/recalls/recalls_old_queue.pl" title="Inactive recalls">Old recalls</a> >- </li> >- </ul> >- [% END %] >- >- [% IF Koha.Preference('ArticleRequests') %] >- <h5>Patron request</h5> >- <ul> >- <li> >- <a href="/cgi-bin/koha/circ/article-requests.pl">Article requests</a> >- </li> >- </ul> >- [% END %] >- >- <h5>Transfers</h5> >- <ul> >- [% IF !Koha.Preference('IndependentBranchesTransfers') || CAN_user_superlibrarian %] >- <li> >- <a href="/cgi-bin/koha/circ/branchtransfers.pl">Transfer</a> >- </li> >+ <h5>Recalls</h5> >+ <ul> >+ <li> >+ <a href="/cgi-bin/koha/recalls/recalls_queue.pl" title="All active recalls">Recalls queue</a> >+ </li> >+ <li> >+ <a href="/cgi-bin/koha/recalls/recalls_to_pull.pl" title="Recalls that could be filled but have not been set waiting">Recalls to pull</a> >+ </li> >+ <li> >+ <a href="/cgi-bin/koha/recalls/recalls_overdue.pl" title="Recalled items that are overdue to be returned">Overdue recalls</a> >+ </li> >+ <li> >+ <a href="/cgi-bin/koha/recalls/recalls_waiting.pl" title="Recalled items awaiting pickup">Recalls awaiting pickup</a> >+ </li> >+ <li> >+ <a href="/cgi-bin/koha/recalls/recalls_old_queue.pl" title="Inactive recalls">Old recalls</a> >+ </li> >+ </ul> > [% END %] >- [% IF Koha.Preference('StockRotation') %] >- <li> >- <a href="/cgi-bin/koha/circ/transfers_to_send.pl">Transfers to send</a> >- </li> >+ >+ [% IF Koha.Preference('ArticleRequests') %] >+ <h5>Patron request</h5> >+ <ul> >+ <li> >+ <a href="/cgi-bin/koha/circ/article-requests.pl">Article requests</a> >+ </li> >+ </ul> > [% END %] >- <li> >- <a href="/cgi-bin/koha/circ/transferstoreceive.pl">Transfers to receive</a> >- </li> >- </ul> > >- [% IF ( CAN_user_circulate_overdues_report ) %] >- <h5>Overdues</h5> >+ <h5>Transfers</h5> > <ul> >- <li> >- <a href="/cgi-bin/koha/circ/overdue.pl" title="Warning: This report is very resource intensive on systems with large numbers of overdue items.">Overdues</a> >- </li> >- <li> >- <a href="/cgi-bin/koha/circ/branchoverdues.pl" title="Limited to your library. See report help for other details.">Overdues with fines</a> >+ [% IF !Koha.Preference('IndependentBranchesTransfers') || CAN_user_superlibrarian %] >+ <li> >+ <a href="/cgi-bin/koha/circ/branchtransfers.pl">Transfer</a> >+ </li> >+ [% END %] >+ [% IF Koha.Preference('StockRotation') %] >+ <li> >+ <a href="/cgi-bin/koha/circ/transfers_to_send.pl">Transfers to send</a> >+ </li> >+ [% END %] >+ <li> >+ <a href="/cgi-bin/koha/circ/transferstoreceive.pl">Transfers to receive</a> > </li> > </ul> >- [% END %] >+ >+ [% IF ( CAN_user_circulate_overdues_report ) %] >+ <h5>Overdues</h5> >+ <ul> >+ <li> >+ <a href="/cgi-bin/koha/circ/overdue.pl" title="Warning: This report is very resource intensive on systems with large numbers of overdue items.">Overdues</a> >+ </li> >+ <li> >+ <a href="/cgi-bin/koha/circ/branchoverdues.pl" title="Limited to your library. See report help for other details.">Overdues with fines</a> >+ </li> >+ </ul> >+ [% END %] >+ </div> >+ <!-- /.sidebar_menu --> > </div> >-<!-- /.sidebar_menu --> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/available-bookings.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/available-bookings.tt >index d41ad3d2d04..0b86347704c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/available-bookings.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/available-bookings.tt >@@ -9,11 +9,12 @@ > [% PROCESS 'i18n.inc' %] > [% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] >-<title>[% FILTER collapse %] >- [% t("Items available for booking") | html %] › >- [% t("Circulation") | html %] › >- [% t("Koha") | html %] >-[% END %]</title> >+<title >+ >[% FILTER collapse %] >+ [% t("Items available for booking") | html %] >+ › [% t("Circulation") | html %] › [% t("Koha") | html %] >+ [% END %]</title >+> > [% INCLUDE 'doc-head-close.inc' %] > </head> > >@@ -35,7 +36,6 @@ > > <div class="main container-fluid"> > <div class="row"> >- > <!-- Results --> > <div class="col-md-10 order-md-2 order-sm1"> > <main> >@@ -57,11 +57,11 @@ > <ol> > <li> > <label for="start_date">Start date: </label> >- <input type="text" size="10" id="start_date" name="start_date" value="[% start_date_default | html %]" class="flatpickr" data-date_to="end_date" required/> >+ <input type="text" size="10" id="start_date" name="start_date" value="[% start_date_default | html %]" class="flatpickr" data-date_to="end_date" required /> > </li> > <li> > <label for="end_date">End date: </label> >- <input type="text" size="10" id="end_date" name="end_date" value="[% end_date_default | html %]" class="flatpickr" required/> >+ <input type="text" size="10" id="end_date" name="end_date" value="[% end_date_default | html %]" class="flatpickr" required /> > </li> > <li> > <label for="pickup_libraries">Pickup libraries:</label> >@@ -98,179 +98,178 @@ > </div> > > [% MACRO jsinclude BLOCK %] >-[% INCLUDE 'calendar.inc' %] >-[% INCLUDE 'datatables.inc' %] >-[% INCLUDE 'js-biblio-format.inc' %] >-[% INCLUDE 'js-date-format.inc' %] >- >-<script> >-let table_settings = [% TablesSettings.GetTableSettings( 'circ', 'available-bookings', 'available-items', 'json' ) | $raw %]; >+ [% INCLUDE 'calendar.inc' %] >+ [% INCLUDE 'datatables.inc' %] >+ [% INCLUDE 'js-biblio-format.inc' %] >+ [% INCLUDE 'js-date-format.inc' %] >+ <script> >+ let table_settings = [% TablesSettings.GetTableSettings( 'circ', 'available-bookings', 'available-items', 'json' ) | $raw %]; > >-$(document).ready(function() { >+ $(document).ready(function() { > >- let additional_filters = { >- 'me.holding_library_id': function() { >- let selectedLibraries = $("#pickup_libraries").val(); >- if (selectedLibraries && selectedLibraries.length > 0) { >- selectedLibraries = selectedLibraries.filter(lib => lib !== ''); >- if (selectedLibraries.length > 0) { >- return selectedLibraries; >+ let additional_filters = { >+ 'me.holding_library_id': function() { >+ let selectedLibraries = $("#pickup_libraries").val(); >+ if (selectedLibraries && selectedLibraries.length > 0) { >+ selectedLibraries = selectedLibraries.filter(lib => lib !== ''); >+ if (selectedLibraries.length > 0) { >+ return selectedLibraries; >+ } >+ } >+ return; >+ }, >+ 'me.item_type_id': function() { >+ let itemType = $("#item_type").val(); >+ if (itemType && itemType !== '') { >+ return itemType; >+ } >+ return; > } >- } >- return; >- }, >- 'me.item_type_id': function() { >- let itemType = $("#item_type").val(); >- if (itemType && itemType !== '') { >- return itemType; >- } >- return; >- } >- }; >+ }; > >- [% SET libraries = Branches.all %] >- let all_libraries = [% To.json(libraries) | $raw %].map(e => { >- e['_id'] = e.branchcode; >- e['_str'] = e.branchname; >- return e; >- }); >- let filters_options = {}; >+ [% SET libraries = Branches.all %] >+ let all_libraries = [% To.json(libraries) | $raw %].map(e => { >+ e['_id'] = e.branchcode; >+ e['_str'] = e.branchname; >+ return e; >+ }); >+ let filters_options = {}; > >- var available_items_table_url = '/api/v1/items/available_for_booking'; >+ var available_items_table_url = '/api/v1/items/available_for_booking'; > >- var available_items_table = $("#available_items_table").kohaTable({ >- "ajax": { >- "url": available_items_table_url >- }, >- "embed": [ >- "biblio", >- "+strings", >- "home_library", >- "holding_library", >- "item_type" >- ], >- "order": [[ 2, "asc" ]], >- "columns": [{ >- "data": "home_library.name", >- "title": _("Homebranch"), >- "searchable": true, >- "orderable": true, >- "render": function( data, type, row, meta ) { >- return escape_str(row.home_library_id ? row.home_library.name : row.home_library_id); >- } >- }, >- { >- "data": "holding_library.name", >- "title": _("Pickup library"), >- "searchable": true, >- "orderable": true, >- "render": function( data, type, row, meta ) { >- return escape_str(row.holding_library_id ? row.holding_library.name : row.holding_library_id); >- } >- }, >- { >- "data": "biblio.title", >- "title": _("Title"), >- "searchable": true, >- "orderable": true, >- "render": function(data,type,row,meta) { >- if ( row.biblio ) { >- return $biblio_to_html(row.biblio, { >- link: 'detail' >- }); >- } else { >- return 'No title'; >- } >- } >- }, >- { >- "data": "item_type_id", >- "title": _("Item type"), >- "searchable": true, >- "orderable": true, >- "render": function(data,type,row,meta) { >- if ( row.item_type && row.item_type.description ) { >- return escape_str(row.item_type.description); >- } else if ( row._strings && row._strings.item_type_id ) { >- return escape_str(row._strings.item_type_id.str); >- } else { >- return escape_str(row.item_type_id || ''); >- } >- } >- }, >- { >- "data": "external_id", >- "title": _("Barcode"), >- "searchable": true, >- "orderable": true >- }, >- { >- "data": "callnumber", >- "title": _("Callnumber"), >- "searchable": true, >- "orderable": true >- }, >- { >- "data": "location", >- "title": _("Location"), >- "searchable": true, >- "orderable": true, >- "render": function(data,type,row,meta) { >- if ( row._strings && row._strings.location ) { >- return row._strings.location.str; >- } else { >- return row.location || ''; >- } >- } >- }, >- { >- "data": "localuse", >- "title": _("Local use"), >- "searchable": true, >- "orderable": true >- }] >- }, table_settings, 1, additional_filters, filters_options); >+ var available_items_table = $("#available_items_table").kohaTable({ >+ "ajax": { >+ "url": available_items_table_url >+ }, >+ "embed": [ >+ "biblio", >+ "+strings", >+ "home_library", >+ "holding_library", >+ "item_type" >+ ], >+ "order": [[ 2, "asc" ]], >+ "columns": [{ >+ "data": "home_library.name", >+ "title": _("Homebranch"), >+ "searchable": true, >+ "orderable": true, >+ "render": function( data, type, row, meta ) { >+ return escape_str(row.home_library_id ? row.home_library.name : row.home_library_id); >+ } >+ }, >+ { >+ "data": "holding_library.name", >+ "title": _("Pickup library"), >+ "searchable": true, >+ "orderable": true, >+ "render": function( data, type, row, meta ) { >+ return escape_str(row.holding_library_id ? row.holding_library.name : row.holding_library_id); >+ } >+ }, >+ { >+ "data": "biblio.title", >+ "title": _("Title"), >+ "searchable": true, >+ "orderable": true, >+ "render": function(data,type,row,meta) { >+ if ( row.biblio ) { >+ return $biblio_to_html(row.biblio, { >+ link: 'detail' >+ }); >+ } else { >+ return 'No title'; >+ } >+ } >+ }, >+ { >+ "data": "item_type_id", >+ "title": _("Item type"), >+ "searchable": true, >+ "orderable": true, >+ "render": function(data,type,row,meta) { >+ if ( row.item_type && row.item_type.description ) { >+ return escape_str(row.item_type.description); >+ } else if ( row._strings && row._strings.item_type_id ) { >+ return escape_str(row._strings.item_type_id.str); >+ } else { >+ return escape_str(row.item_type_id || ''); >+ } >+ } >+ }, >+ { >+ "data": "external_id", >+ "title": _("Barcode"), >+ "searchable": true, >+ "orderable": true >+ }, >+ { >+ "data": "callnumber", >+ "title": _("Callnumber"), >+ "searchable": true, >+ "orderable": true >+ }, >+ { >+ "data": "location", >+ "title": _("Location"), >+ "searchable": true, >+ "orderable": true, >+ "render": function(data,type,row,meta) { >+ if ( row._strings && row._strings.location ) { >+ return row._strings.location.str; >+ } else { >+ return row.location || ''; >+ } >+ } >+ }, >+ { >+ "data": "localuse", >+ "title": _("Local use"), >+ "searchable": true, >+ "orderable": true >+ }] >+ }, table_settings, 1, additional_filters, filters_options); > >- $("#available_items_filter").on("submit", function(e){ >- e.preventDefault(); >+ $("#available_items_filter").on("submit", function(e){ >+ e.preventDefault(); > >- if (!$("#start_date").val() || !$("#end_date").val()) { >- alert("Please select both start and end dates"); >- return false; >- } >- let newUrl = '/api/v1/items/available_for_booking'; >- let params = []; >+ if (!$("#start_date").val() || !$("#end_date").val()) { >+ alert("Please select both start and end dates"); >+ return false; >+ } >+ let newUrl = '/api/v1/items/available_for_booking'; >+ let params = []; > >- let fromdate = $("#start_date"); >- let todate = $("#end_date"); >- if ( fromdate.val() !== '' && todate.val() !== '' ) { >- let fromDateStr = fromdate.val(); >- let toDateStr = todate.val(); >- params.push('start_date=' + encodeURIComponent(fromDateStr)); >- params.push('end_date=' + encodeURIComponent(toDateStr)); >+ let fromdate = $("#start_date"); >+ let todate = $("#end_date"); >+ if ( fromdate.val() !== '' && todate.val() !== '' ) { >+ let fromDateStr = fromdate.val(); >+ let toDateStr = todate.val(); >+ params.push('start_date=' + encodeURIComponent(fromDateStr)); >+ params.push('end_date=' + encodeURIComponent(toDateStr)); > >- } >- if (params.length > 0) { >- newUrl += '?' + params.join('&'); >- } >- available_items_table.DataTable().ajax.url(newUrl).load(); >- }); >+ } >+ if (params.length > 0) { >+ newUrl += '?' + params.join('&'); >+ } >+ available_items_table.DataTable().ajax.url(newUrl).load(); >+ }); > >- $("#available_items_filter input[type=reset]").on("click", function(e){ >- $("#pickup_libraries").val([]); >- $("#item_type").val(''); >- $("#start_date").val('[% start_date_default | html %]'); >- $("#end_date").val('[% end_date_default | html %]'); >+ $("#available_items_filter input[type=reset]").on("click", function(e){ >+ $("#pickup_libraries").val([]); >+ $("#item_type").val(''); >+ $("#start_date").val('[% start_date_default | html %]'); >+ $("#end_date").val('[% end_date_default | html %]'); > >- let resetUrl = '/api/v1/items/available_for_booking'; >- if ('[% start_date_default %]' && '[% end_date_default %]') { >- resetUrl += '?start_date=[% start_date_default | uri %]&end_date=[% end_date_default | uri %]'; >- } >- available_items_table.DataTable().ajax.url(resetUrl).load(); >- }); >+ let resetUrl = '/api/v1/items/available_for_booking'; >+ if ('[% start_date_default | html %]' && '[% end_date_default | html %]') { >+ resetUrl += '?start_date=[% start_date_default | uri %]&end_date=[% end_date_default | uri %]'; >+ } >+ available_items_table.DataTable().ajax.url(resetUrl).load(); >+ }); > >-}); >-</script> >+ }); >+ </script> > [% END %] > >-[% INCLUDE 'intranet-bottom.inc' %] >\ No newline at end of file >+[% INCLUDE 'intranet-bottom.inc' %] >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 41993
:
194490
|
194543
| 194544 |
194545