authen
.public
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
sp_get_printform_list_js
Parameters
Name
Type
Mode
i_prop_code
citext
IN
Definition
declare json_result json; -- url_prefix text = fn_get_config(null, 'FILE_STORAGE_URL')||'report_src/'; v_prop_id int; begin /** * Create by KenG (2021/09/02) * return report type = print form * -- Incase column report_file in property_report do description after this! * -- report_filename in reports table is default/ * -- if set in property_report table seclect this */ -- url_prefix = fn_get_config(null, 'PREFIX_URL_PMS_FILE'); --'http://file.fromas.local'; --https://file.fromas.cloud/report/?name= v_prop_id := (select p.id from property p where p.code = $1); select jsonb_agg(dataset) from ( select coalesce(array_agg(json_build_object( 'id', r.id, 'name', r.report_name, 'filename', r.report_filename, 'form_type', coalesce(pf.form_type, r.category), 'path_url', null, --url_prefix || r.path_url, 'options', r."options" is not null )), '{}') as print_form from reports r left join print_form pf on r.id = pf.report_id and pf.prop_id = v_prop_id where r.report_type = 'print_form' ) as dataset into json_result; return coalesce(json_result, '[]'); END;