<% /*
    $Revision$
    $Id$

    File:           model_cnt_discipline.inc

    Description:    Vanuit CodeCharge gegenereerd model voor cnt_discipline

    Context:

    Notes:
*/
%>
<!-- #include file="../api2/model_cnt_disc_params.inc" -->
<%

function model_cnt_discipline(disc_key, params)
{
    // Eén model voor de buitenwereld
    api2.merge_disc_params_model(this, _model_cnt_discipline);

    this.REST_GET    = generic_REST_GET(_model_cnt_discipline,  // Let op: de originele _model_cnt_discipline
                                           { "GET": {
                                               wheres: [ "ins_tab_discipline.ins_discipline_module = 'CNT'"
                                                       ]
                                               }
                                           }
                                       );
    this.REST_POST   = generic_REST_POST(_model_cnt_discipline);
    this.REST_PUT    = generic_REST_PUT(_model_cnt_discipline);
    this.REST_DELETE = generic_REST_DELETE(this, {});
}


_model_cnt_discipline = // Internal only
{
    "table": "ins_tab_discipline",
    "primary": "ins_discipline_key",
    "records_name":"cnt_disciplines",
    "record_name": "cnt_discipline",
    "soft_delete": "ins_discipline_verwijder",
    "autfunction": "WEB_CNTMGT",
    "record_title": L("cnt_discipline"),
    "records_title": L("cnt_discipline_m"),


    "fields": {
        "id": {
            "dbs": "ins_discipline_key",
            "label": "Key",
            "typ": "key",
            "required": true,
            "filter": "exact",
            "seq": "ins_s_ins_discipline_key"
        },
        "name": {
            "dbs": "ins_discipline_omschrijving",
            "label": L("ins_discipline_omschrijving"),
            "typ": "varchar",
            "filter": "like",
            "translate": true,
            "required": true
        },
        "ins_discipline_module": {
            "dbs": "ins_discipline_module",
            "label": L("ins_discipline_module"),
            "typ": "varchar",
            "hidden_fld": true,
            "defaultvalue": "CNT"
        },
        "costtype": {
            "dbs": "prs_kostensoort_key",
            "label": L("prs_kostensoort_key"),
            "typ": "key",
            "foreign": "prs_kostensoort",
            "LOVinit": ""
        },
        "email": {
            "dbs": "ins_discipline_email",
            "label": L("ins_discipline_email"),
            "typ": "varchar"
        }
    /* Velden van CNT_DISC_PARAMS komen er dynamisch bij */
    },
    "disc_params": {
        "model": model_cnt_disc_params,
        "joinfield": "cnt_ins_discipline_key"
    }
}
%>