Bug 34533

Summary: jsdiff library missing from guided reports page
Product: Koha Reporter: Owen Leonard <oleonard>
Component: TemplatesAssignee: Owen Leonard <oleonard>
Status: RESOLVED FIXED QA Contact: Katrin Fischer <katrin.fischer>
Severity: normal    
Priority: P5 - low CC: fridolin.somers, jzairo
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.11.00,23.05.04,22.11.10
Bug Depends on: 19663    
Bug Blocks:    
Attachments: Bug 34533: jsdiff library missing from guided reports page
Bug 34533: jsdiff library missing from guided reports page

Description Owen Leonard 2023-08-15 08:36:52 UTC
If you add an sql report which uses outdated syntax, syntax which references biblioitems.marcxml, the interface offers to upgrade that report for you:

"This report seems obsolete, it uses biblioitems.marcxml field. "

When you click the "Update SQL" button the browser tries to run a diff on the old and new sql versions for display before you save the updated report. The page lost the linked JS library in Bug 19663.
Comment 1 Owen Leonard 2023-08-15 09:19:50 UTC Comment hidden (obsolete)
Comment 2 Jessie Zairo 2023-08-17 11:36:01 UTC
The test worked as described.
Comment 3 Katrin Fischer 2023-08-24 21:18:52 UTC
Created attachment 154756 [details] [review]
Bug 34533: jsdiff library missing from guided reports page

This patch restores the inclusion of the jsdiff JS library on the guided
reports page when displaying saved SQL reports. This fixes a JS error in
the browser console when the user tries to use our automatic update on
SQL reports which use an older syntax.

The patch also corrects a problem with svc/convert_report which was
causing an error when trying to display the diff information.

To test, apply the patch and restart services.

- Go to Reports -> Create from SQL.
- Add a report which is based on an older db structure. The example I
  found was:

  SELECT biblionumber,
  ExtractValue(marcxml,'//datafield/@tag/text()[substring(.,1,1) = "5"]') as 'notes'
  FROM biblioitems
  HAVING notes <> ''

- Save the report and go to the list of saved reports. There should be
  an "Update" column in the table, with a message about your newly-added
  report:

  "This report seems obsolete, it uses biblioitems.marcxml field."

- Clicking the "Update SQL" button should trigger a modal window that
  shows the before an after versions of the report. There should be
  no error in the browser console. Unfortunately the diff will not
  display because of a separate bug in svc/convert_report

Signed.off-by: Jessie Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 4 Katrin Fischer 2023-08-24 21:19:18 UTC
Added Jessie's sign-off to the patch.
Comment 5 Tomás Cohen Arazi 2023-08-29 17:36:41 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 6 Fridolin Somers 2023-08-30 06:47:27 UTC
Pushed to 23.05.x for 23.05.04
Comment 7 Matt Blenkinsop 2023-08-31 10:12:16 UTC
Nice work everyone!

Pushed to oldstable for 22.11.x