<% /*
    $Revision$
    $Id$

    File:           model_bes_discipline.inc

    Description:    Vanuit CodeCharge gegenereerd model voor bes_discipline

    Context:

    Notes:          intern hebben we een apart model voor _bes_disc_params
                    Naar de buitenwereld presenteren we het als één model
*/
%>

<!-- #include file="../api2/model_bes_disc_params.inc" -->
<%
function model_bes_discipline(disc_key, params)
{
    // Eén model voor de buitenwereld
    api2.merge_disc_params_model(this, _model_bes_discipline);

    this.REST_GET    = generic_REST_GET(_model_bes_discipline,  // Let op: de originele _model_bes_discipline
                                           { "GET": {
                                               wheres: [ "ins_tab_discipline.ins_discipline_module = 'BES'"
                                                       ]
                                               }
                                           }
                                       );

    this.REST_POST   = generic_REST_POST(_model_bes_discipline);
    this.REST_PUT    = generic_REST_PUT(_model_bes_discipline);
    this.REST_DELETE = generic_REST_DELETE(this, {});
}

_model_bes_discipline = // Internal only
{
    "table": "ins_tab_discipline",
    "primary": "ins_discipline_key",
    "records_name": "bes_disciplines",
    "record_name": "bes_discipline",
    "soft_delete": "ins_discipline_verwijder",
    "autfunction": "WEB_BESMSU",
    "record_title": L("bes_discipline"),
    "records_title": L("bes_discipline_m"),


    "fields": {
        "id": {
            "dbs": "ins_discipline_key",
            "label": "Key",
            "typ": "key",
            "required": true,
            "filter": "exact",
            "seq": "ins_s_ins_discipline_key"
        },
        "ins_discipline_module": {
            "dbs": "ins_discipline_module",
            "label": L("ins_discipline_module"),
            "typ": "varchar",
            "defaultvalue": "BES",
            "hidden_fld": true
        },
        "name": {
            "dbs": "ins_discipline_omschrijving",
            "label": L("ins_discipline_omschrijving"),
            "typ": "varchar",
            "filter": "like",
            "translate": true,
            "required": true
        },
        "costtype": {
            "dbs": "prs_kostensoort_key",
            "label": L("prs_kostensoort_key"),
            "typ": "key",
            "foreign": "prs_kostensoort",
            "LOVinit": ""
        },
        "ins_discipline_kpnverplicht": {
            "dbs": "ins_discipline_kpnverplicht",
            "label": L("ins_discipline_kpnverplicht"),
            "typ": "check"
        },
        "ins_discipline_opmerking": {
            "dbs": "ins_discipline_opmerking",
            "label": L("ins_discipline_opmerking"),
            "typ": "memo",
            "translate": true
       },
        "ins_discipline_ktopercentage": {
            "dbs": "ins_discipline_ktopercentage",
            "label": L("ins_discipline_ktopercentage"),
            "typ": "number"
        },
        "ins_discipline_ktodrempel": {
            "dbs": "ins_discipline_ktodrempel",
            "label": L("ins_discipline_ktodrempel"),
            "typ": "number"
        }
    /* Velden van BES_DISC_PARAMS komen er dynamisch bij */
    },
    "disc_params": {
        model: model_bes_disc_params,
        joinfield: "bes_ins_discipline_key"
    }


}
%>