[Koha-bugs] [Bug 35361] Search filter on receive orders page crashes the system

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Nov 23 15:37:35 CET 2023


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35361

--- Comment #1 from Andreas Jonsson <andreas.jonsson at kreablo.se> ---
This is just an instance of a much bigger problem with DBIx.

For instance the SQL code of an ordinary borrower search looks like this, once
again, the LIMIT-clause is applied on the subquery:

SELECT `me`.`borrowernumber`, `me`.`cardnumber`, `me`.`surname`,
`me`.`firstname`, `me`.`middle_name`, `me`.`title`, `me`.`othernames`,
`me`.`initials`, `me`.`pronouns`, `me`.`streetnumber`, `me`.`streettype`,
`me`.`address`, `me`.`address2`, `me`.`city`, `me`.`state`, `me`.`zipcode`,
`me`.`country`, `me`.`email`, `me`.`phone`, `me`.`mobile`, `me`.`fax`,
`me`.`emailpro`, `me`.`phonepro`, `me`.`B_streetnumber`, `me`.`B_streettype`,
`me`.`B_address`, `me`.`B_address2`, `me`.`B_city`, `me`.`B_state`,
`me`.`B_zipcode`, `me`.`B_country`, `me`.`B_email`, `me`.`B_phone`,
`me`.`dateofbirth`, `me`.`branchcode`, `me`.`categorycode`,
`me`.`dateenrolled`, `me`.`dateexpiry`, `me`.`password_expiration_date`,
`me`.`date_renewed`, `me`.`gonenoaddress`, `me`.`lost`, `me`.`debarred`,
`me`.`debarredcomment`, `me`.`contactname`, `me`.`contactfirstname`,
`me`.`contacttitle`, `me`.`borrowernotes`, `me`.`relationship`, `me`.`sex`,
`me`.`password`, `me`.`secret`, `me`.`auth_method`, `me`.`flags`,
`me`.`userid`, `me`.`opacnote`, `me`.`contactnote`, `me`.`sort1`, `me`.`sort2`,
`me`.`altcontactfirstname`, `me`.`altcontactsurname`,
`me`.`altcontactaddress1`, `me`.`altcontactaddress2`,
`me`.`altcontactaddress3`, `me`.`altcontactstate`, `me`.`altcontactzipcode`,
`me`.`altcontactcountry`, `me`.`altcontactphone`, `me`.`smsalertnumber`,
`me`.`sms_provider_id`, `me`.`privacy`, `me`.`privacy_guarantor_fines`,
`me`.`privacy_guarantor_checkouts`, `me`.`checkprevcheckout`,
`me`.`updated_on`, `me`.`lastseen`, `me`.`lang`, `me`.`login_attempts`,
`me`.`overdrive_auth_token`, `me`.`anonymized`, `me`.`autorenew_checkouts`,
`me`.`primary_contact_method`, `extended_attributes`.`id`,
`extended_attributes`.`borrowernumber`, `extended_attributes`.`code`,
`extended_attributes`.`attribute` FROM (SELECT `me`.`borrowernumber`,
`me`.`cardnumber`, `me`.`surname`, `me`.`firstname`, `me`.`middle_name`,
`me`.`title`, `me`.`othernames`, `me`.`initials`, `me`.`pronouns`,
`me`.`streetnumber`, `me`.`streettype`, `me`.`address`, `me`.`address2`,
`me`.`city`, `me`.`state`, `me`.`zipcode`, `me`.`country`, `me`.`email`,
`me`.`phone`, `me`.`mobile`, `me`.`fax`, `me`.`emailpro`, `me`.`phonepro`,
`me`.`B_streetnumber`, `me`.`B_streettype`, `me`.`B_address`,
`me`.`B_address2`, `me`.`B_city`, `me`.`B_state`, `me`.`B_zipcode`,
`me`.`B_country`, `me`.`B_email`, `me`.`B_phone`, `me`.`dateofbirth`,
`me`.`branchcode`, `me`.`categorycode`, `me`.`dateenrolled`, `me`.`dateexpiry`,
`me`.`password_expiration_date`, `me`.`date_renewed`, `me`.`gonenoaddress`,
`me`.`lost`, `me`.`debarred`, `me`.`debarredcomment`, `me`.`contactname`,
`me`.`contactfirstname`, `me`.`contacttitle`, `me`.`borrowernotes`,
`me`.`relationship`, `me`.`sex`, `me`.`password`, `me`.`secret`,
`me`.`auth_method`, `me`.`flags`, `me`.`userid`, `me`.`opacnote`,
`me`.`contactnote`, `me`.`sort1`, `me`.`sort2`, `me`.`altcontactfirstname`,
`me`.`altcontactsurname`, `me`.`altcontactaddress1`, `me`.`altcontactaddress2`,
`me`.`altcontactaddress3`, `me`.`altcontactstate`, `me`.`altcontactzipcode`,
`me`.`altcontactcountry`, `me`.`altcontactphone`, `me`.`smsalertnumber`,
`me`.`sms_provider_id`, `me`.`privacy`, `me`.`privacy_guarantor_fines`,
`me`.`privacy_guarantor_checkouts`, `me`.`checkprevcheckout`,
`me`.`updated_on`, `me`.`lastseen`, `me`.`lang`, `me`.`login_attempts`,
`me`.`overdrive_auth_token`, `me`.`anonymized`, `me`.`autorenew_checkouts`,
`me`.`primary_contact_method` FROM `borrowers` `me` LEFT JOIN
`borrower_attributes` `extended_attributes` ON
`extended_attributes`.`borrowernumber` = `me`.`borrowernumber` WHERE ( ( (
`me`.`borrowernumber` LIKE '%nil%' OR `me`.`email` LIKE '%nil%' OR
`me`.`surname` LIKE '%nil%' OR `me`.`firstname` LIKE '%nil%' OR
`me`.`othernames` LIKE '%nil%' OR `me`.`cardnumber` LIKE '%nil%' OR
`me`.`userid` LIKE '%nil%' OR `me`.`B_address` LIKE '%nil%' OR
`me`.`middle_name` LIKE '%nil%' ) OR ( `me`.`borrowernumber` LIKE '%nil%' OR
`me`.`email` LIKE '%nil%' OR `me`.`surname` LIKE '%nil%' OR `me`.`firstname`
LIKE '%nil%' OR `me`.`othernames` LIKE '%nil%' OR `me`.`cardnumber` LIKE
'%nil%' OR `me`.`userid` LIKE '%nil%' OR `me`.`B_address` LIKE '%nil%' OR
`me`.`middle_name` LIKE '%nil%' ) OR ( `extended_attributes`.`attribute` LIKE
'%nil%' AND ( `extended_attributes`.`code` = 'BUSS' OR
`extended_attributes`.`code` = 'MEROPPET' ) ) ) ) GROUP BY
`me`.`borrowernumber`, `me`.`cardnumber`, `me`.`surname`, `me`.`firstname`,
`me`.`middle_name`, `me`.`title`, `me`.`othernames`, `me`.`initials`,
`me`.`pronouns`, `me`.`streetnumber`, `me`.`streettype`, `me`.`address`,
`me`.`address2`, `me`.`city`, `me`.`state`, `me`.`zipcode`, `me`.`country`,
`me`.`email`, `me`.`phone`, `me`.`mobile`, `me`.`fax`, `me`.`emailpro`,
`me`.`phonepro`, `me`.`B_streetnumber`, `me`.`B_streettype`, `me`.`B_address`,
`me`.`B_address2`, `me`.`B_city`, `me`.`B_state`, `me`.`B_zipcode`,
`me`.`B_country`, `me`.`B_email`, `me`.`B_phone`, `me`.`dateofbirth`,
`me`.`branchcode`, `me`.`categorycode`, `me`.`dateenrolled`, `me`.`dateexpiry`,
`me`.`password_expiration_date`, `me`.`date_renewed`, `me`.`gonenoaddress`,
`me`.`lost`, `me`.`debarred`, `me`.`debarredcomment`, `me`.`contactname`,
`me`.`contactfirstname`, `me`.`contacttitle`, `me`.`borrowernotes`,
`me`.`relationship`, `me`.`sex`, `me`.`password`, `me`.`secret`,
`me`.`auth_method`, `me`.`flags`, `me`.`userid`, `me`.`opacnote`,
`me`.`contactnote`, `me`.`sort1`, `me`.`sort2`, `me`.`altcontactfirstname`,
`me`.`altcontactsurname`, `me`.`altcontactaddress1`, `me`.`altcontactaddress2`,
`me`.`altcontactaddress3`, `me`.`altcontactstate`, `me`.`altcontactzipcode`,
`me`.`altcontactcountry`, `me`.`altcontactphone`, `me`.`smsalertnumber`,
`me`.`sms_provider_id`, `me`.`privacy`, `me`.`privacy_guarantor_fines`,
`me`.`privacy_guarantor_checkouts`, `me`.`checkprevcheckout`,
`me`.`updated_on`, `me`.`lastseen`, `me`.`lang`, `me`.`login_attempts`,
`me`.`overdrive_auth_token`, `me`.`anonymized`, `me`.`autorenew_checkouts`,
`me`.`primary_contact_method` ORDER BY `me`.`surname` ASC, `me`.`firstname`
ASC, `me`.`middle_name` ASC, `me`.`othernames` ASC, `me`.`streetnumber` ASC,
`me`.`address` ASC, `me`.`address2` ASC, `me`.`city` ASC, `me`.`state` ASC,
`me`.`zipcode` ASC, `me`.`country` ASC LIMIT 20) `me` LEFT JOIN
`borrower_attributes` `extended_attributes` ON
`extended_attributes`.`borrowernumber` = `me`.`borrowernumber` WHERE ( ( (
`me`.`borrowernumber` LIKE '%nil%' OR `me`.`email` LIKE '%nil%' OR
`me`.`surname` LIKE '%nil%' OR `me`.`firstname` LIKE '%nil%' OR
`me`.`othernames` LIKE '%nil%' OR `me`.`cardnumber` LIKE '%nil%' OR
`me`.`userid` LIKE '%nil%' OR `me`.`B_address` LIKE '%nil%' OR
`me`.`middle_name` LIKE '%nil%' ) OR ( `me`.`borrowernumber` LIKE '%nil%' OR
`me`.`email` LIKE '%nil%' OR `me`.`surname` LIKE '%nil%' OR `me`.`firstname`
LIKE '%nil%' OR `me`.`othernames` LIKE '%nil%' OR `me`.`cardnumber` LIKE
'%nil%' OR `me`.`userid` LIKE '%nil%' OR `me`.`B_address` LIKE '%nil%' OR
`me`.`middle_name` LIKE '%nil%' ) OR ( `extended_attributes`.`attribute` LIKE
'%nil%' AND ( `extended_attributes`.`code` = 'BUSS' OR
`extended_attributes`.`code` = 'MEROPPET' ) ) ) ) ORDER BY `me`.`surname` ASC,
`me`.`firstname` ASC, `me`.`middle_name` ASC, `me`.`othernames` ASC,
`me`.`streetnumber` ASC, `me`.`address` ASC, `me`.`address2` ASC, `me`.`city`
ASC, `me`.`state` ASC, `me`.`zipcode` ASC, `me`.`country` ASC;

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.


More information about the Koha-bugs mailing list