Files
Facilitor/APPL/API2/model_ctr_discipline.inc
Koen Reefman 8a397f0c68 YASK#81166 isApiUser -> WEB_FACXNR
svn path=/Website/trunk/; revision=63493
2024-02-07 10:24:34 +00:00

101 lines
3.2 KiB
PHP

<% /*
$Revision$
$Id$
File: model_ctr_discipline.inc
Description: Model voor srtcontrole disciplines
Context:
Notes: intern hebben we een apart model voor ctr_disc_params
Naar de buitenwereld presenteren we het als één model
*/
%>
<!-- #include file="model_ctr_disc_params.inc" -->
<!-- #include file="../mgt/mgt.inc"-->
<%
function model_ctr_discipline(disc_key, params)
{
// Eén model voor de buitenwereld
var disc = new _model_ctr_discipline();
api2.merge_disc_params_model(this, disc);
this.hook_post_post = function (params, obj, key)
{
var org_disc_key = getQParamInt("id", -1);
var clone_auth = getQParamInt("clone_auth", 0) == 1;
if (clone_auth)
{ // Ook de autorisatie van de oude discipline kopieren
mgt.clone_authorization(key, org_disc_key);
}
}
this.REST_GET = generic_REST_GET(disc, // Let op: de originele _model
{ "GET": {
wheres: [ "ins_tab_discipline.ins_discipline_module = 'CTR'"
]
}
}
)
this.REST_POST = generic_REST_POST(disc);
this.REST_PUT = generic_REST_PUT(disc);
this.REST_DELETE = generic_REST_DELETE(this, {});
}
function _model_ctr_discipline()
{
this.records_name = "taskdisciplines";
this.record_name = "taskdiscipline";
this.table = "ins_tab_discipline";
this.terms = "ctr_discipline";
this.audit = { "childtable": "ctr_disc_params" }, // Parameters voor fac_audit.
this.primary = "ins_discipline_key";
this.autfunction = "WEB_CTRMGT";
this.record_title = L("ctr_discipline");
this.records_title = L("ctr_discipline_m");
this.fields = {
"id": {
"dbs": "ins_discipline_key",
"label": L("lcl_key"),
"typ": "key",
"required": true,
"seq": "ins_s_ins_discipline_key"
},
"module": {
"dbs": "ins_discipline_module",
"label": L("ctr_discipline_module"),
"typ": "varchar",
"hidden_fld": true,
"defaultvalue": "CTR"
},
"name": {
"dbs": "ins_discipline_omschrijving",
"label": L("ctr_discipline_omschrijving"),
"typ": "varchar",
"translate": true,
"required": true
},
"externnr": {
"dbs": "ins_discipline_externnr",
"typ": "varchar",
"label": L("extern_nr")
},
"externsyncdate": {
"dbs": "ins_discipline_externsyncdate",
"typ": "datetime",
"label": L("extern_syncdate"),
"readonly": !(user.has("WEB_FACTAB") || user.has("WEB_FACXNR"))
}
};
/* Velden van CTR_DISC_PARAMS komen er dynamisch bij */
this.disc_params = {
model: model_ctr_disc_params,
joinfield: "taskdiscipline"
};
this.soft_delete = "ins_discipline_verwijder";
}
%>