Bug 35806 - Patron statistics report should treat sort 1 and sort 2 the same
Summary: Patron statistics report should treat sort 1 and sort 2 the same
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Reports (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on: 33452
Blocks:
  Show dependency treegraph
 
Reported: 2024-01-13 19:01 UTC by Katrin Fischer
Modified: 2024-01-13 19:02 UTC (History)
0 users

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Katrin Fischer 2024-01-13 19:01:43 UTC
For some unknown reason we treat the sort 1 and sort 2 search fields in the patron statistics report differently:

	$req = $dbh->prepare("SELECT authorised_value,lib FROM authorised_values WHERE category='Bsort1' ORDER BY lib");
 	$req->execute;
	$template->param( SORT1_LOOP => $req->fetchall_arrayref({}));
	$req = $dbh->prepare("SELECT DISTINCTROW sort2 AS value FROM borrowers WHERE sort2 IS NOT NULL AND sort2 <> '' ORDER BY sort2 LIMIT 200");
    # More than 200 items in a dropdown is not going to be useful anyway, and w/ 50,000 patrons we can destroy DB performance.
	$req->execute;
	$template->param( SORT2_LOOP => $req->fetchall_arrayref({}));

For sort 1 we check for the authorised value, for the sort 2 we check for values from the database.

For each we should check first if the field is linked to a database value and if not, we can create a list from the database.