<% /*
    $Revision$
    $Id$

    File:           model_mld_kenmerk.inc

    Description:    Vanuit CodeCharge gegenereerd model voor mld_kenmerk

    Context:

    Notes:          LET OP: uitsluitend gebruikt voor opdracht kenmerken. Daar
                    filteren we op en opdr_type is ook verplicht gemaakt.
                    Melding kenmerken komen in dezelfde tabel maar die hebben
                    eigen schermen via MLD\mld_kenmerk.asp
*/
%>
<%

function model_mld_kenmerk()
{
    this.table = "mld_kenmerk";
    this.primary = "mld_kenmerk_key";
    this.records_name = "mld_kenmerks";
    this.record_name = "mld_kenmerk";
    this.soft_delete = "mld_kenmerk_verwijder";
    this.autfunction = "WEB_MLDMGT";
    this.record_title = L("mld_kenmerk");
    this.records_title = L("mld_kenmerk_m");


    this.fields = {
        "id": {
            "dbs": "mld_kenmerk_key",
            "label": "Key",
            "typ": "key",
            "required": true,
            "filter": "exact",
            "seq": "mld_s_mld_kenmerk_key",
            "readonly": true
        },
        "level": {
            "dbs": "mld_kenmerk_niveau",
            "label": L("mgt_kenmerk_niveau"),
            "typ": "varchar",
            "required": true,
            "hidden_fld": true,
            "defaultvalue": "O"
        },
        "type": {
            "dbs": "mld_srtkenmerk_key",
            "label": L("mgt_srtkenmerk_key"),
            "typ": "key",
            "required": true,
            "foreign":{
                "tbl": "(select mld_srtkenmerk_key"
                     + "      , mld_srtkenmerk_omschrijving"
                     + "   from mld_srtkenmerk"
                     + "  where mld_srtkenmerk_verwijder is null"
                     + "  order by mld_srtkenmerk_upper asc)",
                "key": "mld_srtkenmerk_key",
                "desc": "mld_srtkenmerk_omschrijving"
            },
            "filter": "exact",
            "defaultvalue": null,
            "LOVinit": "",
            "friendlyname": true
        },
        "order_type": {
            "dbs": "mld_typeopdr_key",
            "label": L("mld_typeopdr"),
            "typ": "key",
            "foreign": {
                "tbl": "(select mld_typeopdr_key"
                     + "      , mld_typeopdr_omschrijving"
                     + "   from mld_typeopdr"
                     + "  order by mld_typeopdr_upper asc)",
                "key": "mld_typeopdr_key",
                "desc": "mld_typeopdr_omschrijving"
            },
            "required": true,
            "defaultvalue": null
        },
        "sequence": {
            "dbs": "mld_kenmerk_volgnummer",
            "label": L("mgt_kenmerk_volgnummer"),
            "typ": "number",
            "required": true
        },
        "group": {
            "dbs": "mld_kenmerk_groep",
            "label": L("mgt_kenmerk_groep"),
            "typ": "key",
            "required": true,
            "LOV": buildGroepsverplichtingList(),
            "defaultvalue": "0"
        },
        "mld_kenmerk_locatiekolom": {
            "dbs": "mld_kenmerk_locatiekolom",
            "label": L("mld_kenmerk_locatiekolom"),
            "typ": "varchar",
            "hidden_fld": true
        },
        "required": {
            "dbs": "mld_kenmerk_verplicht",
            "label": L("mgt_kenmerk_verplicht"),
            "typ": "key",
            "LOV": buildVerplichtingList(),
            "emptyoption": null
        },
        "required_status": {
            "dbs": "mld_kenmerk_verplicht_status",
            "label": L("mld_kenmerk_verplicht_status"),
            "typ": "key",
            "LOV": buildStatusList(),
            "emptyoption": null
        },
        "readonly": {
            "dbs": "mld_kenmerk_toonbaar",
            "label": L("mgt_kenmerk_toonbaar"),
            "typ": "check"
        },
        "default": {
            "dbs": "mld_kenmerk_default",
            "label": L("mgt_kenmerk_default"),
            "typ": "memo",
            "translate": true
        },
        "mld_stdmelding_key": {
            "dbs": "mld_stdmelding_key",
            "label": L("mld_stdmelding_key"),
            "typ": "key",
            "hidden_fld": true,
            "foreign": {
                "tbl": "(select m.mld_stdmelding_key"
                     + "      , d.ins_discipline_omschrijving || '/' || m.mld_stdmelding_omschrijving  stdmelding_omschr"
                     + "   from mld_stdmelding m"
                     + "      , mld_v_aanwezigdiscipline d"
                     + "  where m.mld_ins_discipline_key = d.ins_discipline_key"
                     + "  order by d.ins_discipline_omschrijving asc"
                     + "         , m.mld_stdmelding_omschrijving asc)",
                "key": "mld_stdmelding_key",
                "desc": "stdmelding_omschr"
            },
            "filter": "exact",
            "LOVinit": ""
        },
        "hint": {
            "dbs": "mld_kenmerk_hint",
            "label": L("mgt_kenmerk_hint"),
            "typ": "memo",
            "translate": true
        },
        "regexp": {
            "dbs": "mld_kenmerk_regexp",
            "label": L("mgt_kenmerk_regexp"),
            "typ": "varchar"
        }
    };


    this.REST_GET    = generic_REST_GET(this, {
        "GET": {
            "wheres": ["mld_kenmerk_niveau = 'O'"]
        }
    });
    this.REST_POST   = generic_REST_POST(this);
    this.REST_PUT    = generic_REST_PUT(this);
    this.REST_DELETE = generic_REST_DELETE(this);
}
%>