FSN#31698 Rapportgenerator savepoint
svn path=/Website/trunk/; revision=24322
This commit is contained in:
82
APPL/API2/model_reportcolumns.inc
Normal file
82
APPL/API2/model_reportcolumns.inc
Normal file
@@ -0,0 +1,82 @@
|
||||
<% /*
|
||||
$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",
|
||||
parent_key: "fac_usrrap_key",
|
||||
|
||||
fields: { "id" : { dbs: "fac_usrrap_cols_key", typ: "key", filter: "exact" },
|
||||
"sequence" : { dbs: "fac_usrrap_cols_volgnr", typ: "number", label: L("lcl_rap_sequence") },
|
||||
"columnname": { dbs: "fac_usrrap_cols_column_name", typ: "varchar", label: L("lcl_rap_column"), insertonly: true },
|
||||
"caption" : { dbs: "fac_usrrap_cols_caption", typ: "varchar", label: L("lcl_rap_caption")},
|
||||
"datatype" : { dbs: "fac_usrrap_cols_datatype", typ: "varchar", label: L("lcl_rap_datatype"),
|
||||
LOV: "varchar;Tekst;date;Datum;float;Float;integer;Getal"},
|
||||
"filter" : { dbs: "fac_usrrap_cols_filter", typ: "varchar", label: L("lcl_rap_filter")},
|
||||
"total" : { dbs: "fac_usrrap_cols_total", typ: "varchar", label: L("lcl_rap_total")}
|
||||
},
|
||||
list: { columns: ["id", "sequence", "columnname", "caption", "datatype"] },
|
||||
|
||||
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 };
|
||||
},
|
||||
// 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
|
||||
}
|
||||
|
||||
%>
|
||||
Reference in New Issue
Block a user