<% /*
    $Revision$
    $Id$

    File:           model_cnt_kenmerk.inc

    Description:    Vanuit CodeCharge gegenereerd model voor cnt_kenmerk

    Context:

    Notes:
*/
%>
<%

function model_cnt_kenmerk()
{
    this.table = "cnt_kenmerk";
    this.primary = "cnt_kenmerk_key";
    this.records_name = "cnt_kenmerks";
    this.record_name = "cnt_kenmerk";
    this.soft_delete = "cnt_kenmerk_verwijder";
    this.autfunction = "WEB_CNTMGT";
    this.record_title = L("cnt_kenmerk");
    this.records_title = L("cnt_kenmerk_m");


    this.fields = {
        "id": {
            "dbs": "cnt_kenmerk_key",
            "label": "Key",
            "typ": "key",
            "required": true,
            "filter": "exact",
            "seq": "cnt_s_cnt_kenmerk_key",
            "readonly": true
        },
        "property_key": {
            "dbs": "cnt_srtkenmerk_key",
            "label": L("mgt_srtkenmerk_key"),
            "typ": "key",
            "required": true,
            "foreign": {
                "tbl": "(select cnt_srtkenmerk_key"
                     + "      , cnt_srtkenmerk_omschrijving"
                     + "   from cnt_srtkenmerk"
                     + "  where cnt_srtkenmerk_verwijder is null"
                     + "  order by cnt_srtkenmerk_upper asc)",
                "key": "cnt_srtkenmerk_key",
                "desc": "cnt_srtkenmerk_omschrijving"
            },
            "filter": "exact",
            "defaultvalue": null,
            "LOVinit": "",
            "friendlyname": true
        },
        "property_type": {
            "dbs": "cnt_srtkenmerk.cnt_srtkenmerk_kenmerktype",
            "label": L("mgt_srtkenmerk_kenmerktype"),
            "typ": "varchar",
            "hidden_fld": true,
            "LOV": buildKenmerktypeLOV(),
            "filter": "exact"
        },
        "contract_type": {
            "dbs": "cnt_srtcontract_key",
            "label": L("cnt_srtcontract_key"),
            "typ": "key",
            "required": true,
            "foreign": {
                "tbl": "(select ins_discipline_key"
                     + "      , ins_discipline_omschrijving"
                     + "   from cnt_discipline"
                     + "  where ins_discipline_verwijder is null"
                     + "  order by ins_discipline_omschrijving asc)",
                "key": "ins_discipline_key",
                "desc": "ins_discipline_omschrijving"
            },
            "filter": "exact",
            "LOVinit": ""
        },
        "cnt_kenmerk_niveau": {
            "dbs": "cnt_kenmerk_niveau",
            "label": L("mgt_kenmerk_niveau"),
            "typ": "varchar",
            "hidden_fld": true,
            "LOV": fill_cnt_niveau_LOV(),
            "defaultvalue": "S"
        },
        "sequence": {
            "dbs": "cnt_kenmerk_volgnummer",
            "label": L("mgt_kenmerk_volgnummer"),
            "typ": "number",
            "required": true
        },
        "cnt_kenmerk_locatiekolom": {
            "dbs": "cnt_kenmerk_locatiekolom",
            "label": L("ins_kenmerk_locatiekolom"),
            "typ": "varchar",
            "hidden_fld": true
        },
        "required": {
            "dbs": "cnt_kenmerk_verplicht",
            "label": L("mgt_kenmerk_verplicht"),
            "typ": "key",
            "LOV": buildVerplichtingList(),
            "emptyoption": null
        },
        "property_group": {
            "dbs": "cnt_kenmerk_groep",
            "label": L("mgt_kenmerk_groep"),
            "typ": "key",
            "required": true,
            "LOV": buildGroepsverplichtingList(),
            "defaultvalue": "0"
        },
        "readonly": {
            "dbs": "cnt_kenmerk_toonbaar",
            "label": L("mgt_kenmerk_toonbaar"),
            "typ": "check"
        },
        "default": {
            "dbs": "cnt_kenmerk_default",
            "label": L("mgt_kenmerk_default"),
            "typ": "memo",
            "translate": true
        },
        "hint": {
            "dbs": "cnt_kenmerk_hint",
            "label": L("mgt_kenmerk_hint"),
            "typ": "memo",
            "translate": true
        },
        "regexp": {
            "dbs": "cnt_kenmerk_regexp",
            "label": L("mgt_kenmerk_regexp"),
            "typ": "varchar"
        }
    };


    this.REST_GET    = generic_REST_GET(this, {
        "GET": {
            "tables": [ "cnt_srtkenmerk"],
            "wheres": [ "cnt_srtkenmerk.cnt_srtkenmerk_key = cnt_kenmerk.cnt_srtkenmerk_key",
                        "cnt_srtkenmerk.cnt_srtkenmerk_verwijder IS NULL" ]
        }
    });

    this.REST_POST   = generic_REST_POST(this);
    this.REST_PUT    = generic_REST_PUT(this);
    this.REST_DELETE = generic_REST_DELETE(this);


    function fill_cnt_niveau_LOV()
    {
        return  "D;"+L("cnt_niveau_discipline")
             + ";S;"+L("cnt_niveau_herkenning");
    }
}
%>