<% /*
    $Revision$
    $Id$

    File:           model_tracking.inc

    Description:    Tracking model
    Parameters:
    Context:

    Notes:  shared/statusinfo toont bij een reservering bijvoorbeeld ook
            afspraak en melding tracking. Zover gaan we hier (nog?) niet
*/

%>
<%
function model_tracking(xmlnodes)
{
    this.records_name = "trackings";
    this.record_name  = "tracking";
    this.table        = "fac_tracking";
    this.primary      = "fac_tracking_key";
    this.records_title = L("fac_tracking_m");
    this.record_title =  L("fac_tracking");
    this.xmlnodes     = xmlnodes;

    this.tablesql = "(SELECT fac_tracking_key,"
                  + "        ft.fac_srtnotificatie_key,"
                  + "        fac_tracking_refkey,"
                  + "        fac_tracking_datum,"
                  + "        fac_tracking_oms,"
                  + "        prs_perslid_key"
                  + "   FROM fac_tracking ft, "
                  + "        fac_srtnotificatie fs"
                  + "  WHERE ft.fac_srtnotificatie_key = fs.fac_srtnotificatie_key"
                  + "    AND fs.fac_srtnotificatie_xmlnode IN (" + safe.quoted_sql_join(xmlnodes) + ")) "
                  + "   fac_tracking";

    this.fields = {
        "id": {
            "dbs": "fac_tracking_key",
            "label": L("lcl_key"),
            "typ": "key"
        },
        "notificationtype": {
            "dbs": "fac_srtnotificatie_key",
            "label": L("fac_srtnotificatie"),
            "typ": "key",
            "foreign": "fac_srtnotificatie"
        },
        "date": {
            "dbs": "fac_tracking_datum",
            "label": L("lcl_date"),
            "typ": "datetime"
        },
        "description": {
            "dbs": "fac_tracking_oms",
            "label": L("lcl_descr"),
            "typ": "varchar"
        },
        "person": {
            "dbs": "prs_perslid_key",
            "label": L("prs_perslid"),
            "typ": "varchar",
            "foreign": "prs_perslid"
        },
        "trackingrefkey": {
            "dbs": "fac_tracking_refkey",
            "label": L("lcl_reference"),
            "typ": "key"
        }
    };
    this.list = { columns: ["id", "date", "notificationtype", "description", "person"] }

    // Merk op: géén eigen REST_GET
    // We kunnen alleen via een include van een parent die dan ook
    // vooral alle autorisatiecontrole voor ons kan verzorgen
    //    this.REST_GET = generic_REST_GET(this, {});

}

%>