The subroutine C4::Members::GetHideLostItemsPreference can easily be replaced with Koha::Patron->find(42)->category->hidelostitems
Created attachment 57215 [details] [review] Bug 17556: Koha::Patrons - Remove GetHideLostItemsPreference The subroutine C4::Members::GetHideLostItemsPreference can easily be replaced with Koha::Patron->find(42)->category->hidelostitems Test plan: Create 2 patron categories, 1 with "Lost items in staff client" set to "shown" and another one to "Hidden by default" Create 2 patrons using them On the result search page, the detail page of a record, the item list page and the page to place a hold, make sure the lost items are shown/hidden as expected
In reserve request, if I tried to hold through "Search to hold" functionality, everything works OK, but when I tried just "hold" link (on search result page and detail) i get "Can't call method "category" on an undefined value at /home/vagrant/kohaclone/reserve/request.pl line 417."
Created attachment 57246 [details] [review] Bug 17556: Koha::Patrons - Remove GetHideLostItemsPreference The subroutine C4::Members::GetHideLostItemsPreference can easily be replaced with Koha::Patron->find(42)->category->hidelostitems Test plan: Create 2 patron categories, 1 with "Lost items in staff client" set to "shown" and another one to "Hidden by default" Create 2 patrons using them On the result search page, the detail page of a record, the item list page and the page to place a hold, make sure the lost items are shown/hidden as expected
(In reply to Josef Moravec from comment #2) > In reserve request, if I tried to hold through "Search to hold" > functionality, everything works OK, but when I tried just "hold" link (on > search result page and detail) i get "Can't call method "category" on an > undefined value at /home/vagrant/kohaclone/reserve/request.pl line 417." Sorry about that, last patch should fix that.
Created attachment 57361 [details] [review] [SIGNED-OFF] Bug 17556: Koha::Patrons - Remove GetHideLostItemsPreference The subroutine C4::Members::GetHideLostItemsPreference can easily be replaced with Koha::Patron->find(42)->category->hidelostitems Test plan: Create 2 patron categories, 1 with "Lost items in staff client" set to "shown" and another one to "Hidden by default" Create 2 patrons using them On the result search page, the detail page of a record, the item list page and the page to place a hold, make sure the lost items are shown/hidden as expected Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Please add a test :)
(In reply to Marcel de Rooy from comment #6) > Please add a test :) I'd like you to reconsider this, the searchResults massive subroutine is not tested and it would be very time consuming to cover this change. Basically the change is: - SELECT hidelostitems FROM borrowers,categories WHERE borrowers.categorycode = categories.categorycode AND borrowernumber = ? + Koha::Patrons->find($borrowernumber)->category->hidelostitems Which sounds quite safe :)
Created attachment 57922 [details] [review] Bug 17556: Koha::Patrons - Remove GetHideLostItemsPreference The subroutine C4::Members::GetHideLostItemsPreference can easily be replaced with Koha::Patron->find(42)->category->hidelostitems Test plan: Create 2 patron categories, 1 with "Lost items in staff client" set to "shown" and another one to "Hidden by default" Create 2 patrons using them On the result search page, the detail page of a record, the item list page and the page to place a hold, make sure the lost items are shown/hidden as expected Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
I think that there is still room for improvement in the combination of the preference hidelostitems and the category column. This could be moved from the scripts into the object.
Pushed to master for 17.05, thanks Jonathan!
Not that it particularly matters, because you shouldn't do this anyway - this patch breaks searching in the staff client for the database user superlibrarian. Only leaving this note in case someone else sees Can't call method "category" on an undefined value at /home/liz/koha-src/koha/C4/Search.pm line 2091. and traces it back to this patch.
This won't get backported to 16.11.x as it is an enhancement.