The "Most popular" feature in Opac is broken if AdvancedSearchTypes has multiple values (separated by pipes). To reproduce: 1) Set OpacTopissue preferende to "Allow" 2) Set AdvancedSearchTypes to an empty value -> "Most popular" shows "Limit to" with "All item types" (OK) 3) Set AdvancedSearchTypes to 'itemtypes' -> "Most popular" shows "Limit to" with "All item types" (OK) 4) Set AdvancedSearchTypes to 'ccode' -> "Most popular" shows "Limit to" with "All collections" (OK) 5) Set AdvancedSearchTypes to 'ccode|itemtypes' or 'itemtypes|ccode' -> "Most popular" shows "Limit to" with "All item types" with EMPTY dropdown list (BUG) This is due to wrong comparisions in opac-topissues.pl combined with the fact that the program logic can only display one drop down list. Patch follows.
Created attachment 27557 [details] [review] Bug 12136 - Problem in opac-topissues.pl if AdvancedSearchTypes has multiple values (separated by pipes) This patch fixes empty dropdown list if AdvancedSearchTypes contains multiple values. It defaults the dropdown to "All item types". If AdvancedSearchTypes contains ccode, it displays "All collections" To test: 1) Set OpacTopissue preferende to "Allow" 2) Set AdvancedSearchTypes to an empty value -> "Most popular" displays "Limit to" with "All item types" 3) Set AdvancedSearchTypes to 'itemtypes' -> "Most popular" displays "Limit to" with "All item types" 4) Set AdvancedSearchTypes to 'ccode' -> "Most popular" displays "Limit to" with "All collections" 5) Set AdvancedSearchTypes to 'ccode|itemtypes' or 'itemtypes|ccode' or 'ccode' -> "Most popular" should now display "Limit to" with "All collections"
> 1) Set OpacTopissue preferende to "Allow" > 2) Set AdvancedSearchTypes to an empty value > -> "Most popular" displays "Limit to" with "All item types" I get a dropdown with "All collections" and a list of collection codes. Submitting the form with default values (10 titles, all libraries, all collections, 3 months) returns no results. Only by changing the time span to "no limit" do I get results. > 3) Set AdvancedSearchTypes to 'itemtypes' > -> "Most popular" displays "Limit to" with "All item types" Using 'itemtypes' I do get a list of item types, but the same results for a default search as above. > 4) Set AdvancedSearchTypes to 'ccode' > -> "Most popular" displays "Limit to" with "All collections" Same results as in step 1-2. > 5) Set AdvancedSearchTypes to 'ccode|itemtypes' or 'itemtypes|ccode' or > 'ccode' > -> "Most popular" should now display "Limit to" with "All collections" Same results as in step 1-2. Shouldn't these combination value offer some combination of limiters? I would expect either a dropdown which combined both collection codes and item types, or a separate dropdown for collection and item type. And what about location? This patch seems to have broken the option to limit by shelving location if AdvancedSearchTypes is set to 'loc'. If we're going to address this problem doesn't the patch need to cover the search query as well?
Hi Owen, Thanks for the comments and for testing. The program logic in handles the cases "itemtypes" and "ccode" only, there is no code for "loc" (as far as I can see). I do not know why, I suppose this has historical reasons. My patch only tries to fix the problem with pipe-separated values in AdvancedSearchTypes by deciding what value (itemtypes or ccode) to take, because the existing code in opac-topissues.pl definitvely can not digest values like "itemtypes|ccode". Can you please repeat your tests without my patch? - I suppose that you will get the same or similar results. Maybe there ist a relation to Bug 9959? And I agree with your comment: "Shouldn't these combination value offer some combination of limiters? I would expect either a dropdown which combined both collection codes and item types, or a separate dropdown for collection and item type." With other words: The whole functionality would need a re-write. This would be a somewhat bigger thing, though.
Putting this to "In Discussion" The feature is still broken on current master if AdvancedSearchTypes contains more than one pipe separated value. BTW: Pipe separated values were introduced with version 3.8.0: More options for AdvancedSearchTypes (7031)
*** This bug has been marked as a duplicate of bug 11139 ***