svn path=/Website/trunk/; revision=23656
This commit is contained in:
@@ -502,6 +502,9 @@ api2 = {
|
||||
if (params.include[i] in model.includes)
|
||||
{
|
||||
var inc = model.includes[params.include[i]];
|
||||
// Geneste includes verwijderen
|
||||
delete inc.model.includes;
|
||||
|
||||
if (inc.model)
|
||||
{
|
||||
if (inc.single_only && !params.filter.id)
|
||||
@@ -573,7 +576,7 @@ api2 = {
|
||||
case "datetime":
|
||||
// LET OP: Een (new Date) gemaakt binnen een plugin is vreemd genoeg geen (instanceof Date)
|
||||
// Waarschijnlijk gebruikt een wsc een ander Date object als (ASP)JScript?
|
||||
if (typeof newval == "object" && !(newval instanceof Date))
|
||||
if (newval !== null && typeof newval == "object" && !(newval instanceof Date))
|
||||
newval = new Date(newval);
|
||||
|
||||
if (newval !== null && !(newval instanceof Date))
|
||||
@@ -781,7 +784,20 @@ api2 = {
|
||||
incmodel.aliasprefix = incmodel.aliasprefix || "";
|
||||
if (oRs(incmodel.aliasprefix + incmodel.primary).value == null) // Geen record door outer join
|
||||
continue;
|
||||
record[incname].push(api2.sql2jsonfields(oRs, incmodel));
|
||||
|
||||
var inc_record = api2.sql2jsonfields(oRs, incmodel);
|
||||
var inc_record_exists = false;
|
||||
for (var i=0; i<record[incname].length; i++)
|
||||
{
|
||||
var tmp_record = record[incname];
|
||||
var cur_record = tmp_record[i];
|
||||
if (JSON.stringify(cur_record) == JSON.stringify(inc_record))
|
||||
inc_record_exists = true;
|
||||
}
|
||||
if (!inc_record_exists)
|
||||
record[incname].push(inc_record);
|
||||
//else
|
||||
// __Log("Deze bestaat al");
|
||||
}
|
||||
else if (model.includes[incname].func) // include via callback functie zoals reservablerooms/occupation
|
||||
{
|
||||
@@ -1074,6 +1090,35 @@ api2 = {
|
||||
hook = null;
|
||||
return outdata;
|
||||
}
|
||||
},
|
||||
find_fieldindex_by_dbsname: function(array, value)
|
||||
{
|
||||
for(var i = 0; i < array.length; i++)
|
||||
{
|
||||
if(array[i].hasOwnProperty("dbs") && array[i]["dbs"] === value)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
},
|
||||
field_delete: function(array, dbsname)
|
||||
{
|
||||
var index = api2.find_fieldindex_by_dbsname(array, dbsname);
|
||||
if (index != -1)
|
||||
array.splice(index,1);
|
||||
},
|
||||
field_alter: function(array, dbsname, newval)
|
||||
{
|
||||
var index = api2.find_fieldindex_by_dbsname(array, dbsname);
|
||||
var field = array[index];
|
||||
field.val = newval;
|
||||
},
|
||||
field_value: function(array, dbsname)
|
||||
{
|
||||
var index = api2.find_fieldindex_by_dbsname(array, dbsname);
|
||||
var field = array[index];
|
||||
return field.val;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
<!-- #include file="../Shared/discx3d.inc" -->
|
||||
<!-- #include file="../mld/mld.inc" -->
|
||||
<!-- #include file="model_issueobjects.inc"-->
|
||||
<!-- #include file="model_notes.inc"-->
|
||||
<!-- #include file="model_orders.inc"-->
|
||||
<%
|
||||
|
||||
@@ -24,6 +25,7 @@ model_issues =
|
||||
{
|
||||
module: "MLD",
|
||||
table: "mld_melding",
|
||||
// aliasprefix: "", // Deze prefix wordt voor fields.name gezet.
|
||||
primary: "mld_melding_key",
|
||||
records_name: "issues",
|
||||
record_name: "issue",
|
||||
@@ -37,6 +39,7 @@ model_issues =
|
||||
{ name: "description", dbs: "mld_melding_omschrijving", typ: "varchar", track: L("lcl_descr"), filter: "like" },
|
||||
{ name: "remark", dbs: "mld_melding_opmerking", typ: "varchar", track: L("lcl_remark")},
|
||||
{ name: "status", dbs: "mld_melding_status", typ: "key", foreign: mld.getmldstatustext, track: L("lcl_status"), filter: "exact" },
|
||||
{ name: "flag", dbs: "mld_melding_flag", typ: "key", /* geen echte key, wel key-gedrag */ track: L("lcl_mld_flags"), filter: "exact" },
|
||||
{ name: "account", dbs: "prs_kostenplaats_key", typ: "key", foreign: "prs_kostenplaats", track: L("lcl_account"), filter: "exact" },
|
||||
{ name: "handler", dbs: "mld_melding_behandelaar_key", typ: "key", foreign: "prs_perslid", track: L("lcl_mld_behandelaar"), filter: "exact" },
|
||||
{ name: "location", dbs: "mld_alg_locatie_key", typ: "key", foreign: "alg_locatie", track: L("lcl_location"), filter: "exact" },
|
||||
@@ -60,6 +63,15 @@ model_issues =
|
||||
/* gaat uit dat die wordt geimplementeerd met een view fac_v_notes (module, key, columns....) */
|
||||
return "(module='MLD' OR module IS NULL) AND fac_v_notes.parent_key(+) = mld_melding.mld_melding_key";
|
||||
}
|
||||
},
|
||||
"orders": {
|
||||
model: model_orders,
|
||||
joinfield: "mld_melding_key",
|
||||
single_only: false,
|
||||
joinfunction: function (params)
|
||||
{
|
||||
return " mld_melding.mld_melding_key = mld_opdr.mld_melding_key(+) ";
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -78,7 +90,7 @@ model_issues =
|
||||
|
||||
if (scope == "fe")
|
||||
{
|
||||
query.wheres.push("prs_perslid_key=" + user_key);
|
||||
query.wheres.push("mld_melding.prs_perslid_key=" + user_key);
|
||||
}
|
||||
|
||||
if (!params.filter.id)
|
||||
@@ -106,7 +118,7 @@ model_issues =
|
||||
query.wheres.push("ins_tab_discipline.ins_srtdiscipline_key = ins_srtdiscipline.ins_srtdiscipline_key");
|
||||
|
||||
query.tables.push("alg_v_allonroerendgoed");
|
||||
query.wheres.push("mld_alg_onroerendgoed_keys = alg_v_allonroerendgoed.alg_onroerendgoed_keys(+)");
|
||||
query.wheres.push("mld_melding.mld_alg_onroerendgoed_keys = alg_v_allonroerendgoed.alg_onroerendgoed_keys(+)");
|
||||
|
||||
if (params.authparams.ALGreadlevel > -1)
|
||||
{
|
||||
@@ -114,7 +126,7 @@ model_issues =
|
||||
alg3d = true;
|
||||
__Log("ALGreadlevel="+params.authparams.ALGreadlevel);
|
||||
query.tables.push("alg_locatie"); /* opletten: outerjoin denk ik? */
|
||||
query.wheres.push("mld_alg_onroerendgoed_keys = alg_locatie.alg_locatie_key(+)");
|
||||
query.wheres.push("mld_melding.mld_alg_onroerendgoed_keys = alg_locatie.alg_locatie_key(+)");
|
||||
query.tables.push("alg_district");
|
||||
query.wheres.push("alg_locatie.alg_district_key = alg_district.alg_district_key(+)");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user