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.