Bug 17420 - record export fails when itemtype on biblio
authorFridolin Somers <fridolin.somers@biblibre.com>
Mon, 10 Oct 2016 14:46:04 +0000 (16:46 +0200)
committerMason James <mtj@kohaaloha.com>
Mon, 12 Dec 2016 01:54:08 +0000 (14:54 +1300)
commitc3dc361739f915140db4a168c0a25f87fdca6eb4
treedf9e67b3e7b69a08759fcac83e01fef590d671d3
parentf6c177db882785b21447d8aae3ec41fe160ade0b
Bug 17420 - record export fails when itemtype on biblio

In Tools, Export data, you can export with a filter on item type.
When item type is on biblio record, you get the error :
export.pl: DBIx::Class::ResultSet::next(): Unknown column 'biblioitems.itemtype' in 'where clause' at /home/koha/src/Koha/Objects.pm line 150

Looks like its because this code use to be a SQL Select and is now a DBIx call :
                          C4::Context->preference('item-level_itypes')
                            ? ( 'items.itype' => $itemtype )
                            : ( 'me.itemtype' => $itemtype )

This patch corrects by using "me.itemtype"

Test plan :
- Use syspref item-level_itypes = biblio record
- Go to Tools > Export data : /cgi-bin/koha/tools/export.pl
- Select an item type
- Click on "Export biblio records"
=> Without patch you get an error 500
=> With patch you get a correct export file

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Fix the issue, no errors.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Mason James <mtj@kohaaloha.com>
tools/export.pl