<% /*
    $Revision$
    $Id$

    File:           model_ctr_discipline.inc

    Description:    Model voor srtcontrole disciplines

    Context:

    Notes:          intern hebben we een apart model voor ctr_disc_params
                    Naar de buitenwereld presenteren we het als één model
*/
%>
<!-- #include file="model_ctr_disc_params.inc" -->
<%

function model_ctr_discipline(disc_key, params)
{
    // Eén model voor de buitenwereld
    var disc = new _model_ctr_discipline();
    api2.merge_disc_params_model(this, disc);

    this.REST_GET    = generic_REST_GET(disc,  // Let op: de originele _model
                                           { "GET": {
                                                     wheres: [ "ins_tab_discipline.ins_discipline_module = 'CTR'"
                                                             ]
                                                    }
                                            }
                                      )

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

function _model_ctr_discipline()
{
  this.table = "ins_tab_discipline";
  this.primary = "ins_discipline_key";
  this.records_name = "ins_tab_disciplines";
  this.record_name = "ins_tab_discipline";
  this.autfunction = "WEB_CTRMGT";
  this.record_title = L("ctr_discipline");
  this.records_title = L("ctr_discipline_m");

    this.fields = {
        "id": {
            "dbs": "ins_discipline_key",
            "label": "Key",
            "typ": "key",
            "required": true,
            "filter": "exact",
            "seq": "ins_s_ins_discipline_key"
        },
        "module": {
            "dbs": "ins_discipline_module",
            "label": L("ctr_discipline_module"),
            "typ": "varchar",
            "hidden_fld": true,
            "defaultvalue": "CTR"
        },
        "name": {
            "dbs": "ins_discipline_omschrijving",
            "label": L("ctr_discipline_omschrijving"),
            "typ": "varchar",
            "translate": true,
            "required": true
        }
    };
    /* Velden van CTR_DISC_PARAMS komen er dynamisch bij */
    this.disc_params = {
        model: model_ctr_disc_params,
        joinfield: "ctr_ins_discipline_key"
    };
    this.soft_delete = "ins_discipline_verwijder";
}
%>