<% /*
    $Revision$
    $Id$

    File:           model_aut_idp_map.inc
    Description:
    Notes:
*/

function model_aut_idp_map(params)
{
    params = params || {};
    this.records_name = "idpmappings";
    this.record_name = "idpmapping";
    this.table = "aut_idp_map";
    this.primary = "aut_idp_map_key";
    this.autfunction = params.internal?false:"WEB_FACTAB";
    this.record_title = L("aut_idp_map");
    this.records_title = L("aut_idp_map_m");
    this.defaultIcon = "fa-code-branch fa-rotate-270";

    this.fields = {
        "id": {
            "dbs": "aut_idp_map_key",
            "label": L("lcl_key"),
            "typ": "key",
            "seq": "aut_s_aut_idp_map_key"
        },
        "identityprovider": {
            "dbs": "aut_idp_key",
            "label": L("aut_idp"),
            "typ": "key",
            "hidden_fld": true,
            "required": true
        },
        "identify": {
            "dbs": "aut_idp_map_identify",
            "label": L("aut_idp_map_identify"),
            "typ": "number",
            "defaultvalue": 0,
            "required": true,
            "LOV": "0;" + L("lcl_No")
                 + ";1;" + L("lcl_Yes")
                 + ";3;" + L("lcl_Yes") + ", case insensitive"
        },
        "name": { // Wel een beetje afwijkend, een name veld die een LOV is....
            "dbs": "aut_idp_map_to",
            "label": L("aut_idp_map_to"),
            "typ": "key",
            "required": true,
            "LOV":  "1;" + L("lcl_prs_person_login")
                 + ";2;" + L("lcl_prs_person_achternaam")
                 + ";3;" + L("lcl_prs_person_voornaam")
                 + ";4;" + L("lcl_prs_person_tussen")
                 + ";5;" + L("lcl_prs_person_initials")
                 + ";6;" + L("lcl_prs_person_geslacht")
                 + ";7;" + L("lcl_prs_person_phone")
                 + ";8;" + L("lcl_prs_person_title")
                 + ";9;" + L("lcl_prs_person_email")
                 + ";10;" + L("lcl_prs_person_phone")
                 + ";11;" + L("lcl_prs_person_mobile")
                 + ";12;" + L("prs_perslid_externid")
                 + ";13;" + L("prs_perslid_externid") + " (case insensitive)"
                 + ";14;" + L("lcl_prs_person_nr")

                 // De foreign's
                 + ";20;" + L("lcl_prs_person_function")
                 + ";21;" + L("lcl_prs_organisatie")
                 + ";22;" + L("lcl_prs_profile")
                 //+ kostenplaats ondersteunen we niet, dat is in FACILITOR een organisatie of mandatering

                 + ";99;prs_perslid_key" // gereserveerd voor intern gebruik

                 // De 1-n
                 + ";100;*" + L("fac_groep_m")
                 + ";101;*" + L("lcl_workplace")
                 //+ ";102;*" + L("lcl_workplace") + " " + L("lcl_estate_wp_virt") // gaan via @prefix
                 //+ ";103;*" + L("lcl_prs_mandatering") reserved voor mandatering
                 // 1000 + kenmerk_key komt hier nog achter
        },
        "from": {
            "dbs": "aut_idp_map_from",
            "label": L("aut_idp_map_from"),
            "typ": "varchar",
            "required": true
        },
        "default": {
            "dbs": "aut_idp_map_default",
            "label": L("aut_idp_map_default"),
            "typ": "varchar"
        }
    }
    // Flexkenmerken er ook bij
    var sql = "SELECT *"
            + "  FROM prs_kenmerk"
            + " WHERE prs_kenmerk_niveau = 'P'"
             + "  AND prs_kenmerk_verwijder IS NULL"
            + " ORDER BY prs_kenmerk_volgnr";
    var oRs = Oracle.Execute(sql);
    while (!oRs.Eof)
    {
        this.fields.name.LOV += ";" + String(1000 + oRs("prs_kenmerk_key").Value + ";" + L("mgt_kenmerk") + " " + oRs("prs_kenmerk_omschrijving").Value);
        oRs.MoveNext();
    }
    oRs.Close();

    this.edit = {
        "modal": true
    };

    this.list = {
        "columns": ["identify", "name", "from", "default"]
    };

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