FSN#35498 UDR: kolom-expressies mogelijk maken
svn path=/Website/trunk/; revision=29386
This commit is contained in:
@@ -29,8 +29,12 @@ function model_reportcolumns(usrrap_key, params)
|
||||
this.edit = { modal: true };
|
||||
|
||||
this.fields =
|
||||
{ "id" : { dbs: "fac_usrrap_cols_key", typ: "key", filter: "exact", seq: "fac_s_fac_usrrap_cols_key" },
|
||||
"name" : { dbs: "fac_usrrap_cols_column_name", typ: "varchar", label: L("lcl_rap_column"), insertonly: true },
|
||||
{ "id" : { dbs: "fac_usrrap_cols_key", typ: "key", label: "Key",
|
||||
filter: "exact",
|
||||
seq: "fac_s_fac_usrrap_cols_key" },
|
||||
"name" : { dbs: "fac_usrrap_cols_column_name", typ: "varchar", label: L("lcl_rap_column"),
|
||||
required: true,
|
||||
readonly: true },
|
||||
"datatype" : { dbs: "fac_usrrap_cols_datatype", typ: "varchar", label: L("lcl_rap_datatype"),
|
||||
required: true,
|
||||
LOV: L("lcl_rap_datatypeLOV")}, // "varchar;Tekst;date;Datum;datetime;Datumtijd;float;Float;currency;Bedrag;number;Getal"
|
||||
@@ -45,7 +49,9 @@ function model_reportcolumns(usrrap_key, params)
|
||||
"group" : { dbs: "fac_usrrap_cols_group", typ: "varchar", label: L("lcl_rap_groupby"),
|
||||
required: true,
|
||||
LOV: L("lcl_rap_groupbyLOV") },
|
||||
"fac_usrrap_key" : { dbs: "fac_usrrap_key", typ: "key" }
|
||||
"fac_usrrap_key" : { dbs: "fac_usrrap_key", typ: "key", hidden_fld: true },
|
||||
"expression": { dbs: "fac_usrrap_cols_expression", typ: "memo", label: "sql-expressie",
|
||||
readonly: true}
|
||||
|
||||
};
|
||||
|
||||
@@ -59,7 +65,7 @@ function model_reportcolumns(usrrap_key, params)
|
||||
this.hook_pre_edit = function (obj)
|
||||
{
|
||||
this.fields.filter.LOV = api2.filterLOV(L("lcl_rap_filterLOV"), "A,E,R"); // De meesten mogen L(ike) niet
|
||||
if (obj.datatype)
|
||||
if (obj.datatype && !obj.expression)
|
||||
{
|
||||
switch (obj.datatype.id)
|
||||
{
|
||||
@@ -92,6 +98,14 @@ function model_reportcolumns(usrrap_key, params)
|
||||
this.fields.group.LOV = api2.filterLOV(L("lcl_rap_groupbyLOV"), "G");
|
||||
}
|
||||
}
|
||||
|
||||
if (obj.expression || !obj.id)
|
||||
{
|
||||
this.fields.expression.readonly = false;
|
||||
this.fields.expression.required = true;
|
||||
this.fields.name.readonly = false;
|
||||
this.fields.name.required = true;
|
||||
}
|
||||
};
|
||||
|
||||
// Maakt de default fac_usrrap_cols records aan aan de hand van de view of werk ze bij
|
||||
@@ -236,7 +250,8 @@ function model_reportcolumns(usrrap_key, params)
|
||||
__Log("Dropping column {0}".format(oldcols[o].name));
|
||||
// We kennen geen REST_DELETE
|
||||
var sql = "DELETE fac_usrrap_cols"
|
||||
+ " WHERE fac_usrrap_cols_key = " + oldcols[o].id;
|
||||
+ " WHERE fac_usrrap_cols_expression IS NULL"
|
||||
+ " AND fac_usrrap_cols_key = " + oldcols[o].id;
|
||||
Oracle.Execute(sql);
|
||||
}
|
||||
}
|
||||
@@ -320,7 +335,9 @@ function model_reportcolumns(usrrap_key, params)
|
||||
var dbfields = api2.update_fields(params, this, jsondata); // Build updater
|
||||
|
||||
dbfields["id"] = this.fields["id"];
|
||||
dbfields["xxx"] = { dbs: "fac_usrrap_key", typ: "key", val: parent_key };
|
||||
if (parent_key && !jsondata.fac_usrrap_key)
|
||||
dbfields["xxx"] = { dbs: "fac_usrrap_key", typ: "key", val: parent_key };
|
||||
|
||||
var rapIns = buildInsert("fac_usrrap_cols", dbfields, { noValidateToken: true });
|
||||
var col_key = rapIns.sequences["fac_usrrap_col_key"];
|
||||
|
||||
@@ -345,7 +362,7 @@ function model_reportcolumns(usrrap_key, params)
|
||||
this.REST_PUT = false;
|
||||
}
|
||||
|
||||
if (params.internal)
|
||||
if (params.internal || user.has("WEB_FACTAB"))
|
||||
{
|
||||
this.REST_POST = this._REST_POST; // Voor de clone-report
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user