89 lines
4.0 KiB
PHP
89 lines
4.0 KiB
PHP
<% /*
|
|
$Revision$
|
|
$Id$
|
|
|
|
File: model_report_columns.inc
|
|
|
|
Description: rapport model voor de kolommen van rapporten.
|
|
|
|
Parameters:
|
|
Context:
|
|
|
|
Notes:
|
|
*/
|
|
|
|
// model_reportcolumns is uitsluitend beschikbaar onder model_reports(x) die de autorisatie dan ook doet
|
|
model_reportcolumns =
|
|
{
|
|
table: "fac_usrrap_cols",
|
|
primary: "fac_usrrap_cols_key",
|
|
records_name: "columns",
|
|
record_name: "column",
|
|
records_title: L("lcl_rap_columns"),
|
|
record_title: L("lcl_rap_column"),
|
|
parent_key: "fac_usrrap_key",
|
|
autfunction: "WEB_PRSSYS",
|
|
|
|
fields: { "id" : { dbs: "fac_usrrap_cols_key", typ: "key", filter: "exact" },
|
|
"name" : { dbs: "fac_usrrap_cols_column_name", typ: "varchar", label: L("lcl_rap_column"), insertonly: true },
|
|
"datatype" : { dbs: "fac_usrrap_cols_datatype", typ: "varchar", label: L("lcl_rap_datatype"), insertonly: true,
|
|
LOV: L("lcl_rap_datatypeLOV")}, // "varchar;Tekst;date;Datum;float;Float;integer;Getal"
|
|
"sequence" : { dbs: "fac_usrrap_cols_volgnr", typ: "number", label: L("lcl_rap_sequence") },
|
|
"caption" : { dbs: "fac_usrrap_cols_caption", typ: "varchar", label: L("lcl_rap_caption")},
|
|
"filter" : { dbs: "fac_usrrap_cols_filter", typ: "varchar", label: L("lcl_rap_filter"),
|
|
LOV: L("lcl_rap_filterLOV") }, // "A;Automatisch"
|
|
"visible" : { dbs: "fac_usrrap_cols_visible", typ: "varchar", label: L("lcl_rap_visible"),
|
|
LOV: L("lcl_rap_visibleLOV")}, // "V;Visible;I;Invisible;H;hidden"
|
|
"total" : { dbs: "fac_usrrap_cols_total", typ: "varchar", label: L("lcl_rap_groupby"),
|
|
LOV: L("lcl_rap_groupbydateLOV") + ";" + L("lcl_rap_groupbynumberLOV") }
|
|
},
|
|
list: { columns: ["sequence", "name", "caption", "datatype", "visible", "total"] },
|
|
|
|
REST_GET: function _GET(params)
|
|
{
|
|
var query = api2.sqlfields(params, model_reportcolumns );
|
|
var wheres = api2.sqlfilter(params, model_reportcolumns);
|
|
query.wheres = query.wheres.concat(wheres);
|
|
|
|
var sql = "SELECT " + query.selects.join(", ")
|
|
+ " FROM " + query.tables.join(", ")
|
|
+ " WHERE " + query.wheres.join(" AND " )
|
|
+ " ORDER BY fac_usrrap_cols_volgnr";
|
|
|
|
var json = api2.sql2json (params, sql, model_reportcolumns );
|
|
|
|
return json;
|
|
},
|
|
REST_PUT: function (params, jsondata, the_key) /* update columns */
|
|
{
|
|
var fields = api2.update_fields(params, model_reportcolumns, jsondata); // Build updater
|
|
|
|
var sql = buildUpdate("fac_usrrap_cols", fields) + " fac_usrrap_cols_key = " + the_key;
|
|
var err = Oracle.Execute(sql, true);
|
|
if (err.friendlyMsg)
|
|
abort_with_warning(err.friendlyMsg);
|
|
|
|
return { key: the_key };
|
|
},
|
|
// Only internally used by report_clone
|
|
REST_POST: function (params, jsondata, parent_key) /* insert columns */
|
|
{
|
|
if (!params.internal)
|
|
INTERNAL_ERROR_INTERNAL_ONLY;
|
|
var fields = api2.update_fields(params, model_reportcolumns, jsondata); // Build updater
|
|
|
|
fields.push({ dbs: "fac_usrrap_cols_key", typ: "key", seq: "fac_s_fac_usrrap_cols_key" });
|
|
fields.push({ dbs: "fac_usrrap_key", typ: "key", val: parent_key });
|
|
var roomIns = buildInsert("fac_usrrap_cols", fields, { noValidateToken: true });
|
|
var col_key = roomIns.sequences["fac_usrrap_col_key"];
|
|
|
|
var err = Oracle.Execute(roomIns.sql, true);
|
|
if (err.friendlyMsg)
|
|
abort_with_warning(err.friendlyMsg);
|
|
|
|
return { key: col_key, warning: "" };
|
|
}
|
|
// REST_DELETE: not supported
|
|
}
|
|
|
|
%> |