FSN#39393 SQL expressie kolommen niet verwijderen of wijzigen

svn path=/Website/branches/v2016.3/; revision=32800
This commit is contained in:
Erik Groener
2017-02-13 15:24:44 +00:00
parent 298032dbd5
commit 343340df1d
2 changed files with 17 additions and 9 deletions

View File

@@ -122,7 +122,7 @@ function model_reportcolumns(usrrap_key, params)
rowClass: this.fnrowClass rowClass: this.fnrowClass
}; };
this.hook_pre_edit = function (obj) this.hook_pre_edit = function (obj, fld)
{ {
this.fields.filter.LOV = api2.filterLOV(L("lcl_rap_filterLOV"), "A,E,R"); // De meesten mogen L(ike) niet this.fields.filter.LOV = api2.filterLOV(L("lcl_rap_filterLOV"), "A,E,R"); // De meesten mogen L(ike) niet
if ((obj.datatype && !obj.expression) || !user.has("WEB_FACTAB")) if ((obj.datatype && !obj.expression) || !user.has("WEB_FACTAB"))
@@ -165,7 +165,9 @@ function model_reportcolumns(usrrap_key, params)
this.fields.name.insertonly = false; this.fields.name.insertonly = false;
// Een zelf toegevoegd veld mag ook verwijderd worden. // Een zelf toegevoegd veld mag ook verwijderd worden.
if (obj.expression) if (obj.expression)
this.REST_DELETE = this._REST_DELETE; {
this.REST_DELETE = generic_REST_DELETE(this); //this._REST_DELETE;
}
} }
}; };
@@ -173,7 +175,12 @@ function model_reportcolumns(usrrap_key, params)
{ {
if (obj.id == -1) if (obj.id == -1)
this.fields.expression.readonly = false; this.fields.expression.readonly = false;
} };
this.hook_pre_delete = function (params, columns_key)
{
this.REST_DELETE = generic_REST_DELETE(this);
};
// Maakt de default fac_usrrap_cols records aan aan de hand van de view of werk ze bij // Maakt de default fac_usrrap_cols records aan aan de hand van de view of werk ze bij
this._view2columns = function (usrrap_key, lastrefresh, oldcols) this._view2columns = function (usrrap_key, lastrefresh, oldcols)
@@ -361,7 +368,7 @@ function model_reportcolumns(usrrap_key, params)
+ " SET fac_usrrap_col_refresh = SYSDATE" + " SET fac_usrrap_col_refresh = SYSDATE"
+ " WHERE fac_usrrap_key = " + usrrap_key; + " WHERE fac_usrrap_key = " + usrrap_key;
Oracle.Execute(sql); Oracle.Execute(sql);
}, }
this.REST_GET = function _GET(params) this.REST_GET = function _GET(params)
{ {
@@ -382,7 +389,8 @@ function model_reportcolumns(usrrap_key, params)
} }
return json; return json;
}; }
this.REST_PUT = function (params, jsondata, the_key) /* update columns */ this.REST_PUT = function (params, jsondata, the_key) /* update columns */
{ {
var valid_char = /^[_0-9a-zA-Z]+$/; // Alleen deze tekens zijn geldig! var valid_char = /^[_0-9a-zA-Z]+$/; // Alleen deze tekens zijn geldig!
@@ -403,7 +411,8 @@ function model_reportcolumns(usrrap_key, params)
abort_with_warning(err.friendlyMsg); abort_with_warning(err.friendlyMsg);
return { key: the_key }; return { key: the_key };
}; }
this._REST_PUT = this.REST_PUT; // Interne is er altijd this._REST_PUT = this.REST_PUT; // Interne is er altijd
// Only internally used by report_clone and _view2columns // Only internally used by report_clone and _view2columns
@@ -429,9 +438,6 @@ function model_reportcolumns(usrrap_key, params)
return { key: col_key, warning: "" }; return { key: col_key, warning: "" };
} }
this._REST_DELETE = generic_REST_DELETE(this);
if (rap_key > 0) if (rap_key > 0)
{ {
// var rap_data = model_reportsx(rap_key); te veel recursie // var rap_data = model_reportsx(rap_key); te veel recursie

View File

@@ -18,6 +18,8 @@ function scaffolding_delete(model, scf_params)
var key = getQParamInt( "id" ); var key = getQParamInt( "id" );
var params = { }; var params = { };
if ("hook_pre_delete" in model)
model.hook_pre_delete(params, key);
var xxx_array = model.REST_DELETE(params, key); var xxx_array = model.REST_DELETE(params, key);
var warning = xxx_array.warning; var warning = xxx_array.warning;