<% /*
    $Revision$
    $Id$

    File:           model_fac_importapp.inc

    Description:    Vanuit CodeCharge gegenereerd model voor fac_import_app

    Context:

    Notes:
*/
%>
<%

function model_fac_import_app()
{
    this.table = "fac_import_app";
    this.primary = "fac_import_app_key";
    this.records_name = "fac_import_apps";
    this.record_name = "fac_import_app";
    this.autfunction = "WEB_PRSSYS"; //"WEB_BESMGT";
    this.record_title = L("fac_import_app");
    this.records_title = L("fac_import_app_m");


    this.fields = {
        "id": {
            "dbs": "fac_import_app_key",
            "label": "Key",
            "typ": "key",
            "required": true,
            "filter": "exact",
            "seq": "fac_s_fac_import_app_key"
        },
        "name": {
            "dbs": "fac_import_app_oms",
            "label": L("fac_import_app_oms"),
            "typ": "varchar",
            "hidden_fld": true,
            "defaultvalue": "Catalogus"
        },
        "xsl": {
            "dbs": "fac_import_app_xsl",
            "label": L("fac_import_app_xsl"),
            "typ": "varchar"
        },
        "authorization": {
            "dbs": "fac_functie_key",
            "label": L("fac_functie_key"),
            "typ": "key",
            "foreign": "fac_functie",
            "filter": "exact"
        },
        "catalog": {
            "dbs": "ins_discipline_key",
            "label": L("fac_ins_discipline_key"),
            "typ": "key",
            "foreign": {
                "tbl": "(SELECT ins_discipline_key"
                     + "      , ins_discipline_omschrijving"
                     + "   FROM bes_v_aanwezigdiscipline)",
                "key": "ins_discipline_key",
                "desc": "ins_discipline_omschrijving"
            },
            "filter": "exact"
        },
        "code": {
            "dbs": "fac_import_app_code",
            "label": L("fac_import_app_code"),
            "typ": "varchar",
            "hidden_fld": true,
            "defaultvalue": "CATALOGUS"
        },
        "company": {
            "dbs": "prs_bedrijf_key",
            "label": L("prs_bedrijf_key"),
            "typ": "key",
            "foreign": {
                "tbl": "(SELECT prs_bedrijf_key"
                     + "      , prs_bedrijf_naam"
                     + "   FROM prs_bedrijf"
                     + "  WHERE prs_bedrijf_leverancier = 1"
                     + "    AND prs_bedrijf_verwijder IS NULL"
                     + "  ORDER BY prs_bedrijf_naam)",
                "key": "prs_bedrijf_key",
                "desc": "prs_bedrijf_naam"
            },
            "filter": "exact"
        },
        "charset": {
            "dbs": "fac_import_app_charset",
            "label": L("fac_import_app_charset"),
            "typ": "varchar"
        },
        "folder": {
            "dbs": "fac_import_app_folder",
            "label": L("fac_import_app_folder"),
            "typ": "varchar"
        },
        "files": {
            "dbs": "fac_import_app_files",
            "label": L("fac_import_app_files"),
            "typ": "varchar"
        },
        "prefix": {
            "dbs": "fac_import_app_prefix",
            "label": L("fac_import_app_prefix"),
            "typ": "varchar"
        },
        "action": {
            "dbs": "fac_import_app_action",
            "label": L("fac_import_app_action"),
            "typ": "varchar"
        }
    };


    this.REST_GET    = generic_REST_GET(this,
                                           { "GET": {
                                               wheres: [ "fac_import_app_code='CATALOGUS'",
                                                         "NOT (ins_discipline_key IS NULL AND prs_bedrijf_key IS NULL)"
                                                       ]
                                               }
                                           }
                                       );
    this.REST_POST   = generic_REST_POST(this);
    this.REST_PUT    = generic_REST_PUT(this);
    this.REST_DELETE = generic_REST_DELETE(this, {});
}
%>