Created attachment 116429 [details] Screenshot of the proposed change I can never remember the syntax for adding runtime parameters to SQL reports so I think it would be useful to have a menu of choices for the user to choose from.
Created attachment 116496 [details] [review] Bug 27644: Add button to SQL report editor for inserting runtime parameters This patch adds a button menu to the SQL report CodeMirror editor for inserting runtime parameters. Each menu item triggers a modal dialog where the user can specify a parameter label and any other relevant option. To test, apply the patch and rebuild the staff client CSS (https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client). - Go to Reports -> Use saved. - Create or edit a report. - You should see a menu button above the SQL editor field, "Insert runtime parameter." - The menu should contain the options "Authorized value," "Date," "Item types," "Libraries," "Patron categories," and "Text field." - Test each option. Each should trigger the display of a modal dialog with a heading which corresponds to your choice. - In all cases except the "Authorized value" choice you should see a single form field for "label." - Enter text in the label field and click the "Insert parameter" button. - The correct runtime parameter should be inserted into the SQL editor. - If you placed a cursor somewhere in the SQL editor first, your parameter should be inserted in that location in the editor. - If you selected some text in the editor before selecting a parameter, the paramter should replace the selected text. - In the case of the "Authorized value" selection, the modal dialog should include both a label field and a field for choosing an authorized value category. - Try submitting the form without selecting an authorized value. It should warn you that the field is required. - After testing the authorized value selection, try inserting another parameter to confirm that the authorized value selection (now hidden) is no longer required.
This is a great idea, I too can never remember this syntax. This works well when I edit a report. But since the 'Insert runtime parameter' button is only added inside the '[% IF ( editsql ) %]' statement it does not appear when you create a new report. Could we have this for new reports too?
Created attachment 118973 [details] [review] Bug 27644: Add button to SQL report editor for inserting runtime parameters This patch adds a button menu to the SQL report CodeMirror editor for inserting runtime parameters. Each menu item triggers a modal dialog where the user can specify a parameter label and any other relevant option. To test, apply the patch and rebuild the staff client CSS (https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client). - Go to Reports -> Use saved. - Create or edit a report. - You should see a menu button above the SQL editor field, "Insert runtime parameter." - The menu should contain the options "Authorized value," "Date," "Item types," "Libraries," "Patron categories," and "Text field." - Test each option. Each should trigger the display of a modal dialog with a heading which corresponds to your choice. - In all cases except the "Authorized value" choice you should see a single form field for "label." - Enter text in the label field and click the "Insert parameter" button. - The correct runtime parameter should be inserted into the SQL editor. - If you placed a cursor somewhere in the SQL editor first, your parameter should be inserted in that location in the editor. - If you selected some text in the editor before selecting a parameter, the paramter should replace the selected text. - In the case of the "Authorized value" selection, the modal dialog should include both a label field and a field for choosing an authorized value category. - Try submitting the form without selecting an authorized value. It should warn you that the field is required. - After testing the authorized value selection, try inserting another parameter to confirm that the authorized value selection (now hidden) is no longer required.
Created attachment 119039 [details] [review] Bug 27644: Add button to SQL report editor for inserting runtime parameters This patch adds a button menu to the SQL report CodeMirror editor for inserting runtime parameters. Each menu item triggers a modal dialog where the user can specify a parameter label and any other relevant option. To test, apply the patch and rebuild the staff client CSS (https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client). - Go to Reports -> Use saved. - Create or edit a report. - You should see a menu button above the SQL editor field, "Insert runtime parameter." - The menu should contain the options "Authorized value," "Date," "Item types," "Libraries," "Patron categories," and "Text field." - Test each option. Each should trigger the display of a modal dialog with a heading which corresponds to your choice. - In all cases except the "Authorized value" choice you should see a single form field for "label." - Enter text in the label field and click the "Insert parameter" button. - The correct runtime parameter should be inserted into the SQL editor. - If you placed a cursor somewhere in the SQL editor first, your parameter should be inserted in that location in the editor. - If you selected some text in the editor before selecting a parameter, the paramter should replace the selected text. - In the case of the "Authorized value" selection, the modal dialog should include both a label field and a field for choosing an authorized value category. - Try submitting the form without selecting an authorized value. It should warn you that the field is required. - After testing the authorized value selection, try inserting another parameter to confirm that the authorized value selection (now hidden) is no longer required. Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Such a nice one, thanks Owen !
This is really nice, but I believe I spotted a translation issue with the default labels: $("#paramLabel").val("Authorized value") for an example.
Created attachment 119311 [details] [review] Bug 27644: (follow-up) Wrap strings in translation function This patch updates the in-template JavaScript so that some English strings which were previously untranslatable. This patch wraps them in the _() function. To test, apply the patch and test that the correct strings are translatable. In this example I'm testing fr-FR: - Update a translation: > gulp po:update > cd misc/translator > perl translate update fr-FR - Open the corresponding .po file for the strings pulled from JavaScript e.g. misc/translator/po/fr-FR-staff-prog.po - Locate strings pulled from reports/guided_reports_start.tt for translation, e.g.: #: koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt:1324 #, fuzzy, c-format msgid "Authorized value category:" msgstr "Catégorie de valeur autorisée : " - Edit the "msgstr" string if necessary, or remove the "fuzzy," before "c-format" - Install the updated translation: > perl translate install fr-FR In the staff interface, switch to the language you're testing. Confirm that your translated strings appear. In this case, test in particular: - The controls on the modal window when you preview a report's SQL from the list of saved reports. - The controls and modal dialog for inserting a runtime parameter.
Created attachment 119812 [details] [review] Bug 27644: Add button to SQL report editor for inserting runtime parameters This patch adds a button menu to the SQL report CodeMirror editor for inserting runtime parameters. Each menu item triggers a modal dialog where the user can specify a parameter label and any other relevant option. To test, apply the patch and rebuild the staff client CSS (https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client). - Go to Reports -> Use saved. - Create or edit a report. - You should see a menu button above the SQL editor field, "Insert runtime parameter." - The menu should contain the options "Authorized value," "Date," "Item types," "Libraries," "Patron categories," and "Text field." - Test each option. Each should trigger the display of a modal dialog with a heading which corresponds to your choice. - In all cases except the "Authorized value" choice you should see a single form field for "label." - Enter text in the label field and click the "Insert parameter" button. - The correct runtime parameter should be inserted into the SQL editor. - If you placed a cursor somewhere in the SQL editor first, your parameter should be inserted in that location in the editor. - If you selected some text in the editor before selecting a parameter, the paramter should replace the selected text. - In the case of the "Authorized value" selection, the modal dialog should include both a label field and a field for choosing an authorized value category. - Try submitting the form without selecting an authorized value. It should warn you that the field is required. - After testing the authorized value selection, try inserting another parameter to confirm that the authorized value selection (now hidden) is no longer required. Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Created attachment 119813 [details] [review] Bug 27644: (follow-up) Wrap strings in translation function This patch updates the in-template JavaScript so that some English strings which were previously untranslatable. This patch wraps them in the _() function. To test, apply the patch and test that the correct strings are translatable. In this example I'm testing fr-FR: - Update a translation: > gulp po:update > cd misc/translator > perl translate update fr-FR - Open the corresponding .po file for the strings pulled from JavaScript e.g. misc/translator/po/fr-FR-staff-prog.po - Locate strings pulled from reports/guided_reports_start.tt for translation, e.g.: #: koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt:1324 #, fuzzy, c-format msgid "Authorized value category:" msgstr "Catégorie de valeur autorisée : " - Edit the "msgstr" string if necessary, or remove the "fuzzy," before "c-format" - Install the updated translation: > perl translate install fr-FR In the staff interface, switch to the language you're testing. Confirm that your translated strings appear. In this case, test in particular: - The controls on the modal window when you preview a report's SQL from the list of saved reports. - The controls and modal dialog for inserting a runtime parameter. Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Created attachment 119814 [details] [review] Bug 27644: (QA follow-up) Remove size=1 from template Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Pushed to master for 21.05, thanks to everybody involved!
Enhancement not pushed to 20.11.x