Files
Facilitor/APPL/API2/model_fac_groep.inc
Jos Groot Lipman 4d8b976f95 FSN#36126 Eenvoudiger meerdere personen in groep kunnen zetten
svn path=/Website/trunk/; revision=32911
2017-02-22 16:22:20 +00:00

103 lines
3.3 KiB
PHP

<% /*
$Revision$
$Id$
File: model_fac_groep.inc
Description: Model voor fac_groep
Context:
Notes:
*/
%>
<!-- #include file="model_fac_gebruikersgroep.inc" -->
<!-- #include file="model_fac_groeprechten.inc" -->
<%
function model_fac_groep(groep_key, params)
{
this.table = "fac_groep";
this.primary = "fac_groep_key";
this.records_name = "fac_groeps";
this.record_name = "fac_groep";
this.fields = {
"id": {
"dbs": "fac_groep_key",
"label": "Key",
"typ": "key",
"required": true,
"seq": "fac_s_fac_groep_key"
},
"name": {
"dbs": "fac_groep_omschrijving",
"label": L("fac_groep_omschrijving"),
"typ": "varchar",
"required": true
},
"remark": {
"dbs": "fac_groep_opmerking",
"label": L("fac_groep_opmerking"),
"typ": "memo"
},
"substitutes": {
"dbs": "fac_groep_collega",
"label": L("lcl_prs_substitutes"),
"typ": "check0"
},
"nn_leden": {
"dbs": "nn_leden",
"sql": "(SELECT COUNT(*) FROM fac_gebruikersgroep WHERE fac_groep.fac_groep_key = fac_gebruikersgroep.fac_groep_key)",
"label": L("fac_groep_nn_leden"),
"typ": "number"
}
}
this.includes = {
"users": {
"model": new model_fac_gebruikersgroep(),
"joinfield": "fac_groep",
"multiadd": "user"
}
};
if (params.functie_key > 0)
{
this.includes["authorization"]
= {
"model": new model_fac_groeprechten(params),
"joinfield": "fac_groep",
outertoggle: { def: false, lbl: L("fac_gebruiker_outergroep") }
};
}
this.autfunction = "WEB_FACMSU";
this.record_title = L("fac_groep");
this.records_title = L("fac_groep_m");
// Groepen met WEB_FACFAC en WEB_FACTAB zie je niet als je die rechten niet zelf hebt
var xparams = { GET: { wheres: [] } }
if (!user.has("WEB_FACFAC"))
{
xparams.GET.wheres.push( "fac_groep.fac_groep_key NOT IN"
+ " (SELECT fac_groep_key"
+ " FROM fac_groeprechten fgr,"
+ " fac_functie ff"
+ " WHERE fgr.fac_functie_key = ff.fac_functie_key"
+ " AND ff.fac_functie_code = 'WEB_FACFAC')");
}
if (!user.has("WEB_FACTAB"))
{
xparams.GET.wheres.push( "fac_groep.fac_groep_key NOT IN"
+ " (SELECT fac_groep_key"
+ " FROM fac_groeprechten fgr,"
+ " fac_functie ff"
+ " WHERE fgr.fac_functie_key = ff.fac_functie_key"
+ " AND ff.fac_functie_code = '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);
}
%>