<% /*
    $Revision$
    $Id$

    File:           model_fac_export_app.inc

    Description:    Vanuit CodeCharge gegenereerd model voor fac_export_app

    Context:

    Notes:
*/
%>
<%

function model_fac_export_app()
{
    this.records_name = "exportfunctions";
    this.record_name = "exportfunction";
    this.table = "fac_export_app";
    this.primary = "fac_export_app_key";
    this.autfunction = "WEB_FACTAB";
    this.record_title = L("fac_export_app");
    this.records_title = L("fac_export_app_m");

    var obj_info = function (type, obj)
        {
            var namesql = "COALESCE(UPPER(fac_export_app_prefix), {0}) || {1} || UPPER(fac_export_app_code)".format(safe.quoted_sql(customerId), safe.quoted_sql(obj.toUpperCase()));
            var sql = "{0} || ' ' || {1}".format(safe.quoted_sql(type), namesql)
                    + " || ' (' || COALESCE((SELECT 'Created: ' || TO_CHAR(CREATED, 'YYYY-MM-DD HH24:MI') || ', Updated: ' || TO_CHAR(LAST_DDL_TIME, 'YYYY-MM-DD HH24:MI')"
                    + "                        FROM USER_OBJECTS"
                    + "                       WHERE OBJECT_NAME = {0} AND OBJECT_TYPE = {1}), 'Not found') || ')'".format(namesql, safe.quoted_sql(type));
            return sql;
        }

    this.fields = {
        "id": {
            "dbs": "fac_export_app_key",
            "label": L("lcl_key"),
            "typ": "key",
            "required": true,
            "seq": "fac_s_fac_export_app_key"
        },
        "name": {
            "dbs": "fac_export_app_code",
            "label": L("fac_export_app_code"),
            "typ": "varchar",
            "translate": true
        },
        "preproc": {
            "dbs": "preproc",
            "label": "",
            "sql": obj_info("PROCEDURE", "_SELECT_"),
            "typ": "varchar"
        },
        "expview": {
            "dbs": "expview",
            "label": "",
            "sql": obj_info("VIEW", "_V_EXPORT_"),
            "typ": "varchar"
        },
        "postproc": {
            "dbs": "postproc",
            "label": "",
            "sql": obj_info("PROCEDURE", "_EXPORT_"),
            "typ": "varchar"
        },
        "description": {
            "dbs": "fac_export_app_oms",
            "label": L("fac_export_app_oms"),
            "typ": "varchar",
            "translate": true
        },
        "authorization": {
            "dbs": "fac_functie_key",
            "label": L("fac_functie_key"),
            "typ": "key",
            "foreign": "fac_functie"
        },
        "authorizationbrowse": {
            "dbs": "fac_export_app_browse_f_key",
            "label": L("fac_export_app_browse_f_key"),
            "typ": "key",
            "foreign": "fac_functie"
        },
        "charset": {
            "dbs": "fac_export_app_charset",
            "label": L("fac_export_app_charset"),
            "typ": "varchar"
        },
        "folder": {
            "dbs": "fac_export_app_folder",
            "label": L("fac_export_app_folder"),
            "typ": "varchar"
        },
        "fileprefix": {
            "dbs": "fac_export_app_file_prefix",
            "label": L("fac_export_app_file_prefix"),
            "typ": "varchar"
        },
        "postfix": {
            "dbs": "fac_export_app_postfix",
            "label": L("fac_export_app_postfix"),
            "typ": "varchar"
        },
        "logpostfix": {
            "dbs": "fac_export_app_log_postfix",
            "label": L("fac_export_app_log_postfix"),
            "typ": "varchar"
        },
        "flags": {
            "dbs": "fac_export_app_flags",
            "label": L("fac_export_app_flags"),
            "typ": "number"
        },
        "xsl": {
            "dbs": "fac_export_app_xsl",
            "label": L("fac_export_app_xsl"),
            "typ": "varchar"
        },
        "timestamp": {
            "dbs": "fac_export_app_timestamp",
            "label": L("fac_export_app_timestamp"),
            "typ": "varchar"
        },
        "exported": {
            "dbs": "fac_export_app_datum",
            "label": L("fac_export_app_datum"),
            "typ": "datetime",
            "readonly": true
        },
        "created": {
            "dbs": "fac_export_app_aanmaak",
            "label": L("fac_export_app_aanmaak"),
            "typ": "datetime",
            "readonly": true
        },
        "prefix": {
            "dbs": "fac_export_app_prefix",
            "label": L("fac_export_app_prefix"),
            "typ": "varchar"
        },
        "delimiter": {
            "dbs": "fac_export_app_delimiter",
            "label": L("fac_export_app_delimiter"),
            "typ": "varchar"
        }
    };


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