<% /*
    $Revision$
    $Id$

    File:           model_alg_srtruimte.inc

    Description:    Model voor alg_srtruimte

    Context:

    Notes:
*/
%>
<%
function model_alg_srtruimte()
{
    this.records_name = "roomfunctions";
    this.record_name = "roomfunction";
    this.table = "alg_srtruimte";
    this.primary = "alg_srtruimte_key";
    this.soft_delete = "alg_srtruimte_verwijder";
    this.autfunction = "WEB_ALGMSU";
    this.record_title = L("lcl_alg_srtruimte_details");
    this.records_title = L("alg_srtruimte_tbl_m");

    this.fields = {
        "id": {
            "dbs": "alg_srtruimte_key",
            "label": L("lcl_key"),
            "typ": "key",
            "required": true,
            "seq": "alg_s_alg_srtruimte_key"
        },
        "name": {
            "dbs": "alg_srtruimte_omschrijving",
            "label": L("lcl_descr"),
            "typ": "varchar",
            "required": true,
            "translate": true
        },
        "rate": {
            "dbs": "alg_srtruimte_prijs",
            "label": L("lcl_alg_alg_tarief") +" (m2)",
            "typ": "float"
        },
        "ratea": {
            "dbs": "alg_srtruimte_prijs2",
            "label": L("lcl_alg_alg_tariefA")+" (m2)",
            "typ": "float"
        },
        "rateb": {
            "dbs": "alg_srtruimte_prijs3",
            "label": L("lcl_alg_alg_tariefB")+" (m2)",
            "typ": "float"
        },
        "ratec": {
            "dbs": "alg_srtruimte_prijs4",
            "label": L("lcl_alg_alg_tariefC")+" (m2)",
            "typ": "float"
        },
        "rated": {
            "dbs": "alg_srtruimte_prijs5",
            "label": L("lcl_alg_alg_tariefD")+" (m2)",
            "typ": "float"
        },
        "code": {
            "dbs": "alg_srtruimte_code",
            "label": L("lcl_alg_srtruimte_code"),
            "typ": "varchar"
        },
        "hasworkplace": {
            "dbs": "prs_bevat_werkplek",
            "label": L("lcl_prs_has_workplace"),
            "typ": "check"
        },
        "rentable": {
            "dbs": "prs_verhuurbaar",
            "label": L("lcl_prs_rentable"),
            "typ": "check",
            "defaultvalue": 1
        },
        "processingtime": {
            "dbs": "alg_srtruimte_t_uitvoertijd",
            "label": L("lcl_mld_stduitvoertijd"),
            "obj": "MLD_T_UITVOERTIJD",
            "typ": "processingtime"
        },
        "criticaltime": {
            "dbs": "alg_srtruimte_t_uitvoer_pr1",
            "obj": "MLD_T_UITVOERTIJD",
            "typ": "processingtime",
            "label": L("lcl_mld_uitvoertijd_kritisch"),
            "multiedit": true
        },
        "highprioritytime": {
            "dbs": "alg_srtruimte_t_uitvoer_pr2",
            "obj": "MLD_T_UITVOERTIJD",
            "typ": "processingtime",
            "label": L("lcl_mld_uitvoertijd_hoog"),
            "multiedit": true
        },
        "lowprioritytime": {
            "dbs": "alg_srtruimte_t_uitvoer_pr4",
            "obj": "MLD_T_UITVOERTIJD",
            "typ": "processingtime",
            "label": L("lcl_mld_uitvoertijd_laag"),
            "multiedit": true
        }
    };

    this.hook_pre_post = function(params, obj)
    {
        // Constraint alg_c_werkplek_verhuurbaar dwingt af dat bij werkplek verhuurbaar altijd 1 is.
        // Verhuurbaar is dan echter disabled en levert geen waarde, dus hier alsnog zetten.
        if (obj.hasworkplace == 1)
            obj.rentable = 1;
    }

    this.hook_pre_put = function(params, obj, key)
    {
        // Constraint alg_c_werkplek_verhuurbaar dwingt af dat bij werkplek verhuurbaar altijd 1 is.
        // Verhuurbaar is dan echter disabled en levert geen waarde, dus hier alsnog zetten.
        if (obj.hasworkplace == 1)
            obj.rentable = 1;
    }

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