Bug 41452

Summary: Add optional “Beautify” formatting for CodeMirror SQL / JS / CSS editors
Product: Koha Reporter: Saiful Amin <saiful>
Component: Staff interfaceAssignee: Bugs List <koha-bugs>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: gmcharlt
Version: Main   
Hardware: All   
OS: All   
GIT URL: Initiative type: ---
Sponsorship status: --- Comma delimited list of Sponsors:
Crowdfunding goal: 0 Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:

Description Saiful Amin 2025-12-16 06:56:04 UTC
Koha uses CodeMirror for editing SQL (Reports) and custom JS/CSS. While syntax highlighting is available, there is no way to format existing content.

Even a short SQL query (4–5 lines) quickly becomes hard to read and error-prone when pasted or modified over time. A simple "Beautify" action, similar to what tools like Postman provide, would significantly improve readability and maintainability.


Expected behavior:
Provide an optional, client-side “Beautify” button for CodeMirror editors that:
* Formats SQL in the Reports module
* Formats JS/CSS in relevant system preference editors
* Runs client-side only and is explicitly triggered

This would not affect query execution or validation, and would only improve editor readability.

Widely used open-source client-side formatters (e.g. Prettier for JS/CSS and sql-formatter for SQL) could be integrated and loaded only on relevant pages.