Bug 16481 - Report menu has unexpected issues
Summary: Report menu has unexpected issues
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Reports (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Owen Leonard
QA Contact: Testopia
URL:
Keywords:
Depends on: 15421
Blocks:
  Show dependency treegraph
 
Reported: 2016-05-09 17:31 UTC by Christopher Brannon
Modified: 2016-12-05 21:25 UTC (History)
2 users (show)

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


Attachments
Snapshot of menu failure (34.62 KB, image/png)
2016-05-09 17:35 UTC, Christopher Brannon
Details
Snapshot of good menu (how it should look) (27.60 KB, image/png)
2016-05-09 17:36 UTC, Christopher Brannon
Details
Bug 16481 - Report menu has unexpected issues (1.91 KB, patch)
2016-05-09 18:32 UTC, Owen Leonard
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 16481 - Report menu has unexpected issues (1.94 KB, patch)
2016-05-09 22:12 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 16481 - Report menu has unexpected issues (1.99 KB, patch)
2016-05-11 10:03 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Christopher Brannon 2016-05-09 17:31:18 UTC
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15421 introduced a feature that is a little buggy.  The menu is altered by some reports.  I will attach some examples shortly.

Basically, the new menu in Koha 3.22.6 added the ability to duplicate the report from within the report, not just on the report listing table.  However, some of our reports are causing the menu to be altered.  Here is one of our reports that causes the failure:

SELECT CONCAT_WS(' ',authorised_values.lib,av2.lib) AS 'Status',reserves.reservenotes AS Notes,concat(biblio.title, ' ',ExtractValue(bi.marcxml, '//datafield[@tag="245"]/subfield[@code="b"]')) AS 'Title',biblio.author AS 'Author',items.location AS 'Location',items.itemcallnumber AS 'Call Number',items.barcode AS 'Barcode',CONCAT_WS(', ',borrowers.surname,borrowers.firstname) AS 'Patron',reserves.branchcode AS 'Send To',reserves.reservedate AS 'Date',if(reserves.itemnumber IS NULL,'Next Available','Item Level') AS 'Type',Date(Now()) AS 'Report Date'
  FROM (((((reserves INNER JOIN biblio ON reserves.biblionumber = biblio.biblionumber) 
     INNER JOIN borrowers ON reserves.borrowernumber = borrowers.borrowernumber) 
     INNER JOIN items ON biblio.biblionumber = items.biblionumber)
     LEFT JOIN biblioitems bi ON (biblio.biblionumber=bi.biblionumber)
     LEFT JOIN hold_fill_targets ON (reserves.biblionumber = hold_fill_targets.biblionumber) 
     AND (reserves.borrowernumber = hold_fill_targets.borrowernumber)) 
     LEFT JOIN branchtransfers ON items.itemnumber = branchtransfers.itemnumber) 
     LEFT JOIN authorised_values ON items.itemlost = authorised_values.authorised_value
	 LEFT JOIN authorised_values av2 ON items.damaged = av2.authorised_value
  WHERE (((authorised_values.category)="LOST") AND reserves.suspend=0
     And ((av2.category="DAMAGED"))
     And ((reserves.reservedate)<=now())
     And ((reserves.waitingdate) Is Null) 
     And ((reserves.priority)=1)
	 And ((items.itemnumber NOT IN (SELECT itemnumber FROM reserves WHERE itemnumber=items.itemnumber AND found IS NOT NULL)))
     And ((items.notforloan)=0) 
     And ((items.damaged)=0) 
     And ((items.itemlost)=0)
     And ((items.withdrawn)=0) 
     And ((items.onloan) Is Null) 
     And ((reserves.itemnumber) Is Not Null 
     And (reserves.itemnumber)=items.itemnumber) 
     And ((items.itype)<>"REF") 
     And ((hold_fill_targets.itemnumber) Is Null)) 
     Or (((authorised_values.category)="LOST")
	 And ((av2.category="DAMAGED"))
     And ((hold_fill_targets.itemnumber)=items.itemnumber))
	 And ((reserves.found) IS NULL) AND reserves.suspend=0
  GROUP BY items.holdingbranch, items.itemcallnumber, items.enumchron, biblio.author, biblio.title, items.barcode, reserves.branchcode
  HAVING items.holdingbranch=<<Branch filled at|branches>>
     And Count(branchtransfers.datesent)=Count(branchtransfers.datearrived)
  ORDER BY items.location, items.itemcallnumber, items.enumchron, biblio.author, biblio.title ASC

Christopher
Comment 1 Christopher Brannon 2016-05-09 17:35:52 UTC
Created attachment 51340 [details]
Snapshot of menu failure
Comment 2 Christopher Brannon 2016-05-09 17:36:32 UTC
Created attachment 51341 [details]
Snapshot of good menu (how it should look)
Comment 3 Owen Leonard 2016-05-09 18:32:39 UTC Comment hidden (obsolete)
Comment 4 Aleisha Amohia 2016-05-09 22:12:38 UTC Comment hidden (obsolete)
Comment 5 Jonathan Druart 2016-05-11 10:03:01 UTC
Created attachment 51404 [details] [review]
Bug 16481 - Report menu has unexpected issues

This patch corrects a problem with the reports toolbar include file
which can cause a problem with the "duplicate" button. The duplicate
button passes the entire report SQL as a URL parameter, but the template
variable was not escaped as a URL variable.

This patch also adds the "uri" filter to the report name and notes
fields just to be safe.

To reproduce the bug, create a new SQL report using the SQL in the bug
report. When you run the report you should see a broken "Duplicate"
button.

Apply the patch and run the report again. The duplicate button should
look correct and work correctly.

Signed-off-by: Aleisha <aleishaamohia@hotmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 6 Kyle M Hall 2016-05-16 17:31:09 UTC
Pushed to master for Koha 16.05, thanks Owen!
Comment 7 Julian Maurice 2016-05-17 05:49:32 UTC
Patch pushed to 3.22.x, will be in 3.22.7