<% /*
    $Revision$
    $Id$

    File:           model_msg_message.inc

    Description:    Bericht versturen
    Parameters:
    Context:

    Notes:
*/
%>
<%

function model_msg_message()
{
    this.table = "msg_message";
    this.primary = "msg_message_key";
    this.autfunction = "WEB_MSGBOF";
    this.autfunction_add = "-"; // unsupported via SCF
    this.record_name = "message";
    this.records_name = "messages";
    this.fields = {
        "id": {
            "dbs": "msg_message_key",
            "label": L("lcl_key"),
            "typ": "key",
            "required": true,
            "seq": "msg_s_msg_message_key"
        },
        "sender": {
            "dbs": "prs_perslid_key",
            "label": L("lcl_prs_bedrijfadres_afzender"), // LCL TODO
            "typ": "key",
            "foreign": "PRS_PERSLID",
            "hidden_fld": true,
            "defaultvalue": user_key
        },
        "subject": {
            "dbs": "msg_message_onderwerp",
            "label": L("lcl_mes_subject"),
            "typ": "varchar",
            "required": true
        },
        "description": {
            "dbs": "msg_message_oms",
            "label": L("lcl_mes_message"),
            "typ": "memo",
            "bb_codes": true,
            "module": "MES",
            "required": true
        },
        "priority": {
            "dbs": "msg_message_prioriteit",
            "label": L("lcl_mes_priority"),
            "typ": "varchar",
            "required": true,
            "LOV": priorityLOV(), /* 1=high, 2=normal, 3=low */
            "defaultvalue": 2 // Geet dit goed?
        },
        /* Doen de 2 onderstaande velden nog ergens ooit iets .. ?
        "url": {
            "dbs": "msg_message_url",
            "label": L("lcl_mes_link"),
            "typ": "varchar"
        },
        "reply_key": {
            "dbs": "msg_message_replykey",
            "label": L("lcl_mes_message_send"),
            "typ": "key",
            "foreign": {
               "tbl": "msg_message",
               "key": "msg_message_key",
               "desc": "msg_message_oms"
            },
            "readonly": true
        }, */
        "created": {
            "dbs": "msg_message_aanmaak",
            "label": L("lcl_mes_send_date_time"),
            "typ": "datetime",
            "readonly": true
        }
    };

    function priorityLOV() {
        return "1;" + L("lcl_mes_high")
            + ";2;" + L("lcl_mes_normaal")
            + ";3;" + L("lcl_mes_low");
    }

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