Summary: | Add placeholder syntax for column names | ||
---|---|---|---|
Product: | Koha | Reporter: | Nick Clemens (kidclamp) <nick> |
Component: | Reports | Assignee: | Nick Clemens (kidclamp) <nick> |
Status: | CLOSED FIXED | QA Contact: | Testopia <testopia> |
Severity: | enhancement | ||
Priority: | P5 - low | CC: | fridolin.somers, george, martin.renvoize |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
Change sponsored?: | --- | Patch complexity: | Small patch |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: |
This enhancement allows for renaming columns used to trigger batch modification actions in reports. Before this patch, a column had to be called 'itemnumber' to be sent from reports to batch modification. With this enhancement, you can specify `[[itemnumber| Koha_internal_id]]` to allow for a clearer name for the end-user and to allow translation of terms like 'itemnumber' while preserving the batch modification functionality.
|
Version(s) released in: |
19.11.00
|
Circulation function: | |||
Bug Depends on: | 23206 | ||
Bug Blocks: | 23730, 27824 | ||
Attachments: |
Bug 23390: Introduce placeholder syntax for report column names
Bug 23390: Introduce placeholder syntax for report column names Bug 23390: (QA follow-up) Don't redeclare variable Bug 23390: (follow-up) Quote aliases Bug 23390: Introduce placeholder syntax for report column names Bug 23390: (QA follow-up) Don't redeclare variable Bug 23390: (follow-up) Quote aliases Bug 23390: Introduce placeholder syntax for report column names Bug 23390: (QA follow-up) Don't redeclare variable Bug 23390: (follow-up) Quote aliases |
Description
Nick Clemens (kidclamp)
2019-07-27 13:09:05 UTC
Created attachment 91849 [details] [review] Bug 23390: Introduce placeholder syntax for report column names This patch adds the ability to rename columns in MySQL reports using a syntax: [[column|alias]] To test: 1 - Write a report like: SELECT cardnumber FROM borrowers WHERE cardnumber LIKE '%9' 2 - Run report 3 - Note you can batch modify the patrons 4 - Update report: SELECT cardnumber AS library_barcode FROM borrowers WHERE cardnumber LIKE '%9' 5 - Run report 6 - Note batch options are no longer present 7 - Apply patch 8 - Run report, no change 9 - Update report like: SELECT [[cardnumber|library_barcode]] FROM borrowers WHERE cardnumber LIKE '%9' 10 - Run report 11 - Batch options work! 12 - Update report like: SELECT cardnumber FROM borrowers WHERE cardnumber LIKE '%9' 13 - Verify batch options still work 14 - Set report 'public' 15 - Verify report can be run via JSON URLs: http://kohadev.mydnsname.org:8080/cgi-bin/koha/svc/report?id=1 http://kohadev.mydnsname.org:8081/cgi-bin/koha/svc/report?id=1 Tested on ByWater sandbox. I got this error message when I got to step 10: The following error was encountered: The database returned the following error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[[cardnumber|library_barcode]] AS library_barcode FROM borrowers WHERE cardnumbe' at line 1 Please check the log for further details. Return to previous page I left the sandbox up - it's just called "sandbox" - if you want to take a look. (In reply to George Williams (NEKLS) from comment #2) > Tested on ByWater sandbox. I got this error message when I got to step 10: > > The following error was encountered: > The database returned the following error: > You have an error in your SQL syntax; check the manual that corresponds to > your MySQL server version for the right syntax to use near > '[[cardnumber|library_barcode]] AS library_barcode FROM borrowers WHERE > cardnumbe' at line 1 > Please check the log for further details. > Return to previous page > > I left the sandbox up - it's just called "sandbox" - if you want to take a > look. I restarted the services on the sandbox and edited the report from: SELECT [[cardnumber|library_barcode]] AS library_barcode FROM borrowers WHERE cardnumber LIKE '%9' To: SELECT [[cardnumber|library_barcode]] FROM borrowers WHERE cardnumber LIKE '%9' and all appears to work now :-) Created attachment 91880 [details] [review] Bug 23390: Introduce placeholder syntax for report column names This patch adds the ability to rename columns in MySQL reports using a syntax: [[column|alias]] To test: 1 - Write a report like: SELECT cardnumber FROM borrowers WHERE cardnumber LIKE '%9' 2 - Run report 3 - Note you can batch modify the patrons 4 - Update report: SELECT cardnumber AS library_barcode FROM borrowers WHERE cardnumber LIKE '%9' 5 - Run report 6 - Note batch options are no longer present 7 - Apply patch 8 - Run report, no change 9 - Update report like: SELECT [[cardnumber|library_barcode]] FROM borrowers WHERE cardnumber LIKE '%9' 10 - Run report 11 - Batch options work! 12 - Update report like: SELECT cardnumber FROM borrowers WHERE cardnumber LIKE '%9' 13 - Verify batch options still work 14 - Set report 'public' 15 - Verify report can be run via JSON URLs: http://kohadev.mydnsname.org:8080/cgi-bin/koha/svc/report?id=1 http://kohadev.mydnsname.org:8081/cgi-bin/koha/svc/report?id=1 Signed-off-by: George Williams <george@nekls.org> Tested again with no problems after restarting services. Created attachment 91882 [details] [review] Bug 23390: (QA follow-up) Don't redeclare variable Hi Nick, when the column alias is more than one word or includes spaces, this doesn't work. Can you please have another look? I've used: SELECT [[cardnumber|We test]] from borrowers The database returned the following error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'test from borrowers LIMIT 0, 20' at line 1 Please check the log for further details. Created attachment 91888 [details] [review] Bug 23390: (follow-up) Quote aliases Created attachment 91917 [details] [review] Bug 23390: Introduce placeholder syntax for report column names This patch adds the ability to rename columns in MySQL reports using a syntax: [[column|alias]] To test: 1 - Write a report like: SELECT cardnumber FROM borrowers WHERE cardnumber LIKE '%9' 2 - Run report 3 - Note you can batch modify the patrons 4 - Update report: SELECT cardnumber AS library_barcode FROM borrowers WHERE cardnumber LIKE '%9' 5 - Run report 6 - Note batch options are no longer present 7 - Apply patch 8 - Run report, no change 9 - Update report like: SELECT [[cardnumber|library_barcode]] FROM borrowers WHERE cardnumber LIKE '%9' 10 - Run report 11 - Batch options work! 12 - Update report like: SELECT cardnumber FROM borrowers WHERE cardnumber LIKE '%9' 13 - Verify batch options still work 14 - Set report 'public' 15 - Verify report can be run via JSON URLs: http://kohadev.mydnsname.org:8080/cgi-bin/koha/svc/report?id=1 http://kohadev.mydnsname.org:8081/cgi-bin/koha/svc/report?id=1 Signed-off-by: George Williams <george@nekls.org> Signed-off-by: George Williams <george@nekls.org> Created attachment 91918 [details] [review] Bug 23390: (QA follow-up) Don't redeclare variable Signed-off-by: George Williams <george@nekls.org> Created attachment 91919 [details] [review] Bug 23390: (follow-up) Quote aliases Signed-off-by: George Williams <george@nekls.org> This will get easily lost if not documented - can we get a manual patch too? :) Created attachment 92095 [details] [review] Bug 23390: Introduce placeholder syntax for report column names This patch adds the ability to rename columns in MySQL reports using a syntax: [[column|alias]] To test: 1 - Write a report like: SELECT cardnumber FROM borrowers WHERE cardnumber LIKE '%9' 2 - Run report 3 - Note you can batch modify the patrons 4 - Update report: SELECT cardnumber AS library_barcode FROM borrowers WHERE cardnumber LIKE '%9' 5 - Run report 6 - Note batch options are no longer present 7 - Apply patch 8 - Run report, no change 9 - Update report like: SELECT [[cardnumber|library_barcode]] FROM borrowers WHERE cardnumber LIKE '%9' 10 - Run report 11 - Batch options work! 12 - Update report like: SELECT cardnumber FROM borrowers WHERE cardnumber LIKE '%9' 13 - Verify batch options still work 14 - Set report 'public' 15 - Verify report can be run via JSON URLs: http://kohadev.mydnsname.org:8080/cgi-bin/koha/svc/report?id=1 http://kohadev.mydnsname.org:8081/cgi-bin/koha/svc/report?id=1 Signed-off-by: George Williams <george@nekls.org> Signed-off-by: George Williams <george@nekls.org> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Created attachment 92096 [details] [review] Bug 23390: (QA follow-up) Don't redeclare variable Signed-off-by: George Williams <george@nekls.org> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Created attachment 92097 [details] [review] Bug 23390: (follow-up) Quote aliases Signed-off-by: George Williams <george@nekls.org> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Nice work! Pushed to master for 19.11.00 Depends on Bug 23206 not in 19.05.x *** Bug 22167 has been marked as a duplicate of this bug. *** |