<% /*
    $Revision$
    $Id$

    File:           model_mld_stdmsrtterreinsector.inc

    Description:    Model voor mld_stdmsrtterreinsector

    Context:

    Notes:
*/
%>
<%
function model_mld_stdmsrtterreinsector()
{
    this.records_name = "terfunctionsoverrule";
    this.record_name = "terfunctionoverrule";
    this.table = "mld_stdmsrtterrein";
    this.primary = "mld_stdmsrtterrein_key";
    this.autfunction = "WEB_ALGMSU";
    this.record_title = L("lcl_mld_overrule");
    this.records_title = L("lcl_mld_overrule_properties");

    this.fields = {
        "id": {
            "dbs": "mld_stdmsrtterrein_key",
            "label": L("lcl_key"),
            "typ": "key",
            "required": true,
            "seq": "mld_s_mld_stdmsrtterrein_key"
        }
    };
    var terrainfunction = {
        "dbs": "alg_srtterreinsector_key",
        "label": L("lcl_estate_terrein_man_sort"),
        "typ": "varchar",
        "hidden_fld": hasQParam("terrainfunction"),
        "showtransit": true,
        "required": true,
        "foreign": "alg_srtterreinsector",
        "multiedit": true
    };
    var stdmelding = {
        "dbs": "mld_stdmelding_key",
        "label": L("mld_stdmelding_key"),
        "typ": "key",
        "required": true,
        "foreign": "mld_stdmelding",
        "hidden_fld": hasQParam("stdmelding"),
        "showtransit": true
    };

    // Voor de volgordelijkheid;
    if (hasQParam("terrainfunction")) {
        this.fields.terrainfunction = terrainfunction;
        this.fields.stdmelding = stdmelding;
    } else {
        this.fields.stdmelding = stdmelding;
        this.fields.terrainfunction = terrainfunction;
    }

    var fields = { // Komt strak in this.fields
        "periodmalus": {
            "dbs": "mld_stdmsrtterrein_malus",
            "typ": "float",
            "label": L("lcl_mld_malus"),
            "multiedit": true
        },
        "fixedmalus": {
            "dbs": "mld_stdmsrtterrein_malusbasis",
            "typ": "float",
            "label": L("lcl_mld_malusbasis"),
            "multiedit": true
        },
        "maximummalus": {
            "dbs": "mld_stdmsrtterrein_malusmax",
            "typ": "float",
            "label": L("lcl_mld_malusmax"),
            "multiedit": true
        },
        "regime": {
            "dbs": "mld_stdmsrtterrein_regime",
            "typ": "key",
            "label": L("lcl_mld_regime"),
            "LOV": "1;" + L("lcl_mld_office_hours")  + ";"
                 + "2;" + L("lcl_mld_opening_hours") + ";"
                 + "3;" + L("lcl_mld_24_7"),
            "emptyoption": null,
            "multiedit": true
        },
        "accepttime": {
            "dbs": "mld_stdmsrtterrein_t_acctijd",
            "obj": "mld_t_uitvoertijd",
            "typ": "processingtime",
            "label": L("lcl_mld_timetoaccept"),
            "multiedit": true
        },
        "processingtime": {
            "dbs": "mld_stdmsrtterrein_t_uitvtijd",
            "obj": "mld_t_uitvoertijd",
            "typ": "processingtime",
            "label": L("lcl_mld_uitvoertijd"),
            "multiedit": true
        },
        "criticalaccept": {
            "dbs": "mld_stdmsrtterrein_t_acc_pr1",
            "obj": "MLD_T_UITVOERTIJD",
            "typ": "processingtime",
            "label": L("lcl_mld_timetoaccept_kritisch"),
            "multiedit": true
        },
        "criticaltime": {
            "dbs": "mld_stdmsrtterrein_t_uitv_pr1",
            "obj": "MLD_T_UITVOERTIJD",
            "typ": "processingtime",
            "label": L("lcl_mld_uitvoertijd_kritisch"),
            "multiedit": true
        },
        "highpriorityaccept": {
            "dbs": "mld_stdmsrtterrein_t_acc_pr2",
            "obj": "MLD_T_UITVOERTIJD",
            "typ": "processingtime",
            "label": L("lcl_mld_timetoaccept_hoog"),
            "multiedit": true
        },
        "highprioritytime": {
            "dbs": "mld_stdmsrtterrein_t_uitv_pr2",
            "obj": "MLD_T_UITVOERTIJD",
            "typ": "processingtime",
            "label": L("lcl_mld_uitvoertijd_hoog"),
            "multiedit": true
        },
        "lowpriorityaccept": {
            "dbs": "mld_stdmsrtterrein_t_acc_pr4",
            "obj": "MLD_T_UITVOERTIJD",
            "typ": "processingtime",
            "label": L("lcl_mld_timetoaccept_laag"),
            "multiedit": true
        },
        "lowprioritytime": {
            "dbs": "mld_stdmsrtterrein_t_uitv_pr4",
            "obj": "MLD_T_UITVOERTIJD",
            "typ": "processingtime",
            "label": L("lcl_mld_uitvoertijd_laag"),
            "multiedit": true
        }
    };

    // Merge fields -> this.fields
    for (fld in fields) {
        if (fields.hasOwnProperty(fld)) {
            this.fields[fld] = fields[fld];
        }
    }

    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);
}
%>