<% /*
    $Revision$
    $Id$

    File:           model_mld_afmeldtekst.inc

    Description:    Vanuit CodeCharge gegenereerd model voor mld_afmeldtekst

    Context:

    Notes:
*/
%>
<%

function model_mld_afmeldtekst()
{
    this.records_name = "issueclosingtexts";
    this.record_name = "issueclosingtext";
    this.table = "mld_afmeldtekst";
    this.primary = "mld_afmeldtekst_key";
    this.autfunction = "WEB_MLDMSA";
    this.record_title = L("mld_afmeldtekst");
    this.records_title = L("mld_afmeldtekst_m");


    this.fields = {
        "id": {
            "dbs": "mld_afmeldtekst_key",
            "label": L("lcl_key"),
            "typ": "key",
            "seq": "mld_s_mld_afmeldtekst_key"
        },
        "name": {
            "dbs": "mld_afmeldtekst_naam",
            "label": L("mld_afmeldtekst_naam"),
            "filter": "like",
            "typ": "varchar",
            "translate": true
        },
        "description": {
            "dbs": "mld_afmeldtekst_omschrijving",
            "label": L("mld_afmeldtekst_omschrijving"),
            "filter": "like",
            "typ": "memo",
            "translate": true
        },
        "issuediscipline": {
            "dbs": "mld_ins_discipline_key",
            "label": L("mld_ins_discipline_key"),
            "typ": "key",
            "foreign": "MLD_DISCIPLINE",
            "onChange": "disc_onchange",
            "module": "MLDAP",
            "showtransit": true
        },
        "issuetype": {
            "dbs": "mld_stdmelding_key",
            "label": L("mld_stdmelding_key"),
            "typ": "key",
            "foreign": "MLD_STDMELDING",
            "urlAdd": [{ urlParam: "disc_key", field: "issuediscipline" }],
            "onChange": "stdm_onchange",
            "showtransit": true
        },
        "usefor": {
            "dbs": "mld_afmeldtekst_usefor",
            "label": L("mld_afmeldtekst_usefor"),
            "typ": "number",
                "bits": [
                {
                    "name": "",
                    "label": "",
                    "typ": "check",
                    "mask": 31,
                    "radios": [
                        {
                            "name": "forclose",
                            "label": L("mld_afmeldtekst_usefor_close"),
                            "mask": 1,
                            "defaultvalue": 0
                        },
                        {
                            "name": "forreject",
                            "label": L("mld_afmeldtekst_usefor_reject"),
                            "mask": 2,
                            "defaultvalue": 0
                        },
                        {
                            "name": "fororder",
                            "label": L("mld_afmeldtekst_usefor_order"),
                            "mask": 4,
                            "defaultvalue": 0
                        },
                        {
                            "name": "forresponse",
                            "label": L("mld_afmeldtekst_usefor_response"),
                            "mask": 8,
                            "defaultvalue": 0
                        },
                        {
                            "name": "forresorder",
                            "label": L("mld_afmeldtekst_usefor_resorder"),
                            "mask": 16,
                            "defaultvalue": 0
                        }
                    ]
                }
            ],
            "defaultvalue": 1,
            "required": true
        },
        "useforclose": {
            "dbs": "useformode.forclose",
            "label": L("mld_afmeldtekst_usefor_close"),
            "typ": "check0",
            "hidden_fld": true
        },
        "useforreject": {
            "dbs": "useformode.forreject",
            "label": L("mld_afmeldtekst_usefor_reject"),
            "typ": "check0",
            "hidden_fld": true
        },
        "usefororder": {
            "dbs": "useformode.fororder",
            "label": L("mld_afmeldtekst_usefor_order"),
            "typ": "check0",
            "hidden_fld": true
        },
        "useforresponse": {
            "dbs": "useformode.forresponse",
            "label": L("mld_afmeldtekst_usefor_response"),
            "typ": "check0",
            "hidden_fld": true
        },
        "useforresorder": {
            "dbs": "useformode.forresorder",
            "label": L("mld_afmeldtekst_usefor_resorder"),
            "typ": "check0",
            "hidden_fld": true
        }

    };

    var ext_sql = "(SELECT mld_afmeldtekst_key"
                + "      , DECODE(BITAND(mld_afmeldtekst_usefor,  1),  1, 1, '') forclose"
                + "      , DECODE(BITAND(mld_afmeldtekst_usefor,  2),  2, 1, '') forreject"
                + "      , DECODE(BITAND(mld_afmeldtekst_usefor,  4),  4, 1, '') fororder"
                + "      , DECODE(BITAND(mld_afmeldtekst_usefor,  8),  8, 1, '') forresponse"
                + "      , DECODE(BITAND(mld_afmeldtekst_usefor,  16), 16, 1, '') forresorder"
                + "   FROM mld_afmeldtekst"
                + ") useformode ";
    var get_param = {
            "GET": {
                "tables": [ext_sql],
                "wheres": ["mld_afmeldtekst.mld_afmeldtekst_key = useformode.mld_afmeldtekst_key"]
            }
        };

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