<% /*
    $Revision$
    $Id$

    File:           model_mld_discipline_discipline.inc

    Description:    Kruistabel voor vakgroepen

    Context:

    Notes:
*/
%>
<%
function model_mld_discipline_discipline()
{
    this.records_name = "issuediscdisciplines";
    this.record_name = "issuediscdiscipline";
    this.table = "mld_discipline_discipline";
    this.primary = "mld_discipline_discipline_key";
    this.autfunction = "WEB_MLDMGT";
    this.record_title = L("mld_discipline_discipline");
    this.records_title = L("mld_discipline_discipline_m");

    this.fields = {
        "id": {
            "dbs": "mld_discipline_discipline_key",
            "label": L("lcl_key"),
            "typ": "key",
            "required": true,
            "seq": "mld_s_mld_disc_disc_key"
        },
        "discipline1": {
            "dbs": "mld_discipline_key1",
            "label": L("lcl_mld_vakgroep"),
            "typ": "key",
            "required": true,
            "insertonly": true,
            "foreign": {
                "tbl": "(SELECT ins_discipline_key, ins_discipline_omschrijving"
                     + "  FROM ins_srtdiscipline isd, ins_tab_discipline td, mld_disc_params dp"
                     + " WHERE isd.ins_srtdiscipline_key = td.ins_srtdiscipline_key"
                     + "   AND td.ins_discipline_key = dp.mld_ins_discipline_key"
                     + "   AND BITAND(dp.mld_disc_params_srtgroep, 5) = 5)", // 1+4 primair+kan behandelen
                "key": "ins_discipline_key",
                "desc": "ins_discipline_omschrijving"
            },
            "uniquewith": "discipline2"
        },
        "discipline2": {
            "dbs": "mld_discipline_key2",
            "label": L("mld_processing_group"),
            "typ": "key",
            "required": true,
            "insertonly": true,
            "foreign": {
                "tbl": "(SELECT ins_discipline_key, ins_discipline_omschrijving"
                     + "  FROM ins_srtdiscipline isd, ins_tab_discipline td, mld_disc_params dp"
                     + " WHERE isd.ins_srtdiscipline_key = td.ins_srtdiscipline_key"
                     + "   AND td.ins_discipline_key = dp.mld_ins_discipline_key"
                     + "   AND BITAND(mld_disc_params_srtgroep, 2) = 2)",
                "key": "ins_discipline_key",
                "desc": "ins_discipline_omschrijving",
                "multiselect": true
            },
            "uniquewith": "discipline1"
        }
    };

    this.list = {
            "columns": [
                "id",
                "discipline1",
                "discipline2"
            ],
            "orderby": [
                "discipline1",
                "discipline2"
            ]
        };

    this.edit = {
        modal: true
    };

    this.REST_GET    = generic_REST_GET(this);
    this.REST_POST   = generic_REST_POST(this);
    this.REST_PUT    = generic_REST_PUT(this);
    this.REST_DELETE = generic_REST_DELETE(this);
}
%>