https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17250
Jacek Ablewicz <a...@biblos.pk.edu.pl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |a...@biblos.pk.edu.pl --- Comment #16 from Jacek Ablewicz <a...@biblos.pk.edu.pl> --- This code (C4/Items.pm, line 1378): # get notforloan complete status if applicable $av = Koha::AuthorisedValues->search_by_koha_field({ frameworkcode => $data->{frameworkcode}, kohafield => 'items.notforloan', authorised_value => $data->{itemnotforloan} }); $av = $av->count ? $av->next : undef; (and the next two similar statements below, for items.restricted and items.stack) doesn't work for me as expected. I'm testing on current master; same problem[s] on jessie and wheezy. If authorised value code in a given item record is undef|NULL or 0 (items.itemnotfoloan is most often 0, items.restricted is usually NULL - depends on the database contents), ->search_by_koha_field->count returns more then 1, and ->next returns some random (usually the 1st one in DB, but it's not guaranteed) AV record, eg. with result description being 'Ordered' for item.itemnoforloan = 0. If itemnoforloan in item record is not null and not zero, e.g. 1 or -1 (= item not for loan, item ordered), $av->count fails (it's not a fatal error) with the following warnings in the logs: DBD::mysql::st execute failed: Column 'authorised_value' in where clause is ambiguous [for Statement "SELECT COUNT( * ) FROM (SELECT `me`.`id`, `me`.`category`, `me`.`authorised_value`, `me`.`lib`, `me`.`lib_opac`, `me`.`imageurl` FROM `authorised_values` `me` JOIN `authorised_value_categories` `category` ON `category`.`category_name` = `me`.`category` LEFT JOIN `marc_subfield_structure` `marc_subfield_structures` ON `marc_subfield_structures`.`authorised_value` = `category`.`category_name` WHERE ( ( `authorised_value` = ? AND `marc_subfield_structures`.`frameworkcode` = ? AND `marc_subfield_structures`.`kohafield` = ? ) ) GROUP BY `me`.`id`, `me`.`category`, `me`.`authorised_value`, `me`.`lib`, `me`.`lib_opac`, `me`.`imageurl`) `me`" with ParamValues: 0=-1, 1='', 2='items.notforloan'] at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1832. No method count found for Koha::AuthorisedValues DBIx::Class::Storage::DBI::_dbh_execute(): Column 'authorised_value' in where clause is ambiguous at /home/koha/devkohaclone/Koha/Objects.pm line 307 and the result AV descriptions are empty strings. Another side effect of those code changes is that search speed is now considerably slower, after converting it to DBIx, ->search_by_koha_field followed by ->count and|or ->next is taking ca 8-14 miliseconds; for a search with 50 results (and 2 items per biblio record on average), search performance penalty is somewhere around: 0.012 * 50 * 2 * 3 = 3.6 seconds (= ~15-25% of the CPU cycles involved in the search are spent in those 3 code parts, while in pre-DBIx version, it was 3-5% of the cycles). -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list Koha-bugs@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/