FSN#32762 usrrap_cols verversen

svn path=/Website/trunk/; revision=25905
This commit is contained in:
Jos Groot Lipman
2015-08-11 15:12:13 +00:00
parent 302678ffc8
commit 5f0f9596d2
2 changed files with 90 additions and 20 deletions

View File

@@ -26,25 +26,30 @@ function model_reportsx(usrrap_key, params)
this.records_title = L("lcl_menu_fac_reports");
this.record_title = L("lcl_usrrap_report");
this.fields = { "id" : { dbs: "fac_usrrap_key", typ: "key", label: "Key", filter: "exact" },
"name" : { dbs: "fac_usrrap_omschrijving", typ: "varchar", label: L("lcl_usrrap_report"), filter: "like", translate: true , len : 60},
"description" : { dbs: "fac_usrrap_info", typ: "varchar", label: L("lcl_usrrap_info"), filter: "like", translate: true },
"viewname" : { dbs: "fac_usrrap_view_name", typ: "varchar", label: L("lcl_usrrap_viewname"), filter: "like"},
"authorisation": { dbs: "fac_functie_key", typ: "key", label: L("lcl_usrrap_functie"), foreign: "fac_functie"},
"group" : { dbs: "fac_usrrap_groep", typ: "varchar", label: L("lcl_usrrap_groep"), filter: "like" },
"styling" : { dbs: "fac_usrrap_functie", typ: "key", label: L("lcl_usrrap_styling"),
this.fields = { "id" : { dbs: "fac_usrrap_key", typ: "key", label: "Key", filter: "exact" },
"name" : { dbs: "fac_usrrap_omschrijving", typ: "varchar", label: L("lcl_usrrap_report"), filter: "like", translate: true , len : 60},
"description" : { dbs: "fac_usrrap_info", typ: "varchar", label: L("lcl_usrrap_info"), filter: "like", translate: true },
"viewname" : { dbs: "fac_usrrap_view_name", typ: "varchar", label: L("lcl_usrrap_viewname"), filter: "like"},
"authorisation": { dbs: "fac_functie_key", typ: "key", label: L("lcl_usrrap_functie"), foreign: "fac_functie"},
"group" : { dbs: "fac_usrrap_groep", typ: "varchar", label: L("lcl_usrrap_groep"), filter: "like" },
"styling" : { dbs: "fac_usrrap_functie", typ: "key", label: L("lcl_usrrap_styling"),
LOV: L("lcl_usrrap_stylingLOV") }, // 0;on-gestylede;1;gestylede;2;procedure;3;procedure gestyled;8;Via tabelizer;16;mobile
"urllink" : { dbs: "fac_usrrap_urllink", typ: "varchar", label: L("lcl_usrrap_urllink")},
"autorefresh" : { dbs: "fac_usrrap_autorefresh", typ: "check", label: L("lcl_usrrap_autorefresh")}
"urllink" : { dbs: "fac_usrrap_urllink", typ: "varchar", label: L("lcl_usrrap_urllink")},
"autorefresh" : { dbs: "fac_usrrap_autorefresh", typ: "check", label: L("lcl_usrrap_autorefresh")},
"showcount" : { dbs: "fac_usrrap_showcount", typ: "check", label: L("lcl_usrrap_showcount")},
"lastrefresh" : { dbs: "fac_usrrap_col_refresh", typ: "datetime", label: "Last column refresh (internal)", readonly: true,
hidden: user.oslogin() != "_FACILITOR" }
};
this.list = { columns: ["id", "name", "description"] };
this.search = { autosearch: true,
filters: ["id", "name", "description"]
};
this.includes = {"columns": { model: new model_reportcolumns(usrrap_key, { internal: true }),
joinfield: "fac_usrrap_key"
joinfield: "fac_usrrap_key",
single_only: true
}
};
@@ -81,6 +86,7 @@ function model_reportsx(usrrap_key, params)
this._clone_report_cols = function(old_usrrap_key, new_model)
{
JGL_NOOIT_GEBRUIKT_LIJKT_HET;
var oldrap = usrrap.fac_usrrap_info(old_usrrap_key); // Niet via 'model', die kan geen VIEW-rapporten aan
for (var i = 0; i < oldrap.columns.length; i++)
@@ -127,10 +133,10 @@ function model_reportsx(usrrap_key, params)
sql += ", fac_usrrap_cols_volgnr";
var json = api2.sql2json (params, sql, this);
if (json.length == 1 && params.include && "columns" in params.include && json[0].columns.length == 0)
if (json.length == 1 && params.include && inArray("columns", params.include))
{
this.includes["columns"].model._view2columns(params.filter.id);
var json = api2.sql2json (params, sql, this );
this.includes["columns"].model._view2columns(params.filter.id, json[0].lastrefresh, json[0].columns);
var json = api2.sql2json (params, sql, this ); // En nu opnieuw ophalen
}
if (json.length == 1 && "viewname" in json[0] && !this.is_safe_view(json[0].viewname))
this.fields["viewname"].readonly = true;