Bug 26899

Summary: Pick up location defaults to first choice if patron's library is disabled as pick up location
Product: Koha Reporter: Christopher Brannon <cbrannon>
Component: Hold requestsAssignee: Bugs List <koha-bugs>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: agustinmoyano, gmcharlt, pierre.genty
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 26988: (follow-up) Change event to focus

Description Christopher Brannon 2020-11-02 17:48:45 UTC

    
Comment 1 Christopher Brannon 2020-11-02 17:54:24 UTC
If patron's home library is disabled as a pick up location, it defaults to the first available location in the dropdown.

I'm not sure if this request should be under system administration or hold requests.

I think that if their location is disabled, there should be a message in the dropdown, and disable the Confirm hold button until another location is chosen.  This is what I did with jQuery:

//Reroute Patron Pick-up Locations
  if($.inArray($('#opac-holds #members span.loggedinusername').attr('data-branchcode'), ['LAKECITY','POSTFALLS','ATHOL','RATHDRUM']) != -1) {
    $('#opac-holds select[name="branch"]').prepend('<option value="NONE">BRANCH CLOSED - CHOOSE PICK UP LOCATION</option>').val('NONE').width('350px');
    $('#opac-holds select[name="branch"] option[value="NONE"]').prop('disabled', true);
    $('#opac-holds input.placehold').prop('disabled', true);
    $('#opac-holds select[name="branch"]').change(function() {
  		$('#opac-holds input.placehold').prop('disabled', false);
	});
  }
//End Reroute

If the library is in the array, the button is disabled and they are forced to choose a different location.  I'm going to change this slightly and have it do this if their logged in library is not in the dropdown, so we don't have to edit this list.  But you get the idea.

This should be a part of Koha, because this easily slips by the attention of so many patrons, and holds route to the wrong library because of it.
Comment 2 Christopher Brannon 2020-11-02 18:12:38 UTC
I updated the jQuery so it doesn't have to modified each time something changes.  It just checks the patron's home library against the dropdown choices.

//Reroute Patron Pick-up Locations
  //if($.inArray($('#opac-holds #members span.loggedinusername').attr('data-branchcode'), ['LAKECITY','POSTFALLS','ATHOL','RATHDRUM']) != -1) {
  if ( !$('#opac-holds select[name="branch"] option[value=' + $('#opac-holds #members span.loggedinusername').attr('data-branchcode') + ']').length ) {
    $('#opac-holds select[name="branch"]').prepend('<option value="NONE">BRANCH CLOSED - CHOOSE PICK UP LOCATION</option>').val('NONE').width('350px');
    $('#opac-holds select[name="branch"] option[value="NONE"]').prop('disabled', true);
    $('#opac-holds input.placehold').prop('disabled', true);
    $('#opac-holds select[name="branch"]').change(function() {
  		$('#opac-holds input.placehold').prop('disabled', false);
	});
  }
//End Reroute
Comment 3 Agustín Moyano 2020-11-11 15:25:42 UTC
Created attachment 113500 [details] [review]
Bug 26988: (follow-up) Change event to focus

Click event on select element if Firefox does not work as expected, so
this patch changes the event to focus for it to work seamlessly in both
browsers.
Comment 4 Agustín Moyano 2020-11-11 15:35:27 UTC
(In reply to Agustín Moyano from comment #3)
> Created attachment 113500 [details] [review] [review]
> Bug 26988: (follow-up) Change event to focus
> 
> Click event on select element if Firefox does not work as expected, so
> this patch changes the event to focus for it to work seamlessly in both
> browsers.

sorry, this was ment for bug 26988