Bugzilla – Attachment 161897 Details for
Bug 35248
Bookings needs unit tests
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35248: Whitespace clean
Bug-35248-Whitespace-clean.patch (text/plain), 10.75 KB, created by
Martin Renvoize
on 2024-02-08 12:23:53 UTC
(
hide
)
Description:
Bug 35248: Whitespace clean
Filename:
MIME Type:
Creator:
Martin Renvoize
Created:
2024-02-08 12:23:53 UTC
Size:
10.75 KB
patch
obsolete
>From 67dc72327d8cc4ef6612ed66cecdf76b73a1e47e Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 11 Jan 2024 11:14:27 +0000 >Subject: [PATCH] Bug 35248: Whitespace clean > >Jonathan highlighted some trailing whitespace.. I only see a few cases >where a line only contains whitespace and I didn't see these caught by >the QA script at the time of submission. > >Anyway, this removes the spaces >--- > .../prog/js/place_booking_modal.js | 74 +++++++++---------- > 1 file changed, 37 insertions(+), 37 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/place_booking_modal.js b/koha-tmpl/intranet-tmpl/prog/js/place_booking_modal.js >index b4f13bf2d99..946be01e3cd 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/place_booking_modal.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/place_booking_modal.js >@@ -121,7 +121,7 @@ $('#placeBookingModal').on('show.bs.modal', function(e) { > dataType: 'json', > type: 'GET' > }); >- >+ > // Fetch list of existing bookings > let bookingsFetch = $.ajax({ > url: '/api/v1/bookings?biblio_id=' + biblionumber, >@@ -135,7 +135,7 @@ $('#placeBookingModal').on('show.bs.modal', function(e) { > dataType: 'json', > type: 'GET' > }); >- >+ > // Update item select2 and period flatpickr > $.when(itemsFetch, bookingsFetch, checkoutsFetch).then( > function(itemsFetch,bookingsFetch, checkoutsFetch){ >@@ -157,7 +157,7 @@ $('#placeBookingModal').on('show.bs.modal', function(e) { > }; > bookings.unshift(booking); > } >- >+ > // Item select2 > $("#booking_item_id").select2({ > dropdownParent: $(".modal-content", "#placeBookingModal"), >@@ -166,13 +166,13 @@ $('#placeBookingModal').on('show.bs.modal', function(e) { > minimumResultsForSearch: 20, > placeholder: __("Select item") > }); >- >+ > // Update flatpickr mode > periodPicker.set('mode', 'range'); >- >+ > // Total bookable items > let bookable = 0; >- >+ > for (item of bookable_items) { > bookable++; > // Populate item select (NOTE: Do we still need this check for pre-existing select option here?) >@@ -183,29 +183,29 @@ $('#placeBookingModal').on('show.bs.modal', function(e) { > $('#booking_item_id').append(newOption); > } > } >- >+ > // Set disable function for periodPicker > let disableExists = periodPicker.config.disable.filter(f => f.name === 'dateDisable'); > if ( disableExists.length === 0 ) { > periodPicker.config.disable.push(function dateDisable(date){ >- >+ > // set local copy of selectedDates > let selectedDates = periodPicker.selectedDates; >- >+ > // set booked counter > let booked = 0; >- >+ > // reset the unavailable items array > let unavailable_items = []; >- >+ > // reset the biblio level bookings array > let biblio_bookings = []; >- >+ > // disable dates before selected date > if (!selectedDates[1] && (selectedDates[0] && selectedDates[0] > date)) { > return true; > } >- >+ > // iterate existing bookings > for (booking of bookings) { > >@@ -216,10 +216,10 @@ $('#placeBookingModal').on('show.bs.modal', function(e) { > > let start_date = flatpickr.parseDate(booking.start_date); > let end_date = flatpickr.parseDate(booking.end_date); >- >+ > // patron has selected a start date (end date checks) > if (selectedDates[0]) { >- >+ > // new booking start date is between existing booking start and end dates > if (selectedDates[0] >= start_date && selectedDates[0] <= end_date) { > if (booking.item_id) { >@@ -232,7 +232,7 @@ $('#placeBookingModal').on('show.bs.modal', function(e) { > } > } > } >- >+ > // new booking end date would be between existing booking start and end dates > else if (date >= start_date && date <= end_date) { > if (booking.item_id) { >@@ -245,7 +245,7 @@ $('#placeBookingModal').on('show.bs.modal', function(e) { > } > } > } >- >+ > // new booking would span existing booking > else if (selectedDates[0] <= start_date && date >= end_date) { > if (booking.item_id) { >@@ -258,12 +258,12 @@ $('#placeBookingModal').on('show.bs.modal', function(e) { > } > } > } >- >+ > // new booking would not conflict > else { > continue; > } >- >+ > // check that there are available items > // available = all bookable items - booked items - booked biblios > let total_available = bookable_items.length - unavailable_items.length - biblio_bookings.length; >@@ -271,21 +271,21 @@ $('#placeBookingModal').on('show.bs.modal', function(e) { > return true; > } > } >- >+ > // patron has not yet selected a start date (start date checks) > else if (date <= end_date && date >= start_date) { >- >+ > // same item, disable date > if (booking.item_id && booking.item_id == booking_item_id) { > return true; > } >- >+ > // count all clashes, both item and biblio level > booked++; > if (booked == bookable) { > return true; > } >- >+ > // FIXME: The above is not intelligent enough to spot > // cases where an item must be used for a biblio level booking > // due to all other items being booking within the biblio level >@@ -301,15 +301,15 @@ $('#placeBookingModal').on('show.bs.modal', function(e) { > } > }); > }; >- >+ > // Setup listener for item select2 > $('#booking_item_id').on('select2:select', function(e) { > booking_item_id = e.params.data.id ? e.params.data.id : null; >- >+ > // redraw pariodPicker taking selected item into account > periodPicker.redraw(); > }); >- >+ > // Set onChange for flatpickr > let changeExists = periodPicker.config.onChange.filter(f => f.name ==='periodChange'); > if(changeExists.length === 0) { >@@ -321,7 +321,7 @@ $('#placeBookingModal').on('show.bs.modal', function(e) { > let picker_end = dayjs(selectedDates[1]).endOf('day'); > $('#booking_start_date').val(picker_start.toISOString()); > $('#booking_end_date').val(picker_end.toISOString()); >- >+ > // set available items in select2 > let booked_items = bookings.filter(function(booking) { > let start_date = flatpickr.parseDate(booking.start_date); >@@ -360,18 +360,18 @@ $('#placeBookingModal').on('show.bs.modal', function(e) { > } > }); > }; >- >+ > // Enable flatpickr now we have date function populated > periodPicker.redraw(); > $("#period_fields :input").prop('disabled', false); >- >+ > // Redraw select with new options and enable > $('#booking_item_id').trigger('change'); > $("#booking_item_id").prop("disabled", false); > > // Set the flag to indicate that data has been fetched > dataFetched = true; >- >+ > // Set form values > setFormValues(patron_id,booking_item_id,start_date,end_date,periodPicker); > }, >@@ -459,7 +459,7 @@ $("#placeBookingForm").on('submit', function(e) { > "patron_id": $('#booking_patron_id').find(':selected').val() > }) > ); >- >+ > posting.done(function(data) { > // Update bookings store for subsequent bookings > bookings.push(data); >@@ -485,14 +485,14 @@ $("#placeBookingForm").on('submit', function(e) { > }); > timeline.focus(data.booking_id); > } >- >+ > // Update bookings counts > $('.bookings_count').html(parseInt($('.bookings_count').html(), 10)+1); >- >+ > // Close modal > $('#placeBookingModal').modal('hide'); > }); >- >+ > posting.fail(function(data) { > $('#booking_result').replaceWith('<div id="booking_result" class="alert alert-danger">'+_("Failure")+'</div>'); > }); >@@ -510,7 +510,7 @@ $("#placeBookingForm").on('submit', function(e) { > "patron_id": $('#booking_patron_id').find(':selected').val() > }) > }); >- >+ > putting.done(function(data) { > update_success = 1; > >@@ -539,11 +539,11 @@ $("#placeBookingForm").on('submit', function(e) { > }); > timeline.focus(data.booking_id); > } >- >+ > // Close modal > $('#placeBookingModal').modal('hide'); > }); >- >+ > putting.fail(function(data) { > $('#booking_result').replaceWith('<div id="booking_result" class="alert alert-danger">'+__("Failure")+'</div>'); > }); >-- >2.43.0
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 35248
:
161061
|
161062
|
161608
|
161611
|
161620
|
161621
|
161632
|
161636
|
161651
|
161652
|
161653
|
161654
|
161655
|
161656
|
161657
|
161658
|
161659
|
161660
|
161821
|
161822
|
161823
|
161824
|
161825
|
161826
|
161827
|
161828
|
161829
|
161830
|
161831
|
161861
|
161862
|
161863
|
161864
|
161865
|
161866
|
161867
|
161868
|
161869
|
161870
|
161871
|
161890
|
161891
|
161893
|
161894
|
161895
|
161896
|
161897
|
161898
|
161899
|
161900
|
161901
|
161902
|
161903
|
161904
|
161905
|
161906
|
161907
|
161908
|
161909
|
161910
|
161911
|
161912