<% /*
    $Revision$
    $Id$

    File:           model_ins_srtkenmerk.inc

    Description:    Vanuit CodeCharge gegenereerd model voor ins_srtkenmerk

    Context:

    Notes:
*/
%>
<%

function model_ins_srtkenmerk(params)
{
    params = params || {};
    this.records_name = "objectpropertytypes";
    this.record_name = "objectpropertytype";
    this.table = "ins_srtkenmerk";
    this.primary = "ins_srtkenmerk_key";
    this.soft_delete = "ins_srtkenmerk_verwijder";
    this.autfunction = params.internal?false:"WEB_INSMGT";
    this.record_title = L("ins_srtkenmerk");
    this.records_title = L("ins_srtkenmerk_m");


    this.fields = {
        "id": {
            "dbs": "ins_srtkenmerk_key",
            "label": L("lcl_key"),
            "typ": "key",
            "required": true,
            "seq": "ins_s_ins_srtkenmerk_key"
        },
        "name": {
            "dbs": "ins_srtkenmerk_omschrijving",
            "label": L("mgt_srtkenmerk_omschrijving"),
            "typ": "varchar",
            "required": true,
            "translate": true,
            "filter": "like"
        },
        "attributetype": {
            "dbs": "ins_srtkenmerk_kenmerktype",
            "label": L("mgt_srtkenmerk_kenmerktype"),
            "typ": "varchar",
            "required": true,
            "LOV": buildKenmerktypeLOV(),
            "showtransit": true,
            "multiedit": true
        },
        "unit": {
            "dbs": "ins_srtkenmerk_dimensie",
            "label": L("mgt_srtkenmerk_dimensie"),
            "typ": "varchar",
            "translate": true,
            "multiedit": true
        },
        "system": {
            "dbs": "ins_srtkenmerk_systeem",
            "label": L("mgt_srtkenmerk_systeem"),
            "typ": "check0"
        },
        "length": {
            "dbs": "ins_srtkenmerk_lengte",
            "label": L("mgt_srtkenmerk_lengte"),
            "typ": "number",
            "multiedit": true
        },
        "decimals": {
            "dbs": "ins_srtkenmerk_dec",
            "label": L("mgt_srtkenmerk_dec"),
            "typ": "number",
            "multiedit": true
        },
        "minimum": {
            "dbs": "ins_srtkenmerk_nmin",
            "label": L("mgt_srtkenmerk_nmin"),
            "typ": "number",
            "multiedit": true
        },
        "maximum": {
            "dbs": "ins_srtkenmerk_nmax",
            "label": L("mgt_srtkenmerk_nmax"),
            "typ": "number",
            "multiedit": true
        },
        "domain": {
            "dbs": "fac_kenmerkdomein_key",
            "label": L("mgt_kenmerkdomein_key"),
            "typ": "key",
            "foreign": fac_kenmerkdomein_foreign("INS"),
            "LOVinit": ""
        },
        "code": {
            "dbs": "ins_srtkenmerk_code",
            "typ": "varchar",
            "label": L("mgt_srtkenmerk_code"),
            "readonly": !user.has("WEB_PRSSYS")
        }
    };


    this.hook_pre_edit = function (obj, fld)
    {
        var kenmerktype = (obj.attributetype ? obj.attributetype.id : "");
        fld.attributetype.LOV = buildKenmerktypeLOV(kenmerktype);
    %>
    <script type="text/javascript">
      var module = "INS";
      var property_type = "<%=safe.jsstring(kenmerktype)%>";
    </script>
    <%
    }

    this.hook_pre_multi_edit = function (obj, fld, params)
    {
        var id_arr = getQParamIntArray("sel_id", []);
        var multiCount = modelHasMultiedit(fld);
        if (multiCount == 0)
            abort_with_warning(L("mgt_srtkenmerk_nomulti"));
    }


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