<% /*
    $Revision$
    $Id$

    File:           model_cht_discipline.inc

    Description:    disciplines voor de chat functie

    Context:

    Notes:          Nu nog geen cht_disc_params.
                    Als de tabel cht_disc_params wordt toegevoegd moet in scafflding_show
                    '&& module != "cht"' in de regel 'if (module != "mrk" && module != "cht")'
                    verwijderd worden.
                    Dan moet model_cht_discipline() ook aangepast worden zodat de disc_params
                    met ins_tab_discipline wordt gejoind en er als het ware 1 tabel van maakt.

*/
%>
<%
function model_cht_discipline(disc_key, params)
{
    this.records_name = "chatdisciplines";
    this.record_name = "chatdiscipline"
    this.table = "ins_tab_discipline";
    this.audit = { "childtable": "ins_disc_params" }, // Parameters voor fac_audit.
    this.primary = "ins_discipline_key";
    this.soft_delete = "ins_discipline_verwijder";
    this.autfunction = "WEB_PRSSYS";

    this.record_title = L("cht_discipline");
    this.records_title = L("cht_discipline_m");

    this.fields = {
        "id": {
            "dbs": "ins_discipline_key",
            "label": L("lcl_key"),
            "typ": "key",
            "required": true,
            "seq": "ins_s_ins_discipline_key"
        },
        "module": {
            "dbs": "ins_discipline_module",
            "label": L("ins_discipline_module"),
            "typ": "varchar",
            "required": true,
            "defaultvalue": "CHT",
            "hidden_fld": true
        },
        "name": {
            "dbs": "ins_discipline_omschrijving",
            "label": L("ins_discipline_omschrijving"),
            "typ": "varchar",
            "filter": "like",
            "translate": true,
            "required": true
        },
        "sequence": {
            "dbs": "ins_discipline_volgnr",
            "label": L("ins_discipline_volgnr"),
            "typ": "number"
        },
/*
        "costtype": {
            "dbs": "prs_kostensoort_key",
            "label": L("prs_kostensoort_key"),
            "typ": "key",
            "foreign": "prs_kostensoort",
            "multiedit": true,
            "showtransit": true
        },
        "costcentremandatory": {
            "dbs": "ins_discipline_kpnverplicht",
            "label": L("ins_discipline_kpnverplicht"),
            "typ": "check0",
            "multiedit": true
        },
        "email": {
            "dbs": "ins_discipline_email",
            "label": L("ins_discipline_email"),
            "typ": "varchar",
            "multiedit": true
        },
        "satisfactionpercentage": {
            "dbs": "ins_discipline_ktopercentage",
            "label": L("ins_discipline_ktopercentage"),
            "typ": "number",
            "multiedit": true
        },
        "satisfactionthreshold": {
            "dbs": "ins_discipline_ktodrempel",
            "label": L("ins_discipline_ktodrempel"),
            "typ": "number",
            "multiedit": true
        },
        "symbolname": {
            "dbs": "ins_discipline_image",
            "typ": "icon",
            "module": "CHTD",
            "label": L("lcl_res_symbol_name")
        }
*/
        "externnr": {
            "dbs": "ins_discipline_externnr",
            "typ": "varchar",
            "label": L("extern_nr")
        },
        "externsyncdate": {
            "dbs": "ins_discipline_externsyncdate",
            "typ": "datetime",
            "label": L("extern_syncdate"),
            "readonly": !(user.has("WEB_FACTAB") || user.has("WEB_FACXNR"))
        }
    };
    this.REST_GET    = generic_REST_GET(this,
                                           { "GET": {
                                                     wheres: [ "ins_tab_discipline.ins_discipline_module = 'CHT'"
                                                             ]
                                                    }
                                           }
                                       )

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