<% /*
    $Revision$
    $Id$

    File:           model_bes_kenmerkbestel.inc

    Description:    Vanuit CodeCharge gegenereerd model voor bes_kenmerkbestel

    Context:

    Notes:
*/
%>
<%

function model_bes_kenmerkbestel()
{
    this.table = "bes_kenmerk";
    this.primary = "bes_kenmerk_key";
    this.records_name = "bes_kenmerks";
    this.record_name = "bes_kenmerk";
    this.soft_delete = "bes_kenmerk_verwijder";
    this.autfunction = "WEB_BESMGT";
    this.record_title = L("bes_kenmerkbestel");
    this.records_title = L("bes_kenmerkbestel_m");


    this.fields = {
        "id": {
            "dbs": "bes_kenmerk_key",
            "label": "Key",
            "typ": "key",
            "required": true,
            "filter": "exact",
            "seq": "bes_s_bes_kenmerk_key",
            "defaultvalue": null
        },
        "catalogue": {
            "dbs": "bes_srtinstallatie_key",
            "label": L("bes_ins_discipline_key"),
            "typ": "key",
            "required": true,
            "insertonly": true,
            "foreign": {
                "tbl": "bes_v_aanwezigdiscipline",
                "key": "ins_discipline_key",
                "desc": "ins_discipline_omschrijving"
            },
            "LOVinit": "",
            "defaultvalue": null
        },
        "property_key": {
            "dbs": "bes_srtkenmerk_key",
            "label": L("mgt_srtkenmerk_key"),
            "typ": "key",
            "required": true,
            "insertonly": true,
            "foreign": {
                "tbl": "(select bes_srtkenmerk_key"
                     + "      , bes_srtkenmerk_omschrijving"
                     + "   from bes_srtkenmerk"
                     + "  where bes_srtkenmerk_verwijder is null"
                     + "  order by bes_srtkenmerk_omschrijving asc)",
                "key": "bes_srtkenmerk_key",
                "desc": "bes_srtkenmerk_omschrijving"
            },
            "filter": "exact",
            "defaultvalue": null,
            "emptyoption": null,
            "friendlyname": true
        },
        "level": {
            "dbs": "bes_kenmerk_niveau",
            "label": L("mgt_kenmerk_niveau"),
            "typ": "varchar",
            "hidden_fld": true,
            "defaultvalue": "D"
        },
        "order_type": {
            "dbs": "bes_kenmerk_type",
            "label": L("bes_kenmerk_type"),
            "typ": "varchar",
            "hidden_fld": true,
            "defaultvalue": "B"
        },
        "sequence": {
            "dbs": "bes_kenmerk_volgnummer",
            "label": L("mgt_kenmerk_volgnummer"),
            "typ": "number",
            "required": true
        },
        "property_required": {
            "dbs": "bes_kenmerk_verplicht",
            "label": L("mgt_kenmerk_verplicht"),
            "typ": "key",
            "LOV": buildVerplichtingList(),
            "emptyoption": null
        },
        "property_group": {
            "dbs": "bes_kenmerk_groep",
            "label": L("mgt_kenmerk_groep"),
            "typ": "key",
            "required": true,
            "LOV": buildGroepsverplichtingList(),
            "emptyoption": null
        },
        "property_readonly": {
            "dbs": "bes_kenmerk_toonbaar",
            "label": L("mgt_kenmerk_toonbaar"),
            "typ": "check"
        },
        "property_default": {
            "dbs": "bes_kenmerk_default",
            "label": L("mgt_kenmerk_default"),
            "typ": "memo",
            "translate": true
        },
        "property_hint": {
            "dbs": "bes_kenmerk_hint",
            "label": L("mgt_kenmerk_hint"),
            "typ": "memo",
            "translate": true
        },
        "property_regexp": {
            "dbs": "bes_kenmerk_regexp",
            "label": L("mgt_kenmerk_regexp"),
            "typ": "varchar"
        }
    };


    this.REST_GET    = generic_REST_GET(this, {
        "GET": {
            "tables": [
                "bes_srtkenmerk",
                "bes_v_aanwezigdiscipline"
            ],
            "wheres": [
                "bes_kenmerk.bes_kenmerk_type = 'B'",
                "bes_kenmerk.bes_srtkenmerk_key = bes_srtkenmerk.bes_srtkenmerk_key",
                "bes_kenmerk.bes_srtinstallatie_key = bes_v_aanwezigdiscipline.ins_discipline_key"
            ]
        }
    });
    this.REST_POST   = generic_REST_POST(this);
    this.REST_PUT    = generic_REST_PUT(this);
    this.REST_DELETE = generic_REST_DELETE(this, {});
}
%>