Files
Facilitor/APPL/API2/model_fac_functie.inc
Jos Groot Lipman 468a5b26a0 FSN#34558 Taal functies en modules
svn path=/Website/trunk/; revision=32079
2016-12-21 20:52:30 +00:00

133 lines
4.1 KiB
SourcePawn

<% /*
$Revision$
$Id$
File: model_fac_functie.inc
Description: Dit is het model om de *rechten* van een groep voor diverse
functies te beheren.
model_fac_functie moet dan ook altijd aangroepen worden met
een fac_groep_key
Context:
Notes:
*/
%>
<!-- #include file="../api2/model_fac_groeprechten.inc" -->
<%
function model_fac_functie (functie_key, params)
{
this.table = "fac_functie";
this.primary = "fac_functie_key";
this.records_name = "fac_functies";
this.record_name = "fac_functie";
this.module = null;
if (params.disc_key > 0)
{
var sql = "SELECT ins_discipline_module FROM ins_tab_discipline WHERE ins_discipline_key = " + params.disc_key;
var oRs = Oracle.Execute(sql);
this.module = oRs("ins_discipline_module").Value;
oRs.Close();
}
this.fields = {
"id": {
"dbs": "fac_functie_key",
"label": "Key",
"typ": "key",
"required": true,
"seq": "fac_s_fac_functie_key"
},
"module": {
"dbs": "fac_functie_module",
"label": L("fac_functie_module"),
"readonly": true,
"typ": "varchar",
"filterdefault": this.module?":!"+this.module:null,
"showfixedfilter": true,
"foreign": {
"tbl": "fac_module",
"key": "fac_module_name",
"desc": "fac_module_name || ' - ' || lcl.l(fac_module_remark)"
}
},
"name": {
"dbs": "fac_functie_code",
"label": L("fac_functie_code"),
"readonly": true,
"typ": "varchar"
},
"_sorter": {
"dbs": "CASE WHEN SUBSTR(fac_functie_code, 8, 3) IN ('USE', 'FOF', 'BOF', 'BAC') AND SUBSTR(fac_functie_code, 5, 3) NOT IN ('UUR') THEN 0 ELSE 1 END",
"readonly": true,
"typ": "number"
},
"level": {
"dbs": "fac_functie_min_level",
"label": L("fac_functie_min_level"),
"readonly": true,
"typ": "number",
"LOV": L("fac_functie_min_levelLOV"),
"hidden_fld": true
},
"discipline": {
"dbs": "fac_functie_discipline",
"label": L("fac_functie_discipline"),
"readonly": true,
"typ": "number",
"LOV": L("fac_functie_disciplineLOV"),
"hidden_fld": true
},
"group": {
"dbs": "fac_functie_groep",
"label": L("fac_functie_groep"),
"readonly": true,
"typ": "number",
"LOV": L("fac_functie_groepLOV"),
"hidden_fld": true
},
"description": {
"dbs": "fac_functie_omschrijving",
"label": L("fac_functie_omschrijving"),
"typ": "varchar",
"required": true,
"islcl": true
},
"info": {
"dbs": "fac_functie_info",
"label": L("fac_functie_info"),
"typ": "memo",
"islcl": true
}
};
if (params.groep_key > 0 || params.disc_key > 0)
{
this.includes = {"authorization":
{ "model": new model_fac_groeprechten(params),
"joinfield": "fac_functie",
"outertoggle": { def: false, lbl: L("fac_gebruiker_outerfunctie") }
}};
}
this.autfunction = "WEB_PRSMSU";
this.record_title = L("fac_functie");
this.records_title = L("fac_functie_m");
var xparams = { GET: { wheres: [] } }
if (params.disc_key > 0)
{
xparams.GET.wheres.push("fac_functie_module = " + safe.quoted_sql(this.module),
"fac_functie_discipline = 1" // dan ook alleen de discipline gebonden functies
);
}
if (!user.has("WEB_FACFAC"))
{
xparams.GET.wheres.push("fac_functie_code NOT IN ('WEB_FACFAC', 'WEB_FACTAB')");
}
this.REST_GET = generic_REST_GET(this, xparams);
//this.REST_POST = generic_REST_POST(this);
//this.REST_PUT = generic_REST_PUT(this);
//this.REST_DELETE = generic_REST_DELETE(this);
}
%>