Bug 31361 - Button batch operations disappears when alias is used for itemnumber of biblionumber
Summary: Button batch operations disappears when alias is used for itemnumber of bibli...
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Reports (show other bugs)
Version: 21.11
Hardware: All Windows
: P5 - low enhancement (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-08-15 13:52 UTC by Jan Mark Koopmans
Modified: 2023-12-07 16:38 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact: Benjamin Daeuber
Documentation submission: https://gitlab.com/koha-community/koha-manual/-/merge_requests/767
Text to go in the release notes:
Version(s) released in:


Attachments
screenshot report result with batch modification button (59.87 KB, image/png)
2022-08-15 13:52 UTC, Jan Mark Koopmans
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Mark Koopmans 2022-08-15 13:52:15 UTC
Created attachment 139128 [details]
screenshot report result with batch modification button

When running a SQL-report and using an alias for itemnumber or biblionumber in SELECT, the button for 'Batch operations with 20 visible records' disappears.

Using an alias for other columns is no problem.

Example SQL with button:

SELECT items.itemnumber,items.barcode,items.notforloan as Status,biblio.title,items.ccode as Itemtype
FROM items 
LEFT JOIN biblioitems on (items.biblioitemnumber=biblioitems.biblioitemnumber) 
LEFT JOIN biblio on (biblioitems.biblionumber=biblio.biblionumber)  
WHERE items.homebranch=<<homebranch|branches>> AND items.itype=<<itype|itemtypes>> AND items.notforloan=<<notforloan>>
ORDER BY items.itemnumber asc

Changing it to 'SELECT items.itemnumber as Itemnr, etc.' removes the button and the ability for batch processing.

The same thing occurs when using an alias for biblionumber in a report.

Example SQL with button:
SELECT CONCAT ('<a href=\"/cgi-bin/koha/catalogue/detail.pl?biblionumber=',biblio.biblionumber,'\" target=new>',biblio.title,' </a>') as Titel, items.biblionumber,biblio.datecreated as Datum
FROM items 
LEFT JOIN biblioitems on (items.biblioitemnumber=biblioitems.biblioitemnumber) 
LEFT JOIN biblio on (biblioitems.biblionumber=biblio.biblionumber) 
where date (datecreated) BETWEEN <<From date|date>> AND <<To date|date>>
ORDER BY biblio.datecreated desc

Changing 'items.biblionumber to items.biblionumber as Biblionr' removes the button.

Also tested it in version 20.11 with the same results.
Comment 1 Katrin Fischer 2022-08-15 17:12:59 UTC
You need to use a special syntax if you want to rename the column while keeping the batch functionality. 

This will work:

[[items.biblionumber|Titelsatznummer]]
Comment 2 Benjamin Daeuber 2023-12-06 23:01:09 UTC
I've created a merge request to add this to the manual here: https://gitlab.com/koha-community/koha-manual/-/merge_requests/767