ODT Reportman Library
ODT Reportman library produces a MasonSQL reports using an
.odt files as templates. The template files are created with the
LibreOffice's application.
The reports are configured in
public.odt_reports
table which can be managed by users with
ODT Reports
web interface.
Permissions
To access a report an user must first add the report to the
public.odt_reports
table. For application specific reports the name of the report must also have
app_schema_name.
prefix.
The report permission is checked with the
Permission() subroutine.
Once a report is prepared, it can be called from the MasonSQL application with
[Stampa]
or
[St.sel]
buttons or with customarily created buttons.
The buttons must then call the report with
printSelected() function, which triggers the generation of the report.
The application composes the report name by using the
PRINT_FORM method in combination with parameters passed to the
printSelected()
function.
The report name is then searched in the database and report is generated from the provided input parameters.
The report name is composed in the following order:
- The first part is the first parameter of the
PRINT_FORM
(not null for security).
- The second part is the
report_suffic
parameter passed to the printSelected()
function.
- In case the
report_suffix
parameter contains a suffix that indicates the report method (.pdf ...), the suffix is excluded from the report name.
The application additionally checks the suffix, of the
report
parameter, to determine which report method to use.
The only possible report methods are
pdf
,
odt
and
rep
.
In consequence the application will report an error if it finds any other suffix after the dot character;
Thus in case the
report
parameter contains dots the suffix after the last dot must be a valid report method. The report method suffix will not get included in the report name.
When the report is named after the corresponding menu, the
[Stampa]
and
[St.sel]
buttons should automatically become enabled.
The user must also have the
Print
and
PrintSel
permissions.
For example for the
public.anagrafiche
table it is sufficient to set the name of the report to
anagrafiche
:
Consequently in the
Config->Anagrafiche
menu has
[St.sel]
and
[Stampa]
buttons enabled:
The example button directly calls
printSelected() subroutine with
sel
type and
report
name concatenated with
.pdf
suffix:
<button onclick="<%$Display%>.printSelected('sel', '_my_report.pdf');">Example</button>
The report name could be complete report name but also it can be part of the report name. When the
PRINT_FORM is defined its first argument can additionally define
schema_name/table_name
:
<%method PRINT_FORM>my_schema/my_table, PORTRAIT, PARAM1=3 %></%method>
In case of such
PRINT_FORM
definition, the actual report name in the
public.odt_reports
table must be
my_schema.my_report
.
Reference
The
ODT Report POD reference is available.