<% /*
    $Revision$
    $Id$

    File:           model_fac_profielwaarde.inc

    Description:    Vanuit CodeCharge gegenereerd model voor fac_profielwaarde

    Context:

    Notes:
*/
%>
<%

function model_fac_profielwaarde()
{
    this.table = "fac_profielwaarde";
    this.primary = "fac_profielwaarde_key";
    this.records_name = "fac_profielwaardes";
    this.record_name = "fac_profielwaarde";
    this.autfunction = "WEB_FINMSU";
    this.record_title = L("fac_profielwaarde");
    this.records_title = L("fac_profielwaarde_m");

    var catalogus_sql = "SELECT B.ins_discipline_key"
                      + "     , B.ins_discipline_omschrijving  as omschrijving"
                      + "     , ''                             as prefix"
                      + "     , " + safe.qL("lcl_bes_Catalogus") + "||': '||  B.ins_discipline_omschrijving  as omschrijving_ext"
                      + "  FROM bes_v_aanwezigdiscipline B"
                      + " UNION ALL "
                      + "SELECT M.ins_discipline_key"
                      + "     , M.ins_discipline_omschrijving"
                      + "     , S.ins_srtdiscipline_prefix"
                      + "     , " + safe.qL("lcl_mld_vakgroep") + "||': '|| S.ins_srtdiscipline_prefix ||'-'|| M.ins_discipline_omschrijving"
                      + "  FROM mld_v_aanwezigdiscipline M"
                      + "     , ins_srtdiscipline        S"
                      + " WHERE M.ins_srtdiscipline_key = S.ins_srtdiscipline_key";

    this.fields = {
        "id": {
            "dbs": "fac_profielwaarde_key",
            "label": "Key",
            "typ": "key",
            "required": true,
            "filter": "exact",
            "seq": "fac_s_fac_profielwaarde_key"
        },
        "profile": {
            "dbs": "fac_profiel_key",
            "label": L("fac_profiel"),
            "typ": "key",
            "required": true,
            "foreign": {
                "tbl": "fac_profiel",
                "key": "fac_profiel_key",
                "desc": "fac_profiel_omschrijving"
            }
        },
        "prefix": {
            "dbs": "catalogus.prefix",
            "label": L("ins_discipline_prefix"),
            "typ": "varchar",
            "readonly": true
        },
        "catalog": {
            "dbs": "ins_discipline_key",
            "label": L("mgt_discipline"),
            "typ": "key",
            "required": true,
            "foreign": {
                "tbl": "("+ catalogus_sql + ")",
                "key": "ins_discipline_key",
                "desc": "omschrijving_ext"
            },
            "friendlyname": true
        },
        "value_limit": {
            "dbs": "fac_profielwaarde_limiet",
            "label": L("fac_profielwaarde_limiet"),
            "typ": "number",
            "required": true
        }
    };



    this.list = {
        "columns": [
            "id",
            "prefix",
            "catalog",
            "value_limit"
        ]
    };
    this.search = {
        "autosearch": true
    };
    this.edit = {
        "modal": true
    };

    var ext_sql = "("+catalogus_sql+") catalogus"
    this.REST_GET    = generic_REST_GET(this, {
        "GET": {
            "tables": [ ext_sql],
            "wheres": [ "fac_profielwaarde.ins_discipline_key = catalogus.ins_discipline_key"]
        }
    });
    this.REST_POST   = generic_REST_POST(this);
    this.REST_PUT    = generic_REST_PUT(this);
    this.REST_DELETE = generic_REST_DELETE(this);
}
%>