Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eef9f77ee7 | ||
|
|
97be2acd04 | ||
|
|
a625193071 | ||
|
|
720dc5b349 | ||
|
|
5f95221c04 | ||
|
|
87713227b4 | ||
|
|
046f6200f1 | ||
|
|
ca955f49af | ||
|
|
3afd92770f |
@@ -389,33 +389,33 @@ alg = {
|
||||
|
||||
return aresult;
|
||||
},
|
||||
|
||||
|
||||
calc_algm2: function _calc_algm2(alg_key, lvl)
|
||||
{
|
||||
{
|
||||
var sql = "SELECT SUM (alg_ruimte_bruto_vloeropp) opp1, "
|
||||
+ " SUM (alg_ruimte_opp_alt1) opp2, "
|
||||
+ " SUM (alg_ruimte_opp_alt2) opp3 "
|
||||
+ " FROM alg_ruimte r, alg_verdieping v "
|
||||
+ " WHERE v.alg_verdieping_key = r.alg_verdieping_key "
|
||||
+ " AND r.alg_ruimte_verwijder IS NULL";
|
||||
|
||||
|
||||
if (lvl == "G")
|
||||
{
|
||||
sql += " AND alg_gebouw_key = " + alg_key;
|
||||
}
|
||||
|
||||
if (lvl == "V")
|
||||
{
|
||||
|
||||
if (lvl == "V")
|
||||
{
|
||||
sql += " AND r.alg_verdieping_key = " + alg_key;
|
||||
}
|
||||
|
||||
|
||||
var oRs = Oracle.Execute(sql);
|
||||
|
||||
var algm2 = { oppbruto: oRs("opp1").Value, oppalt1: oRs("opp2").Value, oppalt2: oRs("opp3").Value }
|
||||
|
||||
var algm2 = { oppbruto: oRs("opp1").Value, oppalt1: oRs("opp2").Value, oppalt2: oRs("opp3").Value }
|
||||
|
||||
oRs.Close();
|
||||
|
||||
return algm2;
|
||||
|
||||
return algm2;
|
||||
}
|
||||
}
|
||||
}
|
||||
%>
|
||||
@@ -17,7 +17,6 @@ var JSON_Result = true;
|
||||
%>
|
||||
<!--#include file="../Shared/common.inc"-->
|
||||
<!--#include file="../Shared/json2.js" -->
|
||||
<!--#include file="alg.inc" -->
|
||||
<%
|
||||
protectRequest.validateToken();
|
||||
|
||||
@@ -36,61 +35,6 @@ var autfunction = {D : "WEB_ALGMAN",
|
||||
|
||||
var authParams = user.checkAutorisation(autfunction);
|
||||
|
||||
var authparamsAlg = alg.checkAutorisation();
|
||||
|
||||
var tobedeleted = 0;
|
||||
var ingesloten = [];
|
||||
// Bepaal de opdrachten in de selectie die
|
||||
// ook echt geaccepteerd kunnen of mogen worden.
|
||||
for (var i = 0; i < dis_key_arr.length; i++)
|
||||
{
|
||||
var canDelete = false;
|
||||
switch (level)
|
||||
{
|
||||
case "RE": canDelete = alg.canWriteRegio(dis_key_arr[i], authparamsAlg.mALGwritelevel);
|
||||
break;
|
||||
case "D": canDelete = alg.canWriteDistrict(dis_key_arr[i], authparamsAlg.mALGwritelevel);
|
||||
break;
|
||||
case "L": canDelete = alg.canWriteLocatie(dis_key_arr[i], authparamsAlg.mALGwritelevel);
|
||||
break;
|
||||
case "T": var sql = "SELECT alg_locatie_key"
|
||||
+ " FROM alg_v_aanwezigterreinsector"
|
||||
+ " WHERE alg_terreinsector_key = " + dis_key_arr[i];
|
||||
oRs = Oracle.Execute(sql);
|
||||
canDelete = alg.canWriteLocatie(oRs("alg_locatie_key").Value, authparamsAlg.mALGwritelevel);
|
||||
oRs.Close()
|
||||
break;
|
||||
case "G": canDelete = alg.canWriteGebouw(dis_key_arr[i], authparamsAlg.mALGwritelevel);
|
||||
break;
|
||||
case "V": canDelete = alg.canWriteVerdieping(dis_key_arr[i], authparamsAlg.mALGwritelevel);
|
||||
break;
|
||||
case "R": canDelete = alg.canWriteRuimte(dis_key_arr[i], authparamsAlg.mALGwritelevel);
|
||||
break;
|
||||
case "W": var sql = "SELECT alg_ruimte_key"
|
||||
+ " FROM prs_v_werkplek_gegevens"
|
||||
+ " WHERE prs_werkplek_key = " + dis_key_arr[i];
|
||||
oRs = Oracle.Execute(sql);
|
||||
canDelete = alg.canWriteRuimte(oRs("alg_ruimte_key").Value, authparamsAlg.mALGwritelevel);
|
||||
oRs.Close()
|
||||
break;
|
||||
case "PW": var sql = "SELECT alg_ruimte_key"
|
||||
+ " FROM prs_v_werkplek_gegevens w, prs_perslidwerkplek pw"
|
||||
+ " WHERE pw.prs_werkplek_key = w.prs_werkplek_key"
|
||||
+ " AND prs_perslidwerkplek_key = " + dis_key_arr[i];
|
||||
oRs = Oracle.Execute(sql);
|
||||
canDelete = alg.func_enabled_ruimte(oRs("alg_ruimte_key").Value).canPRSBOFwrite;
|
||||
oRs.Close()
|
||||
break;
|
||||
}
|
||||
|
||||
if (canDelete)
|
||||
{
|
||||
ingesloten.push(dis_key_arr[i]);
|
||||
tobedeleted++;
|
||||
}
|
||||
}
|
||||
user.auth_required_or_abort(tobedeleted > 0); // We klagen niet over enkele wel en enkele niet
|
||||
|
||||
var table = {D : "ALG_DISTRICT",
|
||||
RE: "ALG_REGIO",
|
||||
L : "ALG_LOCATIE",
|
||||
@@ -102,41 +46,41 @@ var table = {D : "ALG_DISTRICT",
|
||||
PW: "PRS_PERSLIDWERKPLEK"}[level];
|
||||
|
||||
result = { success: true, deleted: true };
|
||||
for (var i = 0; i < ingesloten.length; i++)
|
||||
for (var i = 0; i < dis_key_arr.length; i++)
|
||||
{
|
||||
// W en WP hebben geen verwijderveld (meer), die gaan echt weg.
|
||||
if (level == "W" || level == "PW")
|
||||
{
|
||||
// Een WP gooit via de cascade zijn bezetting mee weg.
|
||||
// Een bezetting verwijderen doet niets extra
|
||||
// Bij impliciet verwijderen van wp-bezetting dus ook de werkplek weggooien
|
||||
// die nu (per definitie) leeg wordt. Dit moet eerst, want straks weet
|
||||
// ik niet meer genoeg
|
||||
if (level == "PW" && S("prs_werkplek_implicit") == 1)
|
||||
// W en WP hebben geen verwijderveld (meer), die gaan echt weg.
|
||||
if (level == "W" || level == "PW")
|
||||
{
|
||||
sql = "DELETE FROM prs_werkplek"
|
||||
+ " WHERE prs_werkplek_key IN "
|
||||
+ " (SELECT prs_werkplek_key "
|
||||
+ " FROM prs_perslidwerkplek"
|
||||
+ " WHERE prs_perslidwerkplek_key IN (" + ingesloten[i] + "))"
|
||||
var err = Oracle.Execute(sql, true);
|
||||
if (err.friendlyMsg)
|
||||
abort_with_warning(err.friendlyMsg);
|
||||
// Een WP gooit via de cascade zijn bezetting mee weg.
|
||||
// Een bezetting verwijderen doet niets extra
|
||||
// Bij impliciet verwijderen van wp-bezetting dus ook de werkplek weggooien
|
||||
// die nu (per definitie) leeg wordt. Dit moet eerst, want straks weet
|
||||
// ik niet meer genoeg
|
||||
if (level == "PW" && S("prs_werkplek_implicit") == 1)
|
||||
{
|
||||
sql = "DELETE FROM prs_werkplek"
|
||||
+ " WHERE prs_werkplek_key IN "
|
||||
+ " (SELECT prs_werkplek_key "
|
||||
+ " FROM prs_perslidwerkplek"
|
||||
+ " WHERE prs_perslidwerkplek_key IN (" + dis_key_arr[i] + "))"
|
||||
var err = Oracle.Execute(sql, true);
|
||||
if (err.friendlyMsg)
|
||||
abort_with_warning(err.friendlyMsg);
|
||||
}
|
||||
// En dit moet ongeacht impliciet of expliciet.
|
||||
// Alleen bij PW&implicit zal dit niets meer verwijderen vanwege de cascade hiervoor
|
||||
sql = "DELETE FROM " + table
|
||||
+ " WHERE " + table + "_key IN (" + dis_key_arr[i] + ")";
|
||||
}
|
||||
// En dit moet ongeacht impliciet of expliciet.
|
||||
// Alleen bij PW&implicit zal dit niets meer verwijderen vanwege de cascade hiervoor
|
||||
sql = "DELETE FROM " + table
|
||||
+ " WHERE " + table + "_key IN (" + ingesloten[i] + ")";
|
||||
}
|
||||
else
|
||||
{
|
||||
sql = "UPDATE " + table
|
||||
+ " SET " + table + "_VERWIJDER = " + "SYSDATE"
|
||||
+ " WHERE " + table + "_key IN (" + ingesloten[i] + ")";
|
||||
}
|
||||
var err = Oracle.Execute(sql, true);
|
||||
if (err.friendlyMsg)
|
||||
abort_with_warning(err.friendlyMsg);
|
||||
else
|
||||
{
|
||||
sql = "UPDATE " + table
|
||||
+ " SET " + table + "_VERWIJDER = " + "SYSDATE"
|
||||
+ " WHERE " + table + "_key IN (" + dis_key_arr[i] + ")";
|
||||
}
|
||||
var err = Oracle.Execute(sql, true);
|
||||
if (err.friendlyMsg)
|
||||
abort_with_warning(err.friendlyMsg);
|
||||
}
|
||||
|
||||
Response.Write(JSON.stringify(result));
|
||||
|
||||
@@ -131,11 +131,6 @@ function district_list(pautfunction, params)
|
||||
sqln += " AND d.alg_district_key = " + dis_key;
|
||||
}
|
||||
|
||||
if (params.distr_descr)
|
||||
{
|
||||
sqln += " AND UPPER(d.alg_district_omschrijving) LIKE " + safe.quoted_sql_wild(params.distr_descr + "%");
|
||||
}
|
||||
|
||||
else if (reg_key)
|
||||
{
|
||||
sqln += " AND d.alg_regio_key = " + reg_key;
|
||||
|
||||
@@ -52,14 +52,10 @@ var authparams = alg.checkAutorisation();
|
||||
regiokey: regio_key,
|
||||
districtkey: district_key,
|
||||
startlevel: 0, // Regio
|
||||
eindlevel: 0, // Regio
|
||||
eindlevel: 1, // District
|
||||
whenEmpty: L("lcl_search_generic")
|
||||
});
|
||||
%>
|
||||
<tr class="primsearch">
|
||||
<td class="label"><label><%=L("lcl_estate_district_man_descr")%>:</label></td>
|
||||
<td><input type="text" class="wildcard" id="distr_descr" name="distr_descr" value=""></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td><!-- end column 1 -->
|
||||
<td class="searchkolom2">
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
$Id$
|
||||
|
||||
File: alg_district_search_list.asp
|
||||
Description:
|
||||
Parameters:
|
||||
Context:
|
||||
Description:
|
||||
Parameters:
|
||||
Context:
|
||||
Note:
|
||||
*/ %>
|
||||
|
||||
@@ -23,14 +23,12 @@ var outputmode = getQParamInt("outputmode", 0); // 0 = screen, 1 = print, 2 = e
|
||||
var showall = getQParamInt("showall", 0) == 1;
|
||||
var reg_key = getQParamInt("regiokey", -1); // Regio
|
||||
var dis_key = getQParamInt("districtkey", -1); // District
|
||||
var distr_descr = getQParam("distr_descr", ""); // Districtomschrijving
|
||||
|
||||
district_list ( "*",
|
||||
{ outputmode: outputmode,
|
||||
showall: showall,
|
||||
reg_key: (reg_key != -1? reg_key : null),
|
||||
dis_key: (dis_key != -1? dis_key : null),
|
||||
distr_descr: distr_descr
|
||||
dis_key: (dis_key != -1? dis_key : null)
|
||||
}
|
||||
);
|
||||
%>
|
||||
@@ -68,7 +68,6 @@ if (bld_key > 0)
|
||||
var verantw_key = oRs("prs_perslid_key_verantw").Value;
|
||||
var verantw_key2 = oRs("prs_perslid_key_verantw2").Value;
|
||||
var vervaldatum = oRs("alg_gebouw_vervaldatum").Value != null ? new Date(oRs("alg_gebouw_vervaldatum").Value) : null;
|
||||
var geb_score1 = oRs("alg_gebouw_mjb_score1").value;
|
||||
oRs.Close();
|
||||
}
|
||||
else
|
||||
@@ -121,7 +120,7 @@ else
|
||||
readonly: bld_key > 0,
|
||||
required: true
|
||||
});
|
||||
manRWFIELD("bld_naam", "fld", L("lcl_estate_gebouw_man_name"), bld_naam, {required: true, maxlength: 60});
|
||||
manRWFIELD("bld_naam", "fld", L("lcl_estate_gebouw_man_name"), bld_naam, {required: true, maxlength: 30});
|
||||
sql = "SELECT alg_srtgebouw_key, "
|
||||
+ " "+lcl.xsqla('alg_srtgebouw_omschrijving', 'alg_srtgebouw_key')
|
||||
+ " FROM alg_srtgebouw "
|
||||
@@ -189,7 +188,7 @@ else
|
||||
label: L("lcl_delivery_address"),
|
||||
adresKey: mld_adres,
|
||||
emptyOption: "",
|
||||
filtercode: "A",
|
||||
filtcode: "A",
|
||||
readonly: !this_alg.writeman
|
||||
}) ;
|
||||
manRWFIELD("bld_x", "fld", L("lcl_geoxcoord"), bld_x, {maxlength: 25});
|
||||
@@ -229,7 +228,6 @@ else
|
||||
);
|
||||
if (this_alg.writeman)
|
||||
CHECKBOXTR(L("lcl_estate_gebouw_werkdagen"), "fldalgwerk", "bld_werkdagen", werkdagen==1)
|
||||
ROFIELDTR("fld", "Conditie score", geb_score1, {suppressEmpty: true}); // L("lcl_alg_locatie_mjb_score1")
|
||||
BLOCK_END();
|
||||
|
||||
generateFlexKenmerkBlock ({ onrgoed_key : bld_key,
|
||||
|
||||
@@ -53,8 +53,7 @@ if (loc_key > 0)
|
||||
var pst_adres = oRs("alg_locatie_post_adres").value;
|
||||
var pst_plaats = oRs("alg_locatie_post_plaats").value;
|
||||
var pst_land = oRs("alg_locatie_post_land").value;
|
||||
var dienstniveau = oRs("mld_dienstniveau_key").value;
|
||||
var loc_score1 = oRs("alg_locatie_mjb_score1").value;
|
||||
var dienstniveau = oRs("mld_dienstniveau_key").value;
|
||||
|
||||
oRs.Close();
|
||||
}
|
||||
@@ -139,7 +138,6 @@ manRWFIELD("pst_land", "fld", L("lcl_prs_address_post_land"), p
|
||||
manRWFIELD("loc_vw", "fld", L("lcl_estate_locatie_man_verantw"), loc_vw, {maxlength: 30});
|
||||
manRWFIELD("loc_vwtel", "fld", L("lcl_estate_locatie_man_verantw_tel"), loc_vwtel, {maxlength: 15});
|
||||
manRWFIELD("loc_mail", "fld", L("lcl_noti_email"), loc_mail, {maxlength: 200});
|
||||
ROFIELDTR("fld", "Conditie score", loc_score1, {suppressEmpty: true}); // L("lcl_alg_locatie_mjb_score1")
|
||||
|
||||
BLOCK_END();
|
||||
|
||||
|
||||
@@ -52,10 +52,6 @@ for (var i = 0; i < alg_key_arr.length; i++)
|
||||
|
||||
|
||||
allKenmerkenSQL = "SELECT " + lcl.xsql('k.alg_kenmerk_omschrijving', 'k.alg_kenmerk_key') + " kenmerk_omschrijving"
|
||||
+ ", k.alg_kenmerk_kenmerktype kenmerk_kenmerktype"
|
||||
+ ", k.alg_kenmerk_systeem kenmerk_systeem"
|
||||
+ ", k.alg_kenmerk_toonbaar kenmerk_readonly"
|
||||
+ ", k.alg_kenmerk_uniek kenmerk_uniek"
|
||||
+ ", fac_kenmerkdomein_key"
|
||||
+ " FROM alg_kenmerk k"
|
||||
+ " WHERE k.alg_kenmerk_key = "; /* wordt in saveFlexkenmerken uitgebreid */
|
||||
@@ -76,12 +72,9 @@ for (var i = 0; i < alg_key_arr.length; i++)
|
||||
moduleVal: alg_level
|
||||
});
|
||||
|
||||
if (flextrack && flextrack.length)
|
||||
{
|
||||
var update_string = L("lcl_alg_is_algrup") + "\n" + flextrack.join("\n");
|
||||
shared.trackaction("ALGRUP", alg_key, update_string);
|
||||
nr_edited++;
|
||||
}
|
||||
var update_string = L("lcl_alg_is_algrup") + "\n" + algUpd.trackarray.join("\n");
|
||||
shared.trackaction("ALGRUP", alg_key, update_string);
|
||||
nr_edited++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +63,6 @@ function generateFlexKenmerkBlock(params)
|
||||
+ " k.alg_kenmerk_dec kenmerk_dec, "
|
||||
+ " k.alg_kenmerk_nmin kenmerk_nmin, "
|
||||
+ " k.alg_kenmerk_nmax kenmerk_nmax, "
|
||||
+ " k.alg_kenmerk_systeem kenmerk_systeem, "
|
||||
+ (onrgoed_key > 0
|
||||
? " (SELECT v.alg_onrgoedkenmerk_waarde "
|
||||
+ " FROM alg_onrgoedkenmerk v "
|
||||
|
||||
@@ -79,22 +79,22 @@ else
|
||||
IFRAMER("algFrame", page, { title: L("lcl_alg_gebouw_frame"),
|
||||
initHeight: "450px",
|
||||
FcltClose: "algClose" } );
|
||||
|
||||
|
||||
if (bld_key > -1)
|
||||
{
|
||||
var authparamsCNTUSE = user.checkAutorisation("WEB_CNTUSE", true);
|
||||
var authparamsCNTMAN = user.checkAutorisation("WEB_CNTMAN", true);
|
||||
var curole = "bo";
|
||||
|
||||
|
||||
if (!authparamsCNTMAN && authparamsCNTUSE)
|
||||
curole = "fe";
|
||||
|
||||
|
||||
if (authparamsCNTMAN || authparamsCNTUSE)
|
||||
{
|
||||
var page1="../cnt/cnt_search_list.asp?embedded=1&tiny=1&collapsed=1&urole=" + curole + "&ffutu=1&fact=1&frap=1&fopz=1&sact=1&bld_key=" + bld_key
|
||||
var page1="../cnt/cnt_search_list.asp?embedded=1&tiny=1&collapsed=1&urole=" + curole + "&ffutu=1&fact=1&frap=1&fopz=1&sact=1&loc_key="+ loc_key + "&bld_key=" + bld_key
|
||||
IFRAMER("cntFrame", page1, { initHide: true } );
|
||||
}
|
||||
}
|
||||
}
|
||||
%>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -68,41 +68,33 @@ function fnrowClass(oRs)
|
||||
function gotoDetails(row)
|
||||
{
|
||||
var algData = eval('(' + row.getAttribute("ROWDATA") + ')');
|
||||
var url = "appl/alg/alg_verdieping_search.asp?gebouw_key=" + algData.detail_key + "&autosearch=" + autosearch + "&chkgeb=1";
|
||||
var url = "appl/ALG/alg_verdieping_search.asp?gebouw_key=" + algData.detail_key + "&autosearch=" + autosearch + "&chkgeb=1";
|
||||
FcltMgr.openDetail(url, "<%=L("lcl_floor")%>");
|
||||
}
|
||||
function gotoParent(row)
|
||||
{
|
||||
var algData = eval('(' + row.getAttribute("ROWDATA") + ')');
|
||||
var url = "appl/alg/alg_locatie_search.asp?locatie_key=" + algData.parent_key + "&autosearch=" + autosearch;
|
||||
var url = "appl/ALG/alg_locatie_search.asp?locatie_key=" + algData.parent_key + "&autosearch=" + autosearch;
|
||||
FcltMgr.openDetail(url, "<%=L("lcl_location")%>");
|
||||
}
|
||||
function gebouwEdit(row)
|
||||
function gebouwEdit(row)
|
||||
{
|
||||
var algData = eval('(' + row.getAttribute("ROWDATA") + ')');
|
||||
var url = "appl/alg/alg_gebouw.asp?mode=viewUpdate&key=" + algData.key;
|
||||
var url = "appl/ALG/alg_gebouw.asp?mode=viewUpdate&key=" + algData.key;
|
||||
FcltMgr.openDetail(url, "<%=L("lcl_building")%>" + ' ' + algData.oms);
|
||||
}
|
||||
|
||||
function doDelete(rowArray, isMulti)
|
||||
{
|
||||
FcltMgr.confirm(L("lcl_alg_del_txt_gebouw"), { autoconfirm: isMulti }, function() {
|
||||
var bldKeyString = getKeyString(rowArray);
|
||||
var data = { key: bldKeyString,
|
||||
level: "G"
|
||||
};
|
||||
<% protectRequest.dataToken("data"); %>
|
||||
$.post("alg_delete.asp", data, FcltCallbackRefresh, "json");
|
||||
});
|
||||
}
|
||||
|
||||
function toObjMan(row)
|
||||
function doDelete(rowArray, isMulti)
|
||||
{
|
||||
var algData = eval('(' + row.getAttribute("ROWDATA") + ')');
|
||||
var url = "appl/ins/ins_search.asp?urole=bo&gebouw_key=" + algData.key;
|
||||
FcltMgr.openDetail(url, "<%=L("lcl_building")%>" + ' ' + algData.oms);
|
||||
FcltMgr.confirm(L("lcl_alg_del_txt_gebouw"), { autoconfirm: isMulti }, function() {
|
||||
var bldKeyString = getKeyString(rowArray);
|
||||
var data = { key: bldKeyString,
|
||||
level: "G"
|
||||
};
|
||||
<% protectRequest.dataToken("data"); %>
|
||||
$.post("alg_delete.asp", data, FcltCallbackRefresh, "json");
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
<%
|
||||
|
||||
@@ -126,24 +118,13 @@ function gebouw_list(pautfunction, params)
|
||||
var srtgebouw_key = params.srtgebouw_key;
|
||||
var verantw_key = params.verantw_key;
|
||||
var expalgincl = params.expalgincl;
|
||||
var mjob = params.mjob;
|
||||
var fitness_score1_from = params.fitness_score1_from;
|
||||
var fitness_score1_through = params.fitness_score1_through;
|
||||
|
||||
var autparamsINSUSE = user.checkAutorisation("WEB_INSUSE", true);
|
||||
var autparamsINSMAN = user.checkAutorisation("WEB_INSMAN", true);
|
||||
var readuse = autparamsINSUSE && autparamsINSUSE.PRSreadlevel < 9 && autparamsINSUSE.ALGreadlevel < 9; // Wijzigen Afgeronde gegevens.
|
||||
var readman = autparamsINSMAN && autparamsINSMAN.PRSreadlevel < 9 && autparamsINSMAN.ALGreadlevel < 9; // Wijzigen Afgeronde gegevens.
|
||||
function fnrowActionEnabler(oRs)
|
||||
{
|
||||
var eDelete = false;
|
||||
var eObjMan = false;
|
||||
if (alg.canWriteGebouw(oRs("alg_gebouw_key").value, authparams.mALGwritelevel))
|
||||
eDelete = true;
|
||||
// Heb ik rechten om het objectenbeheer overzicht te zien?
|
||||
if (readuse || readman)
|
||||
eObjMan = true;
|
||||
return ({eDelete: eDelete, eObjMan: eObjMan});
|
||||
return ({eDelete: eDelete})
|
||||
}
|
||||
|
||||
function fnrowFlexParams(oRs)
|
||||
@@ -177,7 +158,6 @@ function gebouw_list(pautfunction, params)
|
||||
+ " , g.alg_gebouw_x"
|
||||
+ " , g.alg_gebouw_y"
|
||||
+ " , g.alg_gebouw_vervaldatum"
|
||||
+ " , g.alg_gebouw_mjb_score1"
|
||||
+ " , (SELECT MAX(t.fac_tracking_datum)"
|
||||
+ " FROM fac_tracking t"
|
||||
+ " , fac_srtnotificatie sn"
|
||||
@@ -224,15 +204,6 @@ function gebouw_list(pautfunction, params)
|
||||
if (!expalgincl)
|
||||
sqln += " AND (g.alg_gebouw_vervaldatum IS NULL OR g.alg_gebouw_vervaldatum > TRUNC(SYSDATE)) ";
|
||||
|
||||
if (params.mjob)
|
||||
{ // Conditiescore.
|
||||
// Niet gemeten objecten doen wel mee in dit filter. Deze objecten worden dus niet getoond als er een waarde is ingevuld.
|
||||
if (fitness_score1_from > 0)
|
||||
sqln += " AND alg_locatie_mjb_score1 >= " + fitness_score1_from;
|
||||
if (fitness_score1_through > 0)
|
||||
sqln += " AND alg_locatie_mjb_score1 <= " + fitness_score1_through;
|
||||
}
|
||||
|
||||
sqln += " ORDER BY l.alg_locatie_upper ASC, "
|
||||
+ " g.alg_gebouw_upper ASC ";
|
||||
|
||||
@@ -276,12 +247,14 @@ function gebouw_list(pautfunction, params)
|
||||
rst.addColumn(new Column({caption: L("lcl_geoxcoord"), content: "alg_gebouw_x"}));
|
||||
rst.addColumn(new Column({caption: L("lcl_geoycoord"), content: "alg_gebouw_y"}));
|
||||
}
|
||||
if (params.mjob)
|
||||
rst.addColumn(new Column({caption: "Conditiescore", content: "alg_gebouw_mjb_score1"})); // L("lcl_alg_gebouw_mjb_score1")
|
||||
|
||||
rst.addAction({ action: "gebouwEdit", caption: L("lcl_edit"), isDefault: true});
|
||||
rst.addAction({ action: "doDelete", caption: L("lcl_delete"), enabler: "eDelete", single:!noref, multi: true, multiOnce: true});
|
||||
rst.addAction({ action: "toObjMan", caption: L("lcl_ins_object_management"), enabler: "eObjMan"});
|
||||
if (!noref)
|
||||
{
|
||||
rst.addAction({ action: "gotoDetails", caption: L("lcl_goto_verdieping_list")});
|
||||
rst.addAction({ action: "gotoParent", caption: L("lcl_goto_locatie_list")});
|
||||
}
|
||||
var cnt = rst.processResultset();
|
||||
%>
|
||||
</body>
|
||||
|
||||
@@ -20,7 +20,6 @@ var srtgebouw_key = getQParamInt("gebouw_func", -1); // Gebouwfunctie
|
||||
var verantw_key = getQParamInt("verantw", -1); // Gebouw verantwoordelijke
|
||||
var verantw_key2 = getQParamInt("verantw2", -1); // Gebouw verantwoordelijke 2
|
||||
var autosearch = getQParamInt("autosearch", 0) == 1;
|
||||
var mjob = getQParamInt("mjob", 0) == 1; // mjob mode
|
||||
var authparams = alg.checkAutorisation();
|
||||
var this_alg = alg.func_enabled(gebouw_key);
|
||||
%>
|
||||
@@ -51,7 +50,6 @@ var this_alg = alg.func_enabled(gebouw_key);
|
||||
<body id="searchbody">
|
||||
<div id="search">
|
||||
<form name="u2" target="workFrame" action="alg_gebouw_search_list.asp" method="get">
|
||||
<input type=hidden name="mjob" id="mjob" value="<%=mjob?1:0%>">
|
||||
<% BLOCK_START("searchtable", L("lcl_filterblok"));%>
|
||||
<tr>
|
||||
<td class="searchkolom1">
|
||||
@@ -93,62 +91,26 @@ var this_alg = alg.func_enabled(gebouw_key);
|
||||
+ " FROM alg_srtgebouw"
|
||||
+ " WHERE alg_srtgebouw_verwijder IS NULL"
|
||||
+ " ORDER BY UPPER("+lcl.xsql('alg_srtgebouw_omschrijving', 'alg_srtgebouw_key')+")";
|
||||
FCLTselector("srt",
|
||||
sql,
|
||||
{ initKey: srtgebouw_key,
|
||||
label: L("lcl_estate_gebouw_srtgebouw"),
|
||||
trclass: "primsearch",
|
||||
emptyOption: ""
|
||||
});
|
||||
FCLTselector("srt",
|
||||
sql,
|
||||
{ initKey: srtgebouw_key,
|
||||
label: L("lcl_estate_gebouw_srtgebouw"),
|
||||
trclass: "primsearch",
|
||||
emptyOption: ""
|
||||
});
|
||||
%>
|
||||
<!-- Gebouw verantwoordelijke -->
|
||||
<% // Dit veld is alleen zichtbaar indien er minimaal <20><>n gebouwverantwoordelijke geconfigureerd is (suppressNoValues).
|
||||
FCLTpersoonselector("verantw",
|
||||
"sgVerantw",
|
||||
{ perslidKey: verantw_key,
|
||||
label: L("lcl_alg_bld_verantw"),
|
||||
filtercode: "GV", // Gebouw Verantwoordelijke
|
||||
trclass: "primsearch",
|
||||
suppressNoValues: true,
|
||||
whenEmpty: L("lcl_search_generic") // want filter
|
||||
});
|
||||
%>
|
||||
<!-- Gebouw verantwoordelijke -->
|
||||
<% // Dit veld is alleen zichtbaar indien er minimaal <20><>n gebouwverantwoordelijke geconfigureerd is (suppressNoValues).
|
||||
FCLTpersoonselector("verantw",
|
||||
"sgVerantw",
|
||||
{ perslidKey: verantw_key,
|
||||
label: L("lcl_alg_bld_verantw"),
|
||||
filtercode: "GV", // Gebouw Verantwoordelijke
|
||||
trclass: "primsearch",
|
||||
suppressNoValues: true,
|
||||
whenEmpty: L("lcl_search_generic") // want filter
|
||||
});
|
||||
|
||||
if (mjob)
|
||||
{ // Conditiescore
|
||||
%> <tr class="primsearch fldfitness_score" id="fitness_score">
|
||||
<td>
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td class="label">
|
||||
<label for="show_fitness_score_from"><%="Conditiescore"%>:</label> <% /* L("lcl_mjb_fitness_score") */ %>
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
<%="van"%> <% /* L("lcl_mjb_from") */ %>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td class="score">
|
||||
<input type="text"
|
||||
onChange="fvalid=checkKenmerk(this, false, 'N', 1, 0, 1, 6)"
|
||||
onBlur="checkKenmerk(this, true, 'N', 1, 0, 1, 6)"
|
||||
id="fitness_score1_from"
|
||||
name="fitness_score1_from"
|
||||
class="fldflexN number "
|
||||
value=""
|
||||
maxlength="1">
|
||||
<%="t/m"%> <% /* L("lcl_mjb_through") */ %>
|
||||
<input type="text"
|
||||
onChange="fvalid=checkKenmerk(this, false, 'N', 1, 0, 1, 6)"
|
||||
onBlur="checkKenmerk(this, true, 'N', 1, 0, 1, 6)"
|
||||
id="fitness_score1_through"
|
||||
name="fitness_score1_through"
|
||||
class="fldflexN number "
|
||||
value=""
|
||||
maxlength="1">
|
||||
</td>
|
||||
</tr>
|
||||
<% } %>
|
||||
</table>
|
||||
</td><!-- end column 1 -->
|
||||
</tr>
|
||||
|
||||
@@ -32,9 +32,6 @@ var srtgebouw_key = getQParamInt("srt", -1); // Gebouwfunctie
|
||||
var verantw_key = getQParamInt("verantw", -1); // Gebouw verantwoordelijke
|
||||
var verantw_key2 = getQParamInt("verantw2", -1); // Gebouw verantwoordelijke 2
|
||||
var expalgincl = getQParamInt("expAlgIncl", 0) == 1; // Ook vervallen gebouwen
|
||||
var mjob = getQParamInt("mjob", 0) == 1; // mjob mode
|
||||
var fitness_score1_from = getQParamInt("fitness_score1_from", -1); // Conditie score van.
|
||||
var fitness_score1_through = getQParamInt("fitness_score1_through", -1); // Conditie score t/m.
|
||||
|
||||
gebouw_list ( "*",
|
||||
{ outputmode: outputmode,
|
||||
@@ -48,9 +45,6 @@ gebouw_list ( "*",
|
||||
bld_key: (bld_key != -1? bld_key : null),
|
||||
bld_code: bld_code,
|
||||
bld_name: bld_name,
|
||||
mjob: mjob,
|
||||
fitness_score1_from : fitness_score1_from,
|
||||
fitness_score1_through : fitness_score1_through,
|
||||
noref: (noref != -1? noref : null),
|
||||
expalgincl: expalgincl
|
||||
}
|
||||
|
||||
@@ -120,9 +120,6 @@ function locatie_list(pautfunction, params)
|
||||
var reg_key = params.reg_key;
|
||||
var dis_key = params.dis_key;
|
||||
var loc_key = params.loc_key;
|
||||
var mjob = params.mjob;
|
||||
var fitness_score1_from = params.fitness_score1_from;
|
||||
var fitness_score1_through = params.fitness_score1_through;
|
||||
|
||||
function fnrowActionEnabler(oRs)
|
||||
{
|
||||
@@ -164,7 +161,6 @@ function locatie_list(pautfunction, params)
|
||||
+ " , l.alg_locatie_verantw_tel"
|
||||
+ " , l.alg_locatie_x"
|
||||
+ " , l.alg_locatie_y"
|
||||
+ " , l.alg_locatie_mjb_score1"
|
||||
+ " , (SELECT MAX(t.fac_tracking_datum)"
|
||||
+ " FROM fac_tracking t"
|
||||
+ " , fac_srtnotificatie sn"
|
||||
@@ -172,7 +168,7 @@ function locatie_list(pautfunction, params)
|
||||
+ " AND t.fac_tracking_refkey = l.alg_locatie_key"
|
||||
+ " AND sn.fac_srtnotificatie_xmlnode = 'locatie'"
|
||||
+ " ) recentdatum"
|
||||
+ " FROM alg_locatie l" // TODO: alg_v_aanweziglocatie gebruiken
|
||||
+ " FROM alg_v_aanweziglocatie l"
|
||||
+ " , alg_district d "
|
||||
+ " WHERE d.alg_district_key(+) = l.alg_district_key"
|
||||
+ " AND l.alg_locatie_verwijder IS NULL";
|
||||
@@ -199,22 +195,11 @@ function locatie_list(pautfunction, params)
|
||||
{
|
||||
sqln += " AND d.alg_regio_key = " + reg_key;
|
||||
}
|
||||
|
||||
|
||||
if (params.loc_code)
|
||||
sqln += " AND UPPER(l.alg_locatie_code) LIKE " + safe.quoted_sql_wild(params.loc_code + "%");
|
||||
if (params.loc_descr)
|
||||
sqln += " AND UPPER(l.alg_locatie_omschrijving) LIKE " + safe.quoted_sql_wild(params.loc_descr + "%");
|
||||
sqln += " AND UPPER(l.alg_locatie_code) LIKE " + safe.quoted_sql_wild(params.loc_code + "%");
|
||||
|
||||
if (params.mjob)
|
||||
{ // Conditiescore.
|
||||
// Niet gemeten objecten doen wel mee in dit filter. Deze objecten worden dus niet getoond als er een waarde is ingevuld.
|
||||
if (fitness_score1_from > 0)
|
||||
sqln += " AND alg_locatie_mjb_score1 >= " + fitness_score1_from;
|
||||
if (fitness_score1_through > 0)
|
||||
sqln += " AND alg_locatie_mjb_score1 <= " + fitness_score1_through;
|
||||
}
|
||||
|
||||
sqln += " ORDER BY UPPER(alg_district_omschrijving), UPPER(alg_locatie_code)";
|
||||
sqln += " ORDER BY l.alg_locatie_upper ASC "
|
||||
|
||||
var addurl = "appl/alg/alg_locatie.asp";
|
||||
// addurl += buildTransitParam(["loc_key", "bld_key", "flo_key", "room_key"], params) // TODO: welke allemaal?
|
||||
@@ -246,8 +231,6 @@ function locatie_list(pautfunction, params)
|
||||
rst.addColumn(new Column({caption: L("lcl_prs_address_bezoek_adres"), content: "alg_locatie_adres"}));
|
||||
rst.addColumn(new Column({caption: L("lcl_prs_address_bezoek_postcode"), content: "alg_locatie_postcode"}));
|
||||
rst.addColumn(new Column({caption: L("lcl_prs_address_bezoek_plaats"), content: "alg_locatie_plaats"}));
|
||||
if (params.mjob)
|
||||
rst.addColumn(new Column({caption: "Conditiescore", content: "alg_locatie_mjb_score1"})); // L("lcl_alg_locatie_mjb_score1")
|
||||
|
||||
if (outputmode != 0)
|
||||
{
|
||||
|
||||
@@ -15,7 +15,6 @@ FCLTHeader.Requires({ plugins:["jQuery", "kenmerk"] });
|
||||
var district_key = getQParamInt("district_key", -1); //district
|
||||
var locatie_key = getQParamInt("locatie_key", -1); //locatie
|
||||
var autosearch = getQParamInt("autosearch", 0) == 1;
|
||||
var mjob = getQParamInt("mjob", 0) == 1; // mjob mode
|
||||
var authparams = alg.checkAutorisation();
|
||||
%>
|
||||
|
||||
@@ -45,8 +44,7 @@ var authparams = alg.checkAutorisation();
|
||||
<body id="searchbody">
|
||||
<div id="search">
|
||||
<form name="u2" target="workFrame" action="alg_locatie_search_list.asp" method="get">
|
||||
<input type=hidden name="mjob" id="mjob" value="<%=mjob?1:0%>">
|
||||
<% BLOCK_START("searchtable", L("lcl_filterblok"));%>
|
||||
<% BLOCK_START("searchtable", L("lcl_filterblok"));%>
|
||||
<tr>
|
||||
<td class="searchkolom1">
|
||||
<table><!-- x rijen, 2 kolommen: label + veld -->
|
||||
@@ -55,7 +53,7 @@ var authparams = alg.checkAutorisation();
|
||||
districtkey: district_key,
|
||||
locatiekey: locatie_key,
|
||||
startlevel: 1, // District
|
||||
eindlevel: 2, // Locatie
|
||||
eindlevel: 2, // locatie
|
||||
whenEmpty: L("lcl_search_generic") // want filter
|
||||
});
|
||||
%>
|
||||
@@ -63,56 +61,13 @@ var authparams = alg.checkAutorisation();
|
||||
<td class="label"><label><%=L("lcl_estate_locatie_man_code")%>:</label></td>
|
||||
<td><input type="text" class="wildcard" id="loc_code" name="loc_code" value=""></td>
|
||||
</tr>
|
||||
<tr class="primsearch">
|
||||
<td class="label"><label><%=L("lcl_estate_locatie_man_descr")%>:</label></td>
|
||||
<td><input type="text" class="wildcard" id="loc_descr" name="loc_descr" value=""></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td><!-- end column 1 -->
|
||||
|
||||
<!-- Second column -->
|
||||
<td class="searchkolom2">
|
||||
<table><!-- x rijen, 2 kolommen: label + veld -->
|
||||
<% if (mjob)
|
||||
{ // Conditiescore
|
||||
%> <tr class="primsearch fldfitness_score" id="fitness_score">
|
||||
<td>
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td class="label">
|
||||
<label for="show_fitness_score_from"><%="Conditiescore"%>:</label> <% /* L("lcl_mjb_fitness_score") */ %>
|
||||
</td>
|
||||
<td style="text-align: right">
|
||||
<%="van"%> <% /* L("lcl_mjb_from") */ %>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td class="score">
|
||||
<input type="text"
|
||||
onChange="fvalid=checkKenmerk(this, false, 'N', 1, 0, 1, 6)"
|
||||
onBlur="checkKenmerk(this, true, 'N', 1, 0, 1, 6)"
|
||||
id="fitness_score1_from"
|
||||
name="fitness_score1_from"
|
||||
class="fldflexN number "
|
||||
value=""
|
||||
maxlength="1">
|
||||
<%="t/m"%> <% /* L("lcl_mjb_through") */ %>
|
||||
<input type="text"
|
||||
onChange="fvalid=checkKenmerk(this, false, 'N', 1, 0, 1, 6)"
|
||||
onBlur="checkKenmerk(this, true, 'N', 1, 0, 1, 6)"
|
||||
id="fitness_score1_through"
|
||||
name="fitness_score1_through"
|
||||
class="fldflexN number "
|
||||
value=""
|
||||
maxlength="1">
|
||||
</td>
|
||||
</tr>
|
||||
<% } %>
|
||||
</table>
|
||||
</td><!-- end column 2 -->
|
||||
</td><!-- end column 1 -->
|
||||
</tr>
|
||||
<% BLOCK_END();
|
||||
<% BLOCK_END();
|
||||
|
||||
var buttons = [ {title: L("lcl_search"), action: "doSubmit()", id: "bSearch" },
|
||||
{title: L("lcl_obj_advanced"), action: "myModal()", id: "bAdvanced" } ];
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
$Revision$
|
||||
$Id$
|
||||
|
||||
File:
|
||||
Description:
|
||||
Parameters:
|
||||
Context:
|
||||
File:
|
||||
Description:
|
||||
Parameters:
|
||||
Context:
|
||||
Note:
|
||||
*/ %>
|
||||
|
||||
@@ -26,10 +26,6 @@ var reg_key = getQParamInt("regiokey", -1); // Regio
|
||||
var dis_key = getQParamInt("districtkey", -1); // District
|
||||
var loc_key = getQParamInt("locatiekey", -1); // Locatie
|
||||
var loc_code = getQParam("loc_code", ""); // Locatiecode
|
||||
var loc_descr = getQParam("loc_descr", ""); // Locatienaam
|
||||
var mjob = getQParamInt("mjob", 0) == 1; // mjob mode
|
||||
var fitness_score1_from = getQParamInt("fitness_score1_from", -1); // Conditie score van.
|
||||
var fitness_score1_through = getQParamInt("fitness_score1_through", -1); // Conditie score t/m.
|
||||
|
||||
locatie_list ( "*",
|
||||
{ outputmode: outputmode,
|
||||
@@ -37,11 +33,7 @@ locatie_list ( "*",
|
||||
reg_key: (reg_key != -1? reg_key : null),
|
||||
dis_key: (dis_key != -1? dis_key : null),
|
||||
loc_key: (loc_key != -1? loc_key : null),
|
||||
loc_code: loc_code,
|
||||
loc_descr: loc_descr,
|
||||
mjob: mjob,
|
||||
fitness_score1_from : fitness_score1_from,
|
||||
fitness_score1_through : fitness_score1_through,
|
||||
loc_code: loc_code,
|
||||
noref: (noref != -1? noref : null)
|
||||
}
|
||||
);
|
||||
|
||||
@@ -114,19 +114,9 @@ else
|
||||
var insman_read = authparamsINSMAN;
|
||||
if (insman_read)
|
||||
{
|
||||
var page4="../INS/ins_list.asp?embedded=1&tiny=1&inacObjIncl=1&ruimtekey=" + room_key
|
||||
var page4="../INS/ins_list.asp?embedded=1&tiny=1&ruimtekey=" + room_key
|
||||
IFRAMER("insdeel", page4, { initHeight: "450px" } );
|
||||
}
|
||||
var authparamsCNTUSE = user.checkAutorisation("WEB_CNTUSE", true);
|
||||
var authparamsCNTMAN = user.checkAutorisation("WEB_CNTMAN", true);
|
||||
var curole = "bo";
|
||||
if (!authparamsCNTMAN && authparamsCNTUSE)
|
||||
curole = "fe";
|
||||
if (authparamsCNTMAN || authparamsCNTUSE)
|
||||
{
|
||||
var page5="../cnt/cnt_search_list.asp?embedded=1&tiny=1&collapsed=1&urole=" + curole + "&ffutu=1&fact=1&frap=1&fopz=1&sact=1&room_key="+ room_key
|
||||
IFRAMER("cntFrame", page5, { initHide: true } );
|
||||
}
|
||||
}
|
||||
%>
|
||||
</body>
|
||||
|
||||
@@ -223,7 +223,7 @@ function ruimte_list(pautfunction, params)
|
||||
{
|
||||
if (!floorCache[oRs("alg_verdieping_key").Value])
|
||||
{
|
||||
eEditMulti = false; // TODO: write op ALGMAN
|
||||
eEditMulti = true;
|
||||
floorCache[oRs("alg_verdieping_key").Value] =
|
||||
{
|
||||
eDelete: alg.canWriteVerdieping(oRs("alg_verdieping_key").Value, authparams.rmALGwritelevel),
|
||||
|
||||
@@ -20,7 +20,7 @@ k
|
||||
|
||||
<%
|
||||
FCLTHeader.Requires({ plugins:["jQuery"],
|
||||
js: ["./alg_ruimteafdeling.js" ]
|
||||
js: ["./alg_ruimteafdeling.js", "num2curr.js"]
|
||||
});
|
||||
|
||||
// TODO: Autorisatie controle "WEB_PRSBOF" op ruimte_keys
|
||||
@@ -37,19 +37,8 @@ if (submitting)
|
||||
|
||||
var afdeling_key = -1;
|
||||
var bezetting = -1;
|
||||
var bezettingen = new Array();
|
||||
var afdeling_keys = new Array();
|
||||
var afdeling_names = [];
|
||||
|
||||
function shorttxt(txt, len)
|
||||
{
|
||||
len = len || S("max_tracking_length");
|
||||
if (txt.length < len)
|
||||
return txt;
|
||||
else
|
||||
return txt.substr(0, len-4) + "...";
|
||||
}
|
||||
|
||||
var afdeling_keys = [];
|
||||
var bezetting_keys = [];
|
||||
for (var i = 0; i < nrRows; i++)
|
||||
{
|
||||
afdeling_key = getFParamInt("afd" + i, 0);
|
||||
@@ -58,47 +47,10 @@ if (submitting)
|
||||
if (afdeling_key > 0 && bezetting >= 0)
|
||||
{
|
||||
afdeling_keys.push(afdeling_key);
|
||||
bezettingen.push(bezetting);
|
||||
bezetting_keys.push(bezetting);
|
||||
}
|
||||
}
|
||||
|
||||
if (afdeling_keys.length)
|
||||
{
|
||||
var sql = "SELECT prs_afdeling_key, prs_afdeling_omschrijving"
|
||||
+ " FROM prs_afdeling a"
|
||||
+ " WHERE prs_afdeling_key IN (" + afdeling_keys.join(",") + ")"
|
||||
+ " AND prs_afdeling_verwijder IS NULL";
|
||||
var oRs = Oracle.Execute(sql);
|
||||
while (!oRs.Eof)
|
||||
{
|
||||
afdeling_names[oRs("prs_afdeling_key").value] = oRs("prs_afdeling_omschrijving").value;
|
||||
oRs.MoveNext();
|
||||
}
|
||||
}
|
||||
|
||||
var oldvals = [];
|
||||
var sql = "SELECT ra.alg_ruimte_key, ra.prs_afdeling_key, a.prs_afdeling_omschrijving, ra.prs_ruimteafdeling_bezetting"
|
||||
+ " FROM prs_ruimteafdeling ra, prs_afdeling a"
|
||||
+ " WHERE ra.alg_ruimte_key IN (" + ruimte_key_arr.join(",") + ")"
|
||||
+ " AND ra.prs_afdeling_key = a.prs_afdeling_key"
|
||||
+ " AND ra.prs_ruimteafdeling_verwijder IS NULL"
|
||||
+ " AND a.prs_afdeling_verwijder IS NULL";
|
||||
|
||||
|
||||
var oRs = Oracle.Execute(sql);
|
||||
while (!oRs.Eof)
|
||||
{
|
||||
var tempTuple = { afd_key: oRs("prs_afdeling_key").value, bez: oRs("prs_ruimteafdeling_bezetting").value };
|
||||
if (typeof oldvals[oRs("alg_ruimte_key").value] === 'undefined') // New ruimte
|
||||
oldvals[oRs("alg_ruimte_key").value] = [tempTuple];
|
||||
else
|
||||
oldvals[oRs("alg_ruimte_key").value].push(tempTuple);
|
||||
|
||||
if (typeof afdeling_names[oRs("prs_afdeling_key").value] === 'undefined')
|
||||
afdeling_names[oRs("prs_afdeling_key").value] = oRs("prs_afdeling_omschrijving").value;
|
||||
oRs.MoveNext();
|
||||
}
|
||||
|
||||
for (var j = 0; j < ruimte_key_arr.length; j++)
|
||||
{ // Verwijderen
|
||||
var sql = "DELETE prs_ruimteafdeling"
|
||||
@@ -121,7 +73,7 @@ if (submitting)
|
||||
if (!oRs.eof)
|
||||
{ // Update
|
||||
var sql = "UPDATE prs_ruimteafdeling SET"
|
||||
+ " prs_ruimteafdeling_bezetting = " + bezettingen[i]
|
||||
+ " prs_ruimteafdeling_bezetting = " + bezetting_keys[i]
|
||||
+ " WHERE prs_ruimteafdeling_key = " + oRs("prs_ruimteafdeling_key").Value;
|
||||
Oracle.Execute(sql);
|
||||
}
|
||||
@@ -131,60 +83,11 @@ if (submitting)
|
||||
+ " (alg_ruimte_key, prs_afdeling_key, prs_ruimteafdeling_bezetting)"
|
||||
+ " VALUES (" + ruimte_key_arr[j] + ","
|
||||
+ afdeling_keys[i] + ","
|
||||
+ bezettingen[i] + ")";
|
||||
+ bezetting_keys[i] + ")";
|
||||
Oracle.Execute(sql);
|
||||
}
|
||||
oRs.Close();
|
||||
}
|
||||
}
|
||||
|
||||
var trackingArr = new Object();
|
||||
var fromLbl = "";
|
||||
var toLbl = "";
|
||||
var rowNr = -1;
|
||||
var doneAfdeling = new Array();
|
||||
|
||||
for (var i = 0; i < ruimte_key_arr.length; i++)
|
||||
{
|
||||
if (typeof oldvals[ruimte_key_arr[i]] !== 'undefined')
|
||||
for (var x = 0; x < oldvals[ruimte_key_arr[i]].length; x++)
|
||||
{
|
||||
fromLbl = shorttxt(afdeling_names[oldvals[ruimte_key_arr[i]][x].afd_key]) + " (" + oldvals[ruimte_key_arr[i]][x].bez + "%) ";
|
||||
|
||||
rowNr = sharedIndexOf(oldvals[ruimte_key_arr[i]][x].afd_key, afdeling_keys);
|
||||
if (rowNr > -1) // Update
|
||||
{
|
||||
doneAfdeling[rowNr] = true;
|
||||
if (oldvals[ruimte_key_arr[i]][x].bez == bezettingen[rowNr]) // No change
|
||||
continue;
|
||||
toLbl = " " + shorttxt(afdeling_names[afdeling_keys[rowNr]]) + " (" + bezettingen[rowNr] + "%)";
|
||||
}
|
||||
else // Delete
|
||||
toLbl = " " + L("lcl_tracktoempty");
|
||||
|
||||
if (typeof trackingArr[ruimte_key_arr[i]] === 'undefined')
|
||||
trackingArr[ruimte_key_arr[i]] = new Array();
|
||||
trackingArr[ruimte_key_arr[i]].push(fromLbl + L("lcl_trackto") + toLbl);
|
||||
}
|
||||
|
||||
for (var y = 0; y < afdeling_keys.length; y++)
|
||||
{
|
||||
if (doneAfdeling[y])
|
||||
continue;
|
||||
else if (typeof trackingArr[ruimte_key_arr[i]] === 'undefined')
|
||||
trackingArr[ruimte_key_arr[i]] = new Array();
|
||||
// Insert
|
||||
fromLbl = L("lcl_trackfromempty") + " ";
|
||||
toLbl = " " + shorttxt(afdeling_names[afdeling_keys[y]]) + " (" + bezettingen[y] + "%)";
|
||||
trackingArr[ruimte_key_arr[i]].push(fromLbl + L("lcl_trackto") + toLbl);
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < ruimte_key_arr.length; i++)
|
||||
{
|
||||
if (typeof trackingArr[ruimte_key_arr[i]] !== 'undefined')
|
||||
shared.trackaction("ALGRUP", ruimte_key_arr[i], L("lcl_alg_is_algrup") + "\n" + trackingArr[ruimte_key_arr[i]].join("\n"));
|
||||
}
|
||||
%>
|
||||
<script type="text/javascript">
|
||||
FcltMgr.closeDetail(window, { success: true });
|
||||
|
||||
@@ -83,12 +83,7 @@ function delRow(img)
|
||||
|
||||
function alg_submit()
|
||||
{
|
||||
if ($(document).has('span.bad').length)
|
||||
{
|
||||
FcltMgr.alert(L("lcl_shared_validator_invalid"));
|
||||
return false;
|
||||
}
|
||||
var percValid = true;
|
||||
var percValid = true;
|
||||
var i=0;
|
||||
while (percValid && (i<=rowIndex))
|
||||
{
|
||||
@@ -133,41 +128,49 @@ function alg_add(oppervlak)
|
||||
|
||||
function changeOppervlak(prowIndex)
|
||||
{
|
||||
var $thisObj = $("#bezopp"+prowIndex);
|
||||
var valid = isGoodNumber($thisObj.val(), false,false,8,2);
|
||||
validateField($thisObj, valid, L("lcl_alg_bezetting_ongeldig"))
|
||||
var bereken = true;
|
||||
if (!isGoodNumber($("#bezopp"+prowIndex).val(), false,false,8,2))
|
||||
{
|
||||
bereken = false;
|
||||
FcltMgr.alert(L("lcl_alg_bezetting_ongeldig"));
|
||||
$("#bezopp"+prowIndex).select();
|
||||
$("#bezopp"+prowIndex).focus();
|
||||
}
|
||||
if (bereken && (!isGoodNumber($("#totaalopp"+prowIndex).val(), false,false,8,2)))
|
||||
$("#totaalopp"+prowIndex).val($("#bezopp"+prowIndex).val());
|
||||
|
||||
if (valid)
|
||||
{
|
||||
if (!isGoodNumber($("#totaalopp"+prowIndex).val(), false,false,8,2))
|
||||
$("#totaalopp"+prowIndex).val($thisObj.val());
|
||||
var oppBezet = parseFloat($thisObj.val().replace(',', '.'));
|
||||
var oppBruto = parseFloat($("#totaalopp"+prowIndex).val().replace(',', '.'));
|
||||
if (oppBruto > 0)
|
||||
{
|
||||
var oppPercF = (oppBezet * 100) / oppBruto;
|
||||
var oppPerc = num2currEditable(oppPercF);
|
||||
$("#bez" + prowIndex).val(oppPerc);
|
||||
}
|
||||
}
|
||||
if (bereken)
|
||||
{
|
||||
var oppBezet = parseFloat($("#bezopp" +prowIndex).val().replace(',', '.'));
|
||||
var oppBruto = parseFloat($("#totaalopp"+prowIndex).val().replace(',', '.'));
|
||||
if (oppBruto > 0)
|
||||
{
|
||||
var oppPercF = (oppBezet * 100) / oppBruto;
|
||||
var oppPerc = num2currEditable(oppPercF);
|
||||
$("#bez" + prowIndex).val(oppPerc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function changeBezetting(prowIndex)
|
||||
{
|
||||
var $thisObj = $("#bez"+prowIndex);
|
||||
var valid = isGoodNumber($thisObj.val(), false,false,8,2) &&
|
||||
parseFloat($thisObj.val().replace(',', '.')) <= 100 &&
|
||||
parseFloat($thisObj.val().replace(',', '.')) >= 0;
|
||||
validateField($thisObj, valid, L("lcl_alg_bezetting_ongeldig"));
|
||||
|
||||
if (valid && !multiRuimte)
|
||||
{
|
||||
var oppPerc = parseFloat($thisObj.val().replace(',', '.'));
|
||||
if (isGoodNumber($("#totaalopp"+prowIndex).val(), false,false,8,2))
|
||||
{
|
||||
var oppBruto = parseFloat($("#totaalopp"+prowIndex).val().replace(',', '.'));
|
||||
var oppBezet = num2currEditable( ((oppPerc * oppBruto) / 100) );
|
||||
$("#bezopp" + prowIndex).val(oppBezet);
|
||||
}
|
||||
if (!isGoodNumber($("#bez"+prowIndex).val(), false,false,8,2) || parseFloat($("#bez"+prowIndex).val().replace(',', '.')) > 100)
|
||||
{
|
||||
FcltMgr.alert(L("lcl_alg_bezetting_ongeldig"));
|
||||
$("#bez"+prowIndex).select();
|
||||
$("#bez"+prowIndex).focus();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!multiRuimte)
|
||||
{
|
||||
var oppPerc = parseFloat($("#bez" +prowIndex).val().replace(',', '.'));
|
||||
if (isGoodNumber($("#totaalopp"+prowIndex).val(), false,false,8,2))
|
||||
{
|
||||
var oppBruto = parseFloat($("#totaalopp"+prowIndex).val().replace(',', '.'));
|
||||
var oppBezet = num2currEditable( ((oppPerc * oppBruto) / 100) );
|
||||
$("#bezopp" + prowIndex).val(oppBezet);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,14 +53,13 @@ var bld_x = oRs("alg_gebouw_x").Value;
|
||||
var bld_y = oRs("alg_gebouw_y").Value;
|
||||
var bld_bez = oRs("alg_gebouw_bez").Value;
|
||||
var bld_deleted = oRs("alg_gebouw_verwijder").Value != null;
|
||||
var dienstniveau_key = oRs("mld_dienstniveau_key").Value;
|
||||
var dienstniveau = oRs("mld_dienstniveau_key").Value;
|
||||
var beginuur = oRs("alg_gebouw_beginuur").Value;
|
||||
var einduur = oRs("alg_gebouw_einduur").Value;
|
||||
var werkdagen = oRs("alg_gebouw_werkdagen").Value;
|
||||
var verantw = oRs("prs_perslid_key_verantw").Value;
|
||||
var verantw2 = oRs("prs_perslid_key_verantw2").Value;
|
||||
var vervaldatum = oRs("alg_gebouw_vervaldatum").Value;
|
||||
var geb_score1 = oRs("alg_gebouw_mjb_score1").value;
|
||||
oRs.Close();
|
||||
%>
|
||||
|
||||
@@ -90,9 +89,10 @@ oRs.Close();
|
||||
<% if (S("alg_fg_remote_maps") != "" && bld_x && bld_y) { %>
|
||||
function openMaps(bldKey)
|
||||
{
|
||||
FcltMgr.windowopen('../cad/ShowGoogleMap.asp?bld_key=' + bldKey, 'FGShow',
|
||||
"width=800, height=600, directories=no, location=no, menubar=no,"
|
||||
fwnd = window.open('../cad/ShowGoogleMap.asp?bld_key=' + bldKey, 'FGShow',
|
||||
"width=640, height=480, directories=no, location=no, menubar=no,"
|
||||
+ "resizable=yes, status=no, titlebar=yes, toolbar=no");
|
||||
fwnd.focus()
|
||||
return;
|
||||
}
|
||||
<% } %>
|
||||
@@ -129,7 +129,7 @@ oRs.Close();
|
||||
{ gebouwkey: bld_key,
|
||||
startlevel: 2, //Locatie
|
||||
eindlevel: 3, // Gebouw
|
||||
moreinfo: true, // wel beetje suf om door te linken naar jezelf
|
||||
moreinfo: true,
|
||||
readonly: true
|
||||
});
|
||||
sql = "SELECT alg_srtgebouw_key"
|
||||
@@ -145,11 +145,7 @@ oRs.Close();
|
||||
suppressEmpty: true,
|
||||
readonly: true
|
||||
});
|
||||
params = { infoPointer: { Url: "appl/shared/status_info.asp?bld_key=" + bld_key,
|
||||
Title: L("lcl_status_details") + " " + bld_naam
|
||||
}
|
||||
}
|
||||
ROFIELDTR("fld", L("lcl_estate_gebouw_man_code"), bld_code, params);
|
||||
ROFIELDTR("fld", L("lcl_estate_gebouw_man_code"), bld_code, {suppressEmpty:true});
|
||||
ROFIELDTR("fld", L("lcl_estate_gebouw_man_opmerk"), bld_opmerk, {suppressEmpty:true});
|
||||
sql = "SELECT prs_kostenplaats_key"
|
||||
+ " , k.prs_kostenplaats_nr || ' ' || k.prs_kostenplaats_omschrijving"
|
||||
@@ -165,12 +161,12 @@ oRs.Close();
|
||||
readonly: true
|
||||
});
|
||||
ROFIELDTR("fld", L("lcl_estate_gebouw_ordernr"), bld_ordrnr, {suppressEmpty:true});
|
||||
if (dienstniveau_key)
|
||||
if (dienstniveau)
|
||||
{
|
||||
sql = "SELECT mld_dienstniveau_key"
|
||||
+ " , " + lcl.xsqla("mld_dienstniveau_omschr", "mld_dienstniveau_key")
|
||||
+ " FROM mld_dienstniveau"
|
||||
+ " WHERE mld_dienstniveau_key = " + dienstniveau_key;
|
||||
+ " WHERE mld_dienstniveau_key = " + dienstniveau;
|
||||
oRs = Oracle.Execute(sql);
|
||||
ROFIELDTR("fld", L("lcl_mld_dienst_niveau"), oRs("mld_dienstniveau_omschr").value);
|
||||
oRs.Close();
|
||||
@@ -223,7 +219,6 @@ oRs.Close();
|
||||
ROFIELDTR("fld", L("lcl_estate_gebouw_beginuur"), toTimeString(beginuur), {suppressEmpty:true} );
|
||||
ROFIELDTR("fld", L("lcl_estate_gebouw_einduur"), toTimeString(einduur), {suppressEmpty:true} );
|
||||
ROCHECKBOXTR("fldalgwerk", L("lcl_estate_gebouw_werkdagen"), werkdagen==1);
|
||||
ROFIELDTR("fld", "Conditie score", geb_score1, {suppressEmpty: true}); // L("lcl_alg_locatie_mjb_score1")
|
||||
BLOCK_END();
|
||||
|
||||
generateFlexKenmerkBlock ({ onrgoed_key : bld_key,
|
||||
|
||||
@@ -40,14 +40,13 @@ var loc_vwtel = oRs("alg_locatie_verantw_tel").value;
|
||||
var loc_x = oRs("alg_locatie_x").value;
|
||||
var loc_y = oRs("alg_locatie_y").value;
|
||||
var loc_mail = oRs("alg_locatie_email").value;
|
||||
var loc_score1 = oRs("alg_locatie_mjb_score1").value;
|
||||
var pst_adres = oRs("alg_locatie_post_adres").value;
|
||||
var pst_postc = oRs("alg_locatie_post_postcode").value;
|
||||
var pst_adres = oRs("alg_locatie_post_adres").value;
|
||||
var pst_plaats = oRs("alg_locatie_post_plaats").value;
|
||||
var pst_land = oRs("alg_locatie_post_land").value;
|
||||
var loc_deleted = oRs("alg_locatie_verwijder").value != null;
|
||||
var dienstniveau_key = oRs("mld_dienstniveau_key").value;
|
||||
var dienstniveau = oRs("mld_dienstniveau_key").value;
|
||||
oRs.Close();
|
||||
%>
|
||||
<html>
|
||||
@@ -87,9 +86,10 @@ oRs.Close();
|
||||
<% if (S("alg_fg_remote_maps") != "" && loc_x && loc_y) { %>
|
||||
function openMaps(locKey)
|
||||
{
|
||||
FcltMgr.windowopen('../cad/ShowGoogleMap.asp?loc_key=' + locKey, 'FGShow',
|
||||
"width=800, height=600, directories=no, location=no, menubar=no,"
|
||||
fwnd = window.open('../cad/ShowGoogleMap.asp?loc_key=' + locKey, 'FGShow',
|
||||
"width=640, height=480, directories=no, location=no, menubar=no,"
|
||||
+ "resizable=yes, status=no, titlebar=yes, toolbar=no");
|
||||
fwnd.focus()
|
||||
return;
|
||||
}
|
||||
<% } %>
|
||||
@@ -133,12 +133,12 @@ oRs.Close();
|
||||
ROFIELDTR("fld", L("lcl_prs_address_bezoek_postcode"), bez_postc, {suppressEmpty: true});
|
||||
ROFIELDTR("fld", L("lcl_prs_address_bezoek_plaats"), bez_plaats, {suppressEmpty: true});
|
||||
ROFIELDTR("fld", L("lcl_prs_address_bezoek_land"), bez_land, {suppressEmpty: true});
|
||||
if (dienstniveau_key)
|
||||
if (dienstniveau)
|
||||
{
|
||||
sql = "SELECT mld_dienstniveau_key, "
|
||||
+ lcl.xsqla("mld_dienstniveau_omschr", "mld_dienstniveau_key")
|
||||
+ " FROM mld_dienstniveau "
|
||||
+ " WHERE mld_dienstniveau_key = " + dienstniveau_key;
|
||||
+ " WHERE mld_dienstniveau_key = " + dienstniveau;
|
||||
oRs = Oracle.Execute(sql);
|
||||
ROFIELDTR("fld", L("lcl_mld_dienst_niveau"), oRs("mld_dienstniveau_omschr").value);
|
||||
oRs.Close();
|
||||
@@ -156,7 +156,6 @@ oRs.Close();
|
||||
ROFIELDTR("fld", L("lcl_estate_locatie_man_verantw"), loc_vw, {suppressEmpty: true});
|
||||
ROFIELDTR("fld", L("lcl_estate_locatie_man_verantw_tel"), loc_vwtel, {suppressEmpty: true});
|
||||
AFIELDTR('fldmailto details', L("lcl_noti_email"), "mailto:" + loc_mail, loc_mail, { suppressEmpty: true });
|
||||
ROFIELDTR("fld", "Conditie score", loc_score1, {suppressEmpty: true}); // L("lcl_alg_locatie_mjb_score1")
|
||||
|
||||
BLOCK_END();
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ var flr_omschr = oRs("alg_verdieping_omschrijving").value;
|
||||
var flr_volgnr = oRs("alg_verdieping_volgnr").value;
|
||||
var flr_code = oRs("alg_verdieping_code").value;
|
||||
var flr_deleted = oRs("alg_verdieping_verwijder").value != null;
|
||||
var dienstniveau_key = oRs("mld_dienstniveau_key").value;
|
||||
var dienstniveau = oRs("mld_dienstniveau_key").value;
|
||||
oRs.Close();
|
||||
%>
|
||||
|
||||
@@ -96,12 +96,12 @@ oRs.Close();
|
||||
|
||||
ROFIELDTR("fld", L("lcl_estate_verdieping_man_code"), flr_code);
|
||||
ROFIELDTR("fld", L("lcl_estate_verdieping_man_volgnr"), flr_volgnr);
|
||||
if (dienstniveau_key)
|
||||
if (dienstniveau)
|
||||
{
|
||||
sql = "SELECT mld_dienstniveau_key, "
|
||||
+ lcl.xsqla("mld_dienstniveau_omschr", "mld_dienstniveau_key")
|
||||
+ " FROM mld_dienstniveau "
|
||||
+ " WHERE mld_dienstniveau_key = " + dienstniveau_key;
|
||||
+ " WHERE mld_dienstniveau_key = " + dienstniveau;
|
||||
oRs = Oracle.Execute(sql);
|
||||
ROFIELDTR("fld", L("lcl_mld_dienst_niveau"), oRs("mld_dienstniveau_omschr").value);
|
||||
oRs.Close();
|
||||
|
||||
@@ -289,7 +289,7 @@ else if (srtruimte_key > 0 && mode == "delete")
|
||||
target="hidFrameSubmit"
|
||||
onSubmit="alg_submit()">
|
||||
<%
|
||||
BLOCK_START("algInfo", L("lcl_general_properties"));
|
||||
BLOCK_START("algInfo", safe.html(L("lcl_general_properties")));
|
||||
|
||||
ROFIELDTR( "fld", L("lcl_key"), srtruimte_key);
|
||||
myFIELD("omschrijving", "fld", L("lcl_descr"), srtr_info.alg_srtruimte_omschrijving, { translate: {fld: "mld_afmeldtekst_naam", key: srtruimte_key} });
|
||||
@@ -314,8 +314,8 @@ else if (srtruimte_key > 0 && mode == "delete")
|
||||
disable: !srtr_info.tijd_uitvoertijd
|
||||
}
|
||||
}
|
||||
myFIELD("uitvoertijd", "fldalg_uitvtijd", L("lcl_mld_stduitvoertijd"), srtr_info.tijd_uitvoertijd? Math.round(srtr_info.tijd_uitvoertijd * 100000) / 100000 : ""
|
||||
, {maxlength: 8, datatype: "float", html: "onChange='onChangeUitvoertijd();'", suppressEmpty: true, selector: selectparams});
|
||||
myFIELD("uitvoertijd", "fldalg_uitvtijd", L("lcl_mld_stduitvoertijd"), srtr_info.tijd_uitvoertijd? Math.round(srtr_info.tijd_uitvoertijd * 100) / 100 : ""
|
||||
, {maxlength: 4, datatype: "float", html: "onChange='onChangeUitvoertijd();'", suppressEmpty: true, selector: selectparams});
|
||||
|
||||
BLOCK_END();
|
||||
|
||||
|
||||
@@ -76,26 +76,15 @@ else
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<% if (flr_key == -1)
|
||||
<% if (flr_key == -1)
|
||||
var page="alg_edit_verdieping.asp"; // Maak een nieuw
|
||||
else
|
||||
else
|
||||
var page="alg_show_verdieping.asp";
|
||||
page += "?flr_key="+flr_key;
|
||||
page += "?flr_key="+flr_key;
|
||||
|
||||
IFRAMER("algFrame", page, { title: L("lcl_alg_verdieping_frame"),
|
||||
IFRAMER("algFrame", page, { title: L("lcl_alg_verdieping_frame"),
|
||||
initHeight: "450px",
|
||||
FcltClose: "algClose" } );
|
||||
|
||||
var authparamsCNTUSE = user.checkAutorisation("WEB_CNTUSE", true);
|
||||
var authparamsCNTMAN = user.checkAutorisation("WEB_CNTMAN", true);
|
||||
var curole = "bo";
|
||||
if (!authparamsCNTMAN && authparamsCNTUSE)
|
||||
curole = "fe";
|
||||
if (authparamsCNTMAN || authparamsCNTUSE)
|
||||
{
|
||||
var page2="../cnt/cnt_search_list.asp?embedded=1&tiny=1&collapsed=1&urole=" + curole + "&ffutu=1&fact=1&frap=1&fopz=1&sact=1&flr_key="+ flr_key
|
||||
IFRAMER("cntFrame", page2, { initHide: true } );
|
||||
}
|
||||
%>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
1
APPL/API/.gitignore
vendored
1
APPL/API/.gitignore
vendored
@@ -1 +0,0 @@
|
||||
TESTER
|
||||
@@ -59,13 +59,9 @@ function API_func()
|
||||
loglevel: oRs("fac_api_loglevel").Value,
|
||||
usrrap_key: oRs("fac_usrrap_key").Value,
|
||||
stylesheet: oRs("fac_api_stylesheet").Value,
|
||||
stylesheet_out: oRs("fac_api_stylesheet_out").Value,
|
||||
import_app_key: oRs("fac_import_app_key").Value
|
||||
};
|
||||
|
||||
if (this.apidata.loglevel > 1) // Zet maar op 3 als je HTML logging wilt
|
||||
__Logging = this.apidata.loglevel || __Logging || 0; // Voor de rest van dit bestand
|
||||
|
||||
try
|
||||
{
|
||||
this.apidata.options = eval("("+oRs("fac_api_options_json").Value+")");
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
LCL_Disable = 1
|
||||
THIS_FILE = "appl/api/api_soap.asp";
|
||||
|
||||
// __Logging = 1;
|
||||
// Session("logging")=1;
|
||||
%>
|
||||
<!-- #include file="../Shared/common.inc" -->
|
||||
<!-- #include file="../Shared/xml_converter.inc" -->
|
||||
@@ -55,15 +55,6 @@ try
|
||||
|
||||
var xmlReq = Server.CreateObject("MSXML2.DOMDocument.6.0");
|
||||
xmlReq.load(Request);
|
||||
if (xmlReq.parseError.errorCode != 0)
|
||||
{
|
||||
__DoLog( "Error loading XML: "
|
||||
+ xmlReq.parseError.errorCode
|
||||
+ "\n" + xmlReq.parseError.reason
|
||||
+ " regel " + xmlReq.parseError.line
|
||||
+ "(" + xmlReq.parseError.linepos + ")"
|
||||
, "#ff0000");
|
||||
}
|
||||
|
||||
if (API.apidata.loglevel) __Log2File(xmlReq.xml, API.APIname + "_IN");
|
||||
|
||||
|
||||
@@ -41,6 +41,8 @@
|
||||
ts.Close();
|
||||
}
|
||||
|
||||
Session("logging") = API.apidata.loglevel||0;
|
||||
|
||||
var xmlReq = Server.CreateObject("MSXML2.DOMDocument.6.0");
|
||||
xmlReq.load(Request);
|
||||
|
||||
|
||||
@@ -405,7 +405,6 @@
|
||||
|
||||
xmlResp.appendChild(FCLTElement);
|
||||
|
||||
Response.ContentType = "text/xml";
|
||||
if (API.apidata.stylesheet)
|
||||
{
|
||||
// Niet super efficient dat we eerst naar tekstuele xml gaan maar ach...
|
||||
@@ -413,6 +412,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
Response.ContentType = "text/xml";
|
||||
Response.Write(xmlResp.xml)
|
||||
}
|
||||
%>
|
||||
|
||||
@@ -122,7 +122,6 @@
|
||||
|
||||
var bes_info = bes.bestelling_info(bes_bestelling_key); // Globale variabele met alle bes_bestelling informatie
|
||||
var this_bes = bes.func_enabled_bestelling(bes_info); // Wat heb ik zoal aan rechten op deze specifieke reservering
|
||||
var bes_disc_info = bes.disc_info(bes_info.dis_key); // alle discipline informatie
|
||||
if(!this_bes.canChange) {
|
||||
resultcode = 9;
|
||||
resulttekst = "Niet geautoriseerd voor bestelling "+besid;
|
||||
@@ -130,10 +129,8 @@
|
||||
else {
|
||||
if (nwStatus != null) { // Bij update optioneel
|
||||
// statusdiagram afdwingen:
|
||||
// * BESFIT alleen vanuit status 2 als bes_disc_info.disc_params_fiatflow == 0.
|
||||
// vanuit sattus 4 als bes_disc_info.disc_params_fiatflow == 1.
|
||||
// * BESREJ alleen vanuit status 2 en 3 als bes_disc_info.disc_params_fiatflow == 0.
|
||||
// vanuit status 2 en 4 als bes_disc_info.disc_params_fiatflow == 1.
|
||||
// * BESFIT alleen vanuit status 2
|
||||
// * BESREJ alleen vanuit status 2 en 3
|
||||
sql = "SELECT bes_bestelling_status"
|
||||
+ " FROM bes_bestelling"
|
||||
+ " WHERE bes_bestelling_key="+bestelling_key;
|
||||
@@ -142,12 +139,9 @@
|
||||
curStatus = oRs("bes_bestelling_status").value;
|
||||
|
||||
// Feitelijke UPDATE status.
|
||||
// BESFIT: alleen vanuit status 2 als bes_disc_info.disc_params_fiatflow == 0.
|
||||
// vanuit sattus 4 als bes_disc_info.disc_params_fiatflow == 1.
|
||||
// BESFIT: alleen vanuit status 2
|
||||
if (nwStatus == "BESFIT") {
|
||||
if ((bes_disc_info.disc_params_fiatflow == 0 && curStatus == 2) ||
|
||||
(bes_disc_info.disc_params_fiatflow == 1 && curStatus == 4))
|
||||
{
|
||||
if (curStatus == 2) {
|
||||
bes.setbestellingstatus(bes_bestelling_key, 3); // Gefiatteerd
|
||||
sql = "SELECT bes_bestelling_status"
|
||||
+ " FROM bes_bestelling"
|
||||
@@ -178,12 +172,9 @@
|
||||
resultcode = 305;
|
||||
}
|
||||
}
|
||||
// BESREJ: alleen vanuit status 2 en 3 als bes_disc_info.disc_params_fiatflow == 0.
|
||||
// vanuit status 2 en 4 als bes_disc_info.disc_params_fiatflow == 1.
|
||||
// BESREJ: alleen vanuit status 2 en 3
|
||||
else if (nwStatus == "BESREJ") {
|
||||
if ((bes_disc_info.disc_params_fiatflow == 0 && (curStatus == 2 || curStatus == 3)) ||
|
||||
(bes_disc_info.disc_params_fiatflow == 1 && (curStatus == 2 || curStatus == 4)))
|
||||
{
|
||||
if (curStatus == 2 || curStatus == 3) {
|
||||
bes.setbestellingstatus(bes_bestelling_key, 1); // Afgewezen
|
||||
sql = "SELECT bes_bestelling_status"
|
||||
+ " FROM bes_bestelling"
|
||||
|
||||
@@ -25,16 +25,7 @@ var API = new API_func();
|
||||
// TODO checkAuthorization("WEB_PUOxxx") ?
|
||||
|
||||
var flexcode = getQParam("flexcode");
|
||||
if (flexcode.match(/^M=CAD/))
|
||||
{
|
||||
// <xsl:element name="img">
|
||||
// <xsl:attribute name="frc">M=CAD&labelPos=2&vKey=<xsl:value-of select="//afspraak/plaats/regio/district/locatie/gebouw/verdieping/key"/>&highlight=<xsl:value-of select="//afspraak/plaats/regio/district/locatie/gebouw/verdieping/ruimte/key"/>&mode=0&discs=981&sizeX=700&sizeY=400&offsetX=10&offsetY=10&scale=950&paperColor=16777215
|
||||
// </xsl:attribute>
|
||||
// </xsl:element>
|
||||
Server.Transfer(rooturl + "/APPL/CAD/mySlnk2IMG.asp"); // Die kan het ook wel oplossen
|
||||
}
|
||||
|
||||
// Else gewone flexfiles
|
||||
var props = flexProps2(flexcode);
|
||||
|
||||
__Log(props);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<%@ language = "JavaScript" %>
|
||||
<% Server.ScriptTimeout=6000; %>
|
||||
<% /*
|
||||
$Revision$
|
||||
$Id$
|
||||
@@ -18,7 +17,6 @@
|
||||
<!-- #include file="../../appl/Shared/common.inc" -->
|
||||
<!-- #include file="../../appl/api/api.inc" -->
|
||||
<!-- #include file="../../appl/shared/FlexFiles.inc" -->
|
||||
<!-- #include file="../Shared/xml_converter.inc" -->
|
||||
<script language="javascript" src="../imp/imp_shared.js" runat="server"></script>
|
||||
<%
|
||||
// We sturen het antwoord in UTF-8.
|
||||
@@ -121,12 +119,5 @@
|
||||
xmlResp.appendChild(FCLTElement);
|
||||
|
||||
Response.ContentType = "text/xml";
|
||||
if (API.apidata.stylesheet_out)
|
||||
{
|
||||
var params = {};
|
||||
STR2Stream(xmlResp.xml, API.apidata.stylesheet_out, Response, params);
|
||||
}
|
||||
else
|
||||
Response.Write(xmlResp.xml);
|
||||
|
||||
Response.Write(xmlResp.xml);
|
||||
%>
|
||||
|
||||
@@ -258,7 +258,6 @@
|
||||
if (API.apidata.stylesheet)
|
||||
{
|
||||
// Niet super efficient dat we eerst naar tekstuele xml gaan maar ach...
|
||||
Response.ContentType = "text/xml";
|
||||
STR2Stream(xmlResp.xml, API.apidata.stylesheet, Response, {});
|
||||
}
|
||||
else
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
THIS_FILE = "appl/api/api_mldsoap.asp";
|
||||
%>
|
||||
<!-- #include file="../Shared/common.inc" -->
|
||||
<!-- #include file="../Shared/kenmerk_common.inc" -->
|
||||
<!-- #include file="../Shared/xml_converter.inc" -->
|
||||
<!-- #include file="../Shared/save2db.inc" -->
|
||||
<!-- #include file="../Shared/flexfiles.inc" -->
|
||||
@@ -39,31 +38,18 @@ var xmlReq = Server.CreateObject("MSXML2.DOMDocument.6.0");
|
||||
if (API.apidata.stylesheet)
|
||||
{
|
||||
var iXsl = Server.CreateObject("MSXML2.DOMDocument.6.0");
|
||||
iXsl.resolveExternals = true; // XSL kan includes hebben
|
||||
if( ! iXsl.load(Server.MapPath(API.apidata.stylesheet)) )
|
||||
{
|
||||
API.error("Could not load XSL " + API.apidata.stylesheet + "\n" + iXsl.parseError.reason);
|
||||
}
|
||||
var inputXML = Server.CreateObject("MSXML2.DOMDocument.6.0");
|
||||
inputXML.load(Request);
|
||||
|
||||
if (inputXML.parseError.errorCode != 0)
|
||||
{
|
||||
__DoLog( "Error loading XML: "
|
||||
+ inputXML.parseError.errorCode
|
||||
+ "\n" + inputXML.parseError.reason
|
||||
+ " regel " + inputXML.parseError.line
|
||||
+ "(" + inputXML.parseError.linepos + ")"
|
||||
, "#ff0000");
|
||||
}
|
||||
if (API.apidata.loglevel) __Log2File(inputXML.xml, API.APIname + "_IN");
|
||||
|
||||
inputXML.transformNodeToObject(iXsl, xmlReq);
|
||||
}
|
||||
else
|
||||
xmlReq.load(Request);
|
||||
|
||||
if (API.apidata.loglevel) __Log2File(xmlReq.xml, API.APIname + "_TUSSEN");
|
||||
if (API.apidata.loglevel) __Log2File(xmlReq.xml, API.APIname + "_IN");
|
||||
|
||||
var xmlResp = new ActiveXObject("MSXML2.DOMDocument.6.0");
|
||||
xmlResp.appendChild(xmlResp.createProcessingInstruction("xml", "version=\"1.0\" encoding=\"utf-8\""))
|
||||
@@ -100,7 +86,6 @@ var meldingen = xmlReq.getElementsByTagName("melding");
|
||||
for (i = 0; i < meldingen.length; i++)
|
||||
{
|
||||
resultcode = -1;
|
||||
resulttekst = "";
|
||||
// Lees per node de (optionele) tags en waarden.
|
||||
var fields = []; // Bij te werken velden.
|
||||
var ext_id = meldingen[i].getAttribute("key");
|
||||
@@ -120,10 +105,7 @@ for (i = 0; i < meldingen.length; i++)
|
||||
var meldrnr = XMLval(meldingen[i], "ruimtecode");
|
||||
var locatie_key = -1; // Bepaald op basis van meldloc
|
||||
var plaats_key = -1; // Bepaald op basis van meldgeb/meldver/meldrnr
|
||||
var meld_kpn = XMLval(meldingen[i], "kostenplaats");
|
||||
var meld_oms = XMLval(meldingen[i], "omschrijving");
|
||||
var meld_opm = XMLval(meldingen[i], "opmerking");
|
||||
|
||||
//var mldkenmerken = (meldingen[i].getElementsByTagName("kenmerk"))[0].childNodes[0].nodeValue; // Unsupported yet
|
||||
var mldkenmerken = meldingen[i].getElementsByTagName("kenmerk");
|
||||
var mld_key = -1; // Bepaald na insert
|
||||
@@ -140,7 +122,7 @@ for (i = 0; i < meldingen.length; i++)
|
||||
var oRs = Oracle.Execute(tsql);
|
||||
if (oRs("aantal").value == 1)
|
||||
{
|
||||
mld_key = oRs("mld_melding_key").value;
|
||||
mld_key = oRs("mld_melding_key").value
|
||||
meldaction = "update";
|
||||
}
|
||||
else
|
||||
@@ -148,34 +130,28 @@ for (i = 0; i < meldingen.length; i++)
|
||||
meldaction = "insert";
|
||||
}
|
||||
}
|
||||
else if (meldaction == "update")
|
||||
{
|
||||
// Kijk of er een melding bestaat met dit externe nummer.
|
||||
// Ben je bang dat het nummer vaker voorkomt dan kun je deze prefixen in de xsl
|
||||
tsql = "SELECT MIN(mld_melding_key) mld_melding_key, COUNT(*) aantal"
|
||||
+ " FROM mld_melding"
|
||||
+ " WHERE mld_melding_externnr ="+ safe.quoted_sql(ext_id);
|
||||
var oRs = Oracle.Execute(tsql);
|
||||
if (oRs("aantal").value == 1)
|
||||
{
|
||||
mld_key = oRs("mld_melding_key").value;
|
||||
}
|
||||
}
|
||||
|
||||
if (ext_id == null)
|
||||
{
|
||||
resultcode = 1;
|
||||
resulttekst = "Undefined external ID (key)";
|
||||
}
|
||||
else if (meldaction != "insert" && meldaction != "update")
|
||||
else if (meldaction == 'update')
|
||||
{
|
||||
resultcode = 0;
|
||||
// verder nog even kijken wat we willen doen.
|
||||
// in ieder geval de omschrijving aanpassen
|
||||
fields.push({ dbs: "mld_melding_omschrijving", typ: "varchar", val: meld_oms, track: L("lcl_mld_inf_Omschrijving"), len: 4000 });
|
||||
var mldUpd = buildTrackingUpdate("mld_melding", "mld_melding_key = " + mld_key, fields, { noValidateToken: true });
|
||||
Oracle.Execute(mldUpd.sql);
|
||||
}
|
||||
else if (meldaction != 'insert')
|
||||
{
|
||||
resultcode = 2;
|
||||
resulttekst = "Undefined operation (type)";
|
||||
}
|
||||
else
|
||||
{
|
||||
// voor zowel insert als update:
|
||||
|
||||
var voor_key = -1;
|
||||
var perslid_key = -1;
|
||||
if (voor_login != null)
|
||||
@@ -218,261 +194,279 @@ for (i = 0; i < meldingen.length; i++)
|
||||
perslid_key = voor_key;
|
||||
}
|
||||
}
|
||||
// einde gezamelijke data (insert && update)
|
||||
if (meldaction == "update")
|
||||
|
||||
tsql = "SELECT 1"
|
||||
+ " FROM mld_stdmelding sm"
|
||||
+ " WHERE sm.mld_stdmelding_key = " + stdmld_key
|
||||
+ " AND sm.mld_stdmelding_verwijder IS NULL";
|
||||
var oRs = Oracle.Execute(tsql);
|
||||
if (oRs.eof)
|
||||
{
|
||||
if (mld_key == -1)
|
||||
resultcode = 3;
|
||||
resulttekst = "Undefined stdmelding";
|
||||
}
|
||||
else
|
||||
{ // Hier heb ik een geldige mld_stdmelding_key.
|
||||
var stdm_info = mld.mld_stdmeldinginfo(stdmld_key);
|
||||
|
||||
var stdmld_sla_tijdsduur = stdm_info.prioriteiten[3].uitvoertijd;
|
||||
var stdmld_sla_eenheid = stdm_info.prioriteiten[3].eenheid;
|
||||
var stdmld_niveau = stdm_info.alg_onrgoed_niveau; // required niveau
|
||||
var alglevel_ok = !stdm_info.ins_srtdiscipline_alg || !stdmld_niveau; // Zonder niveau altijd goed
|
||||
|
||||
fields.push({ dbs: "mld_stdmelding_key", typ: "key", val: stdmld_key });
|
||||
fields.push({ dbs: "mld_melding_t_uitvoertijd.tijdsduur", typ: "number", val: stdmld_sla_tijdsduur, obj: "MLD_T_UITVOERTIJD" });
|
||||
fields.push({ dbs: "mld_melding_t_uitvoertijd.eenheid", typ: "varchar", val: stdmld_sla_eenheid, obj: "MLD_T_UITVOERTIJD" });
|
||||
if (melddatum != null)
|
||||
{
|
||||
resultcode = 4;
|
||||
resulttekst = "Undefined melding_key";
|
||||
try
|
||||
{
|
||||
var meldaanmaakdate = XMLtoJsDate(melddatum);
|
||||
fields.push({ dbs: "mld_melding_datum", typ: "datetime", val: meldaanmaakdate });
|
||||
}
|
||||
catch (e)
|
||||
{ // Verkeerde datum-formaat, volgens spec. dan now gebruiken!
|
||||
__DoLog("Formaat ontvangen XML-datum incorrect: "+ melddatum, "#00FF00");
|
||||
meldaanmaakdate = now;
|
||||
fields.push({ dbs: "mld_melding_datum", typ: "datetime", val: meldaanmaakdate });
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (einddatum != null)
|
||||
{
|
||||
var mld_datum;
|
||||
tsql = "SELECT mld_melding_datum"
|
||||
+ " , mld_stdmelding_key"
|
||||
+ " FROM mld_melding"
|
||||
+ " WHERE mld_melding_key = " + mld_key;
|
||||
oRs = Oracle.Execute(tsql);
|
||||
if (!oRs.EOF)
|
||||
{
|
||||
mld_datum = oRs("mld_melding_datum").value;
|
||||
stdmld_key = oRs("mld_stdmelding_key").value; // overwrite de xml-node
|
||||
}
|
||||
oRs.Close();
|
||||
|
||||
try
|
||||
{
|
||||
var meldeinddate = XMLtoJsDate(einddatum);
|
||||
if (meldeinddate > mld_datum)
|
||||
{
|
||||
fields.push({ dbs: "mld_melding_einddatum", typ: "datetime", val: meldeinddate, track: L("lcl_mld_enddate") });
|
||||
}
|
||||
else
|
||||
{
|
||||
// Ontvangen XML-einddatum voor begindatum, dan later volgens SLA zetten!
|
||||
__DoLog("Ontvangen XML-einddatum voor begindatum: "+ einddatum, "#00FF00");
|
||||
}
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
// Verkeerde datum-formaat, dan later volgens SLA zetten!
|
||||
__DoLog("Formaat ontvangen XML-einddatum incorrect: "+ einddatum, "#00FF00");
|
||||
}
|
||||
}
|
||||
|
||||
if (meld_kpn && meld_kpn != "")
|
||||
{
|
||||
var kpn_key = getKpn(meld_kpn);
|
||||
if (kpn_key != -1)
|
||||
fields.push({ dbs: "prs_kostenplaats_key", typ: "key", val: kpn_key, track: L("lcl_mld_inf_Kostenplaats"), foreign: "prs_kostenplaats"});
|
||||
}
|
||||
|
||||
if (meld_opm)
|
||||
fields.push({ dbs: "mld_melding_opmerking", typ: "varchar", val: meld_opm, track: L("lcl_mld_inf_Opmerking"), len: 4000 });
|
||||
|
||||
if (meld_oms)
|
||||
fields.push({ dbs: "mld_melding_omschrijving", typ: "varchar", val: meld_oms, track: L("lcl_mld_inf_Omschrijving"), len: 4000 });
|
||||
|
||||
if (fields.length>0)
|
||||
{
|
||||
var mldUpd = buildTrackingUpdate("mld_melding", "mld_melding_key = " + mld_key, fields, { noValidateToken: true });
|
||||
Oracle.Execute(mldUpd.sql);
|
||||
mld.trackmeldingupdate(mld_key, L("lcl_mld_is_updatedbysoap").format(mld_key) + "\n" + mldUpd.trackarray.join("\n"));
|
||||
}
|
||||
|
||||
// De kenmerken.
|
||||
upsertKenmerk(mldkenmerken, stdmld_key, mld_key);
|
||||
fields.push({ dbs: "mld_melding_datum", typ: "datetime", val: now });
|
||||
}
|
||||
// De einddatum is de meegegeven einddatum, maar als die niet wordt meegegeven is het
|
||||
// gewoon enddate_std en dat regelt de trigger wel, dus DAN MOET IK HEM NIET MEEGEVEN
|
||||
if (einddatum != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
var meldeinddate = XMLtoJsDate(einddatum);
|
||||
if (meldeinddate > meldaanmaakdate)
|
||||
{
|
||||
fields.push({ dbs: "mld_melding_einddatum", typ: "datetime", val: meldeinddate });
|
||||
}
|
||||
else
|
||||
{
|
||||
// Ontvangen XML-einddatum voor begindatum, dan later volgens SLA zetten!
|
||||
__DoLog("Ontvangen XML-einddatum voor begindatum: "+ einddatum, "#00FF00");
|
||||
}
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
// Verkeerde datum-formaat, dan later volgens SLA zetten!
|
||||
__DoLog("Formaat ontvangen XML-einddatum incorrect: "+ einddatum, "#00FF00");
|
||||
}
|
||||
}
|
||||
resultcode = 0; // Ik heb gedaan wat ik moest en mocht doen voor deze melding.
|
||||
} // einde update
|
||||
else if (meldaction == "insert")
|
||||
{
|
||||
|
||||
tsql = "SELECT 1"
|
||||
+ " FROM mld_stdmelding sm"
|
||||
+ " WHERE sm.mld_stdmelding_key = " + (stdmld_key || -1)
|
||||
+ " AND sm.mld_stdmelding_verwijder IS NULL";
|
||||
tsql = "SELECT alg_locatie_key "
|
||||
+ " FROM alg_v_aanweziglocatie"
|
||||
+ " WHERE alg_locatie_code="+ safe.quoted_sql(meldloc);
|
||||
var oRs = Oracle.Execute(tsql);
|
||||
if (oRs.eof)
|
||||
if (!oRs.eof)
|
||||
{
|
||||
resultcode = 3;
|
||||
resulttekst = "Undefined stdmelding";
|
||||
}
|
||||
else
|
||||
{ // vanaf hier heb ik een geldige stdmld_key
|
||||
alglevel_ok = alglevel_ok || stdmld_niveau == "L";
|
||||
locatie_key = oRs("alg_locatie_key").value;
|
||||
fields.push({ dbs: "mld_alg_locatie_key", typ: "key", val: locatie_key });
|
||||
|
||||
var stdm_info = mld.mld_stdmeldinginfo(stdmld_key);
|
||||
|
||||
var stdmld_sla_tijdsduur = stdm_info.prioriteiten[3].uitvoertijd;
|
||||
var stdmld_sla_eenheid = stdm_info.prioriteiten[3].eenheid;
|
||||
var stdmld_niveau = stdm_info.alg_onrgoed_niveau; // required niveau
|
||||
var alglevel_ok = !stdm_info.ins_srtdiscipline_alg || !stdmld_niveau; // Zonder niveau altijd goed
|
||||
|
||||
fields.push({ dbs: "mld_stdmelding_key", typ: "key", val: stdmld_key });
|
||||
fields.push({ dbs: "mld_melding_t_uitvoertijd.tijdsduur", typ: "number", val: stdmld_sla_tijdsduur, obj: "MLD_T_UITVOERTIJD" });
|
||||
fields.push({ dbs: "mld_melding_t_uitvoertijd.eenheid", typ: "varchar", val: stdmld_sla_eenheid, obj: "MLD_T_UITVOERTIJD" });
|
||||
if (melddatum != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
var meldaanmaakdate = XMLtoJsDate(melddatum);
|
||||
fields.push({ dbs: "mld_melding_datum", typ: "datetime", val: meldaanmaakdate });
|
||||
}
|
||||
catch (e)
|
||||
{ // Verkeerde datum-formaat, volgens spec. dan now gebruiken!
|
||||
__DoLog("Formaat ontvangen XML-datum incorrect: "+ melddatum, "#00FF00");
|
||||
meldaanmaakdate = now;
|
||||
fields.push({ dbs: "mld_melding_datum", typ: "datetime", val: meldaanmaakdate });
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fields.push({ dbs: "mld_melding_datum", typ: "datetime", val: now });
|
||||
}
|
||||
// De einddatum is de meegegeven einddatum, maar als die niet wordt meegegeven is het
|
||||
// gewoon enddate_std en dat regelt de trigger wel, dus DAN MOET IK HEM NIET MEEGEVEN
|
||||
if (einddatum != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
var meldeinddate = XMLtoJsDate(einddatum);
|
||||
if (meldeinddate > meldaanmaakdate)
|
||||
{
|
||||
fields.push({ dbs: "mld_melding_einddatum", typ: "datetime", val: meldeinddate });
|
||||
}
|
||||
else
|
||||
{
|
||||
// Ontvangen XML-einddatum voor begindatum, dan later volgens SLA zetten!
|
||||
__DoLog("Ontvangen XML-einddatum voor begindatum: "+ einddatum, "#00FF00");
|
||||
}
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
// Verkeerde datum-formaat, dan later volgens SLA zetten!
|
||||
__DoLog("Formaat ontvangen XML-einddatum incorrect: "+ einddatum, "#00FF00");
|
||||
}
|
||||
}
|
||||
|
||||
tsql = "SELECT alg_locatie_key "
|
||||
+ " FROM alg_v_aanweziglocatie"
|
||||
+ " WHERE alg_locatie_code="+ safe.quoted_sql(meldloc);
|
||||
tsql = "SELECT alg_gebouw_key "
|
||||
+ " FROM alg_v_aanweziggebouw"
|
||||
+ " WHERE alg_locatie_key ="+ locatie_key
|
||||
+ " AND alg_gebouw_code="+ safe.quoted_sql(meldgeb);
|
||||
var oRs = Oracle.Execute(tsql);
|
||||
if (!oRs.eof)
|
||||
{
|
||||
alglevel_ok = alglevel_ok || stdmld_niveau == "L";
|
||||
locatie_key = oRs("alg_locatie_key").value;
|
||||
fields.push({ dbs: "mld_alg_locatie_key", typ: "key", val: locatie_key });
|
||||
alglevel_ok = alglevel_ok || stdmld_niveau == "G";
|
||||
plaats_key = oRs("alg_gebouw_key").value;
|
||||
|
||||
tsql = "SELECT alg_gebouw_key "
|
||||
+ " FROM alg_v_aanweziggebouw"
|
||||
+ " WHERE alg_locatie_key ="+ locatie_key
|
||||
+ " AND alg_gebouw_code="+ safe.quoted_sql(meldgeb);
|
||||
tsql = "SELECT alg_verdieping_key "
|
||||
+ " FROM alg_v_aanwezigverdieping"
|
||||
+ " WHERE alg_gebouw_key ="+ plaats_key
|
||||
+ " AND alg_verdieping_code="+ safe.quoted_sql(meldver);
|
||||
var oRs = Oracle.Execute(tsql);
|
||||
if (!oRs.eof)
|
||||
{
|
||||
alglevel_ok = alglevel_ok || stdmld_niveau == "G";
|
||||
plaats_key = oRs("alg_gebouw_key").value;
|
||||
alglevel_ok = alglevel_ok || stdmld_niveau == "V";
|
||||
plaats_key = oRs("alg_verdieping_key").value;
|
||||
|
||||
tsql = "SELECT alg_verdieping_key "
|
||||
+ " FROM alg_v_aanwezigverdieping"
|
||||
+ " WHERE alg_gebouw_key ="+ plaats_key
|
||||
+ " AND alg_verdieping_code="+ safe.quoted_sql(meldver);
|
||||
tsql = "SELECT alg_ruimte_key "
|
||||
+ " FROM alg_v_aanwezigruimte"
|
||||
+ " WHERE alg_verdieping_key ="+ plaats_key
|
||||
+ " AND alg_ruimte_nr="+ safe.quoted_sql(meldrnr);
|
||||
var oRs = Oracle.Execute(tsql);
|
||||
if (!oRs.eof)
|
||||
{
|
||||
alglevel_ok = alglevel_ok || stdmld_niveau == "V";
|
||||
plaats_key = oRs("alg_verdieping_key").value;
|
||||
|
||||
tsql = "SELECT alg_ruimte_key "
|
||||
+ " FROM alg_v_aanwezigruimte"
|
||||
+ " WHERE alg_verdieping_key ="+ plaats_key
|
||||
+ " AND alg_ruimte_nr="+ safe.quoted_sql(meldrnr);
|
||||
var oRs = Oracle.Execute(tsql);
|
||||
if (!oRs.eof) {
|
||||
alglevel_ok = alglevel_ok || stdmld_niveau == "R";
|
||||
plaats_key = oRs("alg_ruimte_key").value;
|
||||
}
|
||||
if (!oRs.eof) {
|
||||
alglevel_ok = alglevel_ok || stdmld_niveau == "R";
|
||||
plaats_key = oRs("alg_ruimte_key").value;
|
||||
}
|
||||
}
|
||||
|
||||
if (plaats_key != -1)
|
||||
{
|
||||
fields.push({ dbs: "mld_alg_onroerendgoed_keys", typ: "key", val: plaats_key });
|
||||
}
|
||||
}
|
||||
if (!alglevel_ok)
|
||||
|
||||
if (plaats_key != -1)
|
||||
{
|
||||
resultcode = 5;
|
||||
resulttekst = "Location not found";
|
||||
__DoLog(resulttekst, "#00FF00");
|
||||
fields.push({ dbs: "mld_alg_onroerendgoed_keys", typ: "key", val: plaats_key });
|
||||
}
|
||||
}
|
||||
if (!alglevel_ok)
|
||||
{
|
||||
resultcode = 4;
|
||||
resulttekst = "Location not found";
|
||||
__DoLog(resulttekst, "#00FF00");
|
||||
}
|
||||
|
||||
var kpn_key = user.afdeling().prs_kostenplaats_key();
|
||||
if (meld_kpn && meld_kpn != "")
|
||||
fields = fields.concat(
|
||||
[ { dbs: "mld_melding_key", typ: "key", seq: "mld_s_mld_melding_key" },
|
||||
{ dbs: "mld_melding_module", typ: "varchar", val: "MLD" },
|
||||
{ dbs: "mld_meldbron_key", typ: "key", val: 6 }, // system
|
||||
{ dbs: "mld_melding_omschrijving", typ: "varchar", val: meld_oms, len: 4000 },
|
||||
{ dbs: "prs_kostenplaats_key", typ: "key", val: user.afdeling().prs_kostenplaats_key() },
|
||||
{ dbs: "prs_perslid_key", typ: "key", val: perslid_key },
|
||||
{ dbs: "prs_perslid_key_voor", typ: "key", val: voor_key },
|
||||
{ dbs: "mld_melding_spoed", typ: "key", val: 3 }, // default (frontend) = 3
|
||||
{ dbs: "mld_melding_externnr", typ: "varchar", val: ext_id, len: 30 }
|
||||
]);
|
||||
|
||||
// We weten wat te inserten, nu nog uitvoeren; rechten voldoende afgedekt via MLDUSE-check hierboven?
|
||||
|
||||
if (resultcode == -1)
|
||||
{ // nog steeds geen fouten
|
||||
var mldIns = buildInsert("mld_melding", fields, { noValidateToken: true });
|
||||
mld_key = mldIns.sequences["mld_melding_key"];
|
||||
|
||||
sql = mldIns.sql;
|
||||
oRs = Oracle.Execute(sql);
|
||||
|
||||
// Zetten van de status op ingevoerd en afhandelen van de tracking.
|
||||
mld.setmeldingstatus(mld_key, 2); // Zorgt ook voor tracking & daarmee notificatie.
|
||||
|
||||
// Eventuele (gewijzigde) objecten zijn nu ook opgeslagen. Nu kan de definitieve mld_melding.mld_melding_einddatum_std bepaald en gezet worden.
|
||||
//mld.updatestdeinddatum(mld_key); // Unsupported yet. So update of mld_melding_einddatum_std not needed yet.
|
||||
|
||||
// De kenmerken.
|
||||
for (j=0; j < mldkenmerken.length; j++)
|
||||
{
|
||||
var tempKpn = getKpn(meld_kpn);
|
||||
if (tempKpn != -1)
|
||||
kpn_key = tempKpn;
|
||||
}
|
||||
var kenmerk_naam = mldkenmerken[j].getAttribute("naam");
|
||||
if (mldkenmerken[j].childNodes.length > 0)
|
||||
var kenmerk_waarde = mldkenmerken[j].childNodes[0].nodeValue;
|
||||
else
|
||||
var kenmerk_waarde = "";
|
||||
//Response.Write(kenmerk_naam);
|
||||
//Response.Write(kenmerk_waarde);
|
||||
// Zoek het kenmerk op naam terug
|
||||
ksql = "SELECT k.mld_kenmerk_key, sk.mld_srtkenmerk_kenmerktype, sk.mld_srtkenmerk_lengte "
|
||||
+ " FROM mld_kenmerk k"
|
||||
+ " , mld_srtkenmerk sk"
|
||||
+ " , mld_stdmelding s"
|
||||
+ " , mld_discipline d"
|
||||
+ " WHERE s.mld_ins_discipline_key = d.ins_discipline_key"
|
||||
+ " AND k.mld_srtkenmerk_key = sk.mld_srtkenmerk_key "
|
||||
+ " AND k.mld_kenmerk_verwijder IS NULL "
|
||||
+ " AND sk.mld_srtkenmerk_upper = " + safe.quoted_sql_upper(kenmerk_naam)
|
||||
+ " AND s.mld_ins_discipline_key = d.ins_discipline_key"
|
||||
+ " AND s.mld_stdmelding_key = " + stdmld_key
|
||||
+ " AND ((k.mld_stdmelding_key = s.mld_stdmelding_key AND k.mld_kenmerk_niveau = 'S')"
|
||||
+ " OR (k.mld_stdmelding_key = s.mld_ins_discipline_key AND k.mld_kenmerk_niveau = 'D')"
|
||||
+ " OR (k.mld_stdmelding_key = d.ins_srtdiscipline_key AND k.mld_kenmerk_niveau = 'T'))";
|
||||
|
||||
fields = fields.concat(
|
||||
[ { dbs: "mld_melding_key", typ: "key", seq: "mld_s_mld_melding_key" },
|
||||
{ dbs: "mld_melding_module", typ: "varchar", val: "MLD" },
|
||||
{ dbs: "mld_meldbron_key", typ: "key", val: 6 }, // system
|
||||
{ dbs: "mld_melding_omschrijving", typ: "varchar", val: meld_oms, len: 4000 },
|
||||
{ dbs: "prs_kostenplaats_key", typ: "key", val: kpn_key },
|
||||
{ dbs: "prs_perslid_key", typ: "key", val: perslid_key },
|
||||
{ dbs: "prs_perslid_key_voor", typ: "key", val: voor_key },
|
||||
{ dbs: "mld_melding_spoed", typ: "key", val: 3 }, // default (frontend) = 3
|
||||
{ dbs: "mld_melding_externnr", typ: "varchar", val: ext_id, len: 30 }
|
||||
]);
|
||||
var oRs = Oracle.Execute(ksql);
|
||||
|
||||
// We weten wat te inserten, nu nog uitvoeren; rechten voldoende afgedekt via MLDUSE-check hierboven?
|
||||
|
||||
if (resultcode == -1)
|
||||
{ // nog steeds geen fouten
|
||||
var mldIns = buildInsert("mld_melding", fields, { noValidateToken: true });
|
||||
mld_key = mldIns.sequences["mld_melding_key"];
|
||||
|
||||
sql = mldIns.sql;
|
||||
oRs = Oracle.Execute(sql);
|
||||
|
||||
// Zetten van de status op ingevoerd en afhandelen van de tracking.
|
||||
mld.setmeldingstatus(mld_key, 2); // Zorgt ook voor tracking & daarmee notificatie.
|
||||
|
||||
// Eventuele (gewijzigde) objecten zijn nu ook opgeslagen. Nu kan de definitieve mld_melding.mld_melding_einddatum_std bepaald en gezet worden.
|
||||
//mld.updatestdeinddatum(mld_key); // Unsupported yet. So update of mld_melding_einddatum_std not needed yet.
|
||||
|
||||
// De kenmerken.
|
||||
upsertKenmerk(mldkenmerken, stdmld_key, mld_key);
|
||||
|
||||
resultcode = 0; // Ik heb gedaan wat ik moest en mocht doen voor deze melding.
|
||||
// En nog maar even de aanname dat een extern systeem niet aan workflows/ktos doet?
|
||||
|
||||
// Klantspecifieke check functie (hookfunction) voor de invoer
|
||||
var pResult = new HookResult();
|
||||
if (!custfunc.mld_postsave(mld_key, pResult))
|
||||
if (!oRs.eof)
|
||||
{
|
||||
__DoLog(pResult.errmsg, "#00FF00");
|
||||
}
|
||||
// De hookfunctie kan de stdmelding aanpassen.
|
||||
if (pResult.stdmld_key)
|
||||
{
|
||||
// check de paden van de flexfiles als de stdmeldingkey aangepast is
|
||||
mld.keepFlexDocuments(mld_key, stdmld_key, pResult.stdmld_key);
|
||||
var kenmerk_key = oRs("mld_kenmerk_key").value;
|
||||
var kenmerk_type = oRs("mld_srtkenmerk_kenmerktype").value;
|
||||
var kenmerk_lengte = oRs("mld_srtkenmerk_lengte").value;
|
||||
|
||||
ksql = "SELECT km.mld_kenmerkmelding_key "
|
||||
+ " FROM mld_kenmerkmelding km "
|
||||
+ " WHERE km.mld_melding_key = " + mld_key
|
||||
+ " AND km.mld_kenmerk_key = " + kenmerk_key;
|
||||
var oRs = Oracle.Execute(ksql);
|
||||
|
||||
switch (kenmerk_type)
|
||||
{
|
||||
case 'C':
|
||||
{
|
||||
// we ondersteunen alleen nog maar karakter velden.
|
||||
if (!oRs.eof)
|
||||
{
|
||||
var kenmerkmelding_key = oRs("mld_kenmerkmelding_key").value;
|
||||
ksql = "UPDATE mld_kenmerkmelding"
|
||||
+ " SET mld_kenmerkmelding_waarde = " + safe.quoted_sql(kenmerk_waarde)
|
||||
+ " WHERE mld_kenmerkmelding_key = " + kenmerkmelding_key;
|
||||
}
|
||||
else
|
||||
{
|
||||
ksql = "INSERT INTO mld_kenmerkmelding (mld_kenmerk_key, mld_melding_key, mld_kenmerkmelding_waarde) "
|
||||
+ "VALUES (" + kenmerk_key + ", " + mld_key + ", " + safe.quoted_sql(kenmerk_waarde) + ")";
|
||||
}
|
||||
Oracle.Execute(ksql);
|
||||
break;
|
||||
}
|
||||
case 'N':
|
||||
{
|
||||
// we ondersteunen alleen nog maar karakter velden.
|
||||
if (!oRs.eof)
|
||||
{
|
||||
var kenmerkmelding_key = oRs("mld_kenmerkmelding_key").value;
|
||||
ksql = "UPDATE mld_kenmerkmelding"
|
||||
+ " SET mld_kenmerkmelding_waarde = " + safe.quoted_sql(kenmerk_waarde)
|
||||
+ " WHERE mld_kenmerkmelding_key = " + kenmerkmelding_key;
|
||||
}
|
||||
else
|
||||
{
|
||||
ksql = "INSERT INTO mld_kenmerkmelding (mld_kenmerk_key, mld_melding_key, mld_kenmerkmelding_waarde) "
|
||||
+ "VALUES (" + kenmerk_key + ", " + mld_key + ", " + safe.quoted_sql(kenmerk_waarde) + ")";
|
||||
}
|
||||
Oracle.Execute(ksql);
|
||||
break;
|
||||
}
|
||||
case "M": // Folder met bijlagen
|
||||
{
|
||||
//Response.Write(kenmerk_naam);
|
||||
var bijlagen = mldkenmerken[j].getElementsByTagName("bijlage");
|
||||
var bi;
|
||||
for (bi = 0; bi < bijlagen.length; bi++)
|
||||
{
|
||||
var Attachment = XMLval(bijlagen[bi], "attachment");
|
||||
var Name = XMLval(bijlagen[bi], "name");
|
||||
var Size = XMLval(bijlagen[bi], "size");
|
||||
//Response.Write("Name: " + Name + " size: " + Size);
|
||||
if (Attachment && Name && Size)
|
||||
{
|
||||
var SafeName = safe.filename(Name);
|
||||
var params = flexProps("MLD", mld_key, String(kenmerk_key), "M");
|
||||
if (!params.isAllowedName(SafeName))
|
||||
{
|
||||
__DoLog("Unsafe SOAP file '{0}' ignored.".format(SafeName), "#FFFF00");
|
||||
}
|
||||
else
|
||||
{
|
||||
__Log("Start saving: " + params.AttachPath + SafeName);
|
||||
CreateFullPath(params.AttachPath);
|
||||
encodedString2File(params.AttachPath + SafeName, Attachment, "bin.hex");
|
||||
__Log("Done saving: " + params.AttachPath + SafeName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
oRs.Close();
|
||||
}
|
||||
}
|
||||
} // end geldige stdmld_key
|
||||
} // end insert
|
||||
|
||||
resultcode = 0; // Ik heb gedaan wat ik moest en mocht doen voor deze melding.
|
||||
// En nog maar even de aanname dat een extern systeem niet aan workflows/ktos doet?
|
||||
|
||||
// Klantspecifieke check functie (hookfunction) voor de invoer
|
||||
var pResult = new HookResult();
|
||||
if (!custfunc.mld_postsave(mld_key, pResult))
|
||||
{
|
||||
__DoLog(pResult.errmsg, "#00FF00");
|
||||
}
|
||||
|
||||
}
|
||||
} // end geldige stdmld_key
|
||||
} // end geldige ext_id
|
||||
|
||||
if (resultcode > 0)
|
||||
__DoLog("api_mldsoap fail.\nResultcode: {0}\nReturntekst: {1}".format(resultcode, resulttekst), "#00FF00");
|
||||
|
||||
var binfo = {returncode: resultcode,
|
||||
returntekst: resulttekst,
|
||||
// executed:sql, // debug
|
||||
@@ -494,137 +488,8 @@ for (i = 0; i < meldingen.length; i++)
|
||||
} // end for
|
||||
// Alle melding-nodes zijn behandeld.
|
||||
|
||||
function getKpn(meld_kpn)
|
||||
{
|
||||
if (!meld_kpn)
|
||||
return -1;
|
||||
|
||||
var temp_sql = "SELECT ''"
|
||||
+ " FROM prs_perslidkostenplaats pkp"
|
||||
+ " WHERE pkp.prs_perslidkostenplaats_boeken = 1"
|
||||
+ " AND (pkp.prs_kostenplaats_key = kp.prs_kostenplaats_key"
|
||||
+ " OR pkp.prs_kostenplaats_key IS NULL)" // Mandated for all
|
||||
+ " AND pkp.prs_perslid_key = " + perslid_key;
|
||||
|
||||
temp_sql = "SELECT kp.prs_kostenplaats_key"
|
||||
+ " FROM prs_kostenplaats kp"
|
||||
+ " WHERE kp.prs_kostenplaats_verwijder IS NULL"
|
||||
+ " AND (kp.prs_kostenplaats_begin IS NULL"
|
||||
+ " OR kp.prs_kostenplaats_begin < SYSDATE)"
|
||||
+ " AND (kp.prs_kostenplaats_eind IS NULL"
|
||||
+ " OR kp.prs_kostenplaats_eind > SYSDATE)"
|
||||
+ " AND EXISTS ("
|
||||
+ temp_sql
|
||||
+ " )"
|
||||
+ " AND kp.prs_kostenplaats_upper = " + safe.quoted_sql_upper(meld_kpn); // Unique
|
||||
|
||||
var oRs = Oracle.Execute(temp_sql);
|
||||
if (!oRs.EoF)
|
||||
return oRs("prs_kostenplaats_key").Value;
|
||||
oRs.Close();
|
||||
return -1;
|
||||
}
|
||||
|
||||
function upsertKenmerk(kenmerken, stdmld_key, mld_key)
|
||||
{
|
||||
for (j=0; j < kenmerken.length; j++)
|
||||
{
|
||||
var kenmerk_naam = kenmerken[j].getAttribute("naam");
|
||||
if (kenmerken[j].childNodes.length > 0)
|
||||
var kenmerk_waarde = kenmerken[j].childNodes[0].nodeValue;
|
||||
else
|
||||
var kenmerk_waarde = "";
|
||||
|
||||
// Zoek het kenmerk op naam terug
|
||||
ksql = "SELECT k.mld_kenmerk_key, sk.mld_srtkenmerk_kenmerktype, sk.mld_srtkenmerk_lengte "
|
||||
+ " FROM mld_kenmerk k"
|
||||
+ " , mld_srtkenmerk sk"
|
||||
+ " , mld_stdmelding s"
|
||||
+ " , mld_discipline d"
|
||||
+ " WHERE s.mld_ins_discipline_key = d.ins_discipline_key"
|
||||
+ " AND k.mld_srtkenmerk_key = sk.mld_srtkenmerk_key "
|
||||
+ " AND k.mld_kenmerk_verwijder IS NULL "
|
||||
+ " AND sk.mld_srtkenmerk_upper = " + safe.quoted_sql_upper(kenmerk_naam)
|
||||
+ " AND s.mld_ins_discipline_key = d.ins_discipline_key"
|
||||
+ " AND s.mld_stdmelding_key = " + stdmld_key
|
||||
+ " AND ((k.mld_stdmelding_key = s.mld_stdmelding_key AND k.mld_kenmerk_niveau = 'S')"
|
||||
+ " OR (k.mld_stdmelding_key = s.mld_ins_discipline_key AND k.mld_kenmerk_niveau = 'D')"
|
||||
+ " OR (k.mld_stdmelding_key = d.ins_srtdiscipline_key AND k.mld_kenmerk_niveau = 'T'))";
|
||||
|
||||
var oRs = Oracle.Execute(ksql);
|
||||
|
||||
if (!oRs.eof)
|
||||
{
|
||||
var kenmerk_key = oRs("mld_kenmerk_key").value;
|
||||
var kenmerk_type = oRs("mld_srtkenmerk_kenmerktype").value;
|
||||
// var kenmerk_lengte = oRs("mld_srtkenmerk_lengte").value; // unsupported yet?
|
||||
|
||||
var temp_sql = "SELECT km.mld_kenmerkmelding_key "
|
||||
+ " FROM mld_kenmerkmelding km "
|
||||
+ " WHERE km.mld_melding_key = " + mld_key
|
||||
+ " AND km.mld_kenmerk_key = " + kenmerk_key;
|
||||
var oRs = Oracle.Execute(temp_sql);
|
||||
|
||||
switch (kenmerk_type)
|
||||
{
|
||||
case 'C':
|
||||
case 'X':
|
||||
case 'N':
|
||||
{
|
||||
// we ondersteunen alleen nog maar karakter velden.
|
||||
if (!oRs.eof)
|
||||
{
|
||||
var kenmerkmelding_key = oRs("mld_kenmerkmelding_key").value;
|
||||
ksql = "UPDATE mld_kenmerkmelding"
|
||||
+ " SET mld_kenmerkmelding_waarde = " + safe.quoted_sql(kenmerk_waarde)
|
||||
+ " WHERE mld_kenmerkmelding_key = " + kenmerkmelding_key;
|
||||
}
|
||||
else
|
||||
{
|
||||
ksql = "INSERT INTO mld_kenmerkmelding (mld_kenmerk_key, mld_melding_key, mld_kenmerkmelding_waarde) "
|
||||
+ "VALUES (" + kenmerk_key + ", " + mld_key + ", " + safe.quoted_sql(kenmerk_waarde) + ")";
|
||||
}
|
||||
Oracle.Execute(ksql);
|
||||
break;
|
||||
}
|
||||
case "M": // Folder met bijlagen
|
||||
{
|
||||
//Response.Write(kenmerk_naam);
|
||||
var bijlagen = kenmerken[j].getElementsByTagName("bijlage");
|
||||
var bi;
|
||||
for (bi = 0; bi < bijlagen.length; bi++)
|
||||
{
|
||||
var Attachment = XMLval(bijlagen[bi], "attachment");
|
||||
var Name = XMLval(bijlagen[bi], "name");
|
||||
var Size = XMLval(bijlagen[bi], "size");
|
||||
//Response.Write("Name: " + Name + " size: " + Size);
|
||||
if (Attachment && Name && Size)
|
||||
{
|
||||
var SafeName = safe.filename(Name);
|
||||
var params = flexProps("MLD", mld_key, String(kenmerk_key), "M");
|
||||
if (!params.isAllowedName(SafeName))
|
||||
{
|
||||
__DoLog("Unsafe SOAP file '{0}' ignored.".format(SafeName), "#FFFF00");
|
||||
}
|
||||
else
|
||||
{
|
||||
__Log("Start saving: " + params.AttachPath + SafeName);
|
||||
CreateFullPath(params.AttachPath);
|
||||
encodedString2File(params.AttachPath + SafeName, Attachment, "bin.hex");
|
||||
__Log("Done saving: " + params.AttachPath + SafeName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
oRs.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
xmlResp.appendChild(FCLTElement);
|
||||
|
||||
Response.ContentType = "text/xml";
|
||||
if (API.apidata.stylesheet)
|
||||
{
|
||||
// Niet super efficient dat we eerst naar tekstuele xml gaan maar ach...
|
||||
@@ -632,6 +497,7 @@ if (API.apidata.stylesheet)
|
||||
}
|
||||
else
|
||||
{
|
||||
Response.ContentType = "text/xml";
|
||||
Response.Write(xmlResp.xml)
|
||||
}
|
||||
%>
|
||||
|
||||
@@ -50,19 +50,17 @@ if ("MLDremark" in API.apidata.options)
|
||||
if ("ORDremark" in API.apidata.options)
|
||||
ORDremark = API.apidata.options["ORDremark"];
|
||||
|
||||
if (API.apidata.loglevel > 1) // Zet maar op 3 als je HTML logging wilt
|
||||
Session("logging") = API.apidata.loglevel||0;
|
||||
|
||||
//user.checkAutorisation("WEB_MLDUSE"); // Dit is nog ongeacht de melding.
|
||||
|
||||
var tsql = "-"; // Voor tijdelijke statement.
|
||||
var sql = "-"; // De uiteindelijke insert/update-sql.
|
||||
var xmlReq = Server.CreateObject("MSXML2.DOMDocument.6.0");
|
||||
|
||||
//if (API.apidata.loglevel) __Log2File(Request, API.APIname + "_IN1");
|
||||
|
||||
if (API.apidata.stylesheet)
|
||||
{
|
||||
var iXsl = Server.CreateObject("MSXML2.DOMDocument.6.0");
|
||||
iXsl.resolveExternals = true; // XSL kan includes hebben
|
||||
|
||||
if( ! iXsl.load(Server.MapPath(API.apidata.stylesheet)) )
|
||||
{
|
||||
API.error("Could not load XSL " + API.apidata.stylesheet + "\n" + iXsl.parseError.reason);
|
||||
@@ -84,18 +82,7 @@ if (API.apidata.stylesheet)
|
||||
inputXML.transformNodeToObject(iXsl, xmlReq);
|
||||
}
|
||||
else
|
||||
{
|
||||
xmlReq.load(Request);
|
||||
if (xmlReq.parseError.errorCode != 0)
|
||||
{
|
||||
__DoLog( "Error loading XML: "
|
||||
+ xmlReq.parseError.errorCode
|
||||
+ "\n" + xmlReq.parseError.reason
|
||||
+ " regel " + xmlReq.parseError.line
|
||||
+ "(" + xmlReq.parseError.linepos + ")"
|
||||
, "#ff0000");
|
||||
}
|
||||
}
|
||||
|
||||
if (API.apidata.loglevel) __Log2File(xmlReq.xml, API.APIname + "_TUSSEN");
|
||||
|
||||
@@ -155,8 +142,6 @@ for (i=0; i < opdrachten.length; i++)
|
||||
var opdrachttekst = XMLval(opdrachten[i], "opdrachttekst"); // NEW
|
||||
var meldingtekst = XMLval(opdrachten[i], "meldingtekst"); // NEW
|
||||
var onderwerp = XMLval(opdrachten[i], "onderwerp"); // NEW
|
||||
var opdr_kpn = XMLval(opdrachten[i], "kostenplaats");
|
||||
var flag = parseInt(XMLval(opdrachten[i], "flag"), 10);
|
||||
|
||||
var txt_mut_datum = XMLval(opdrachten[i], "mut_datum"); // UPD
|
||||
var opdrstatus = XMLval(opdrachten[i], "status"); // UPD
|
||||
@@ -200,7 +185,6 @@ for (i=0; i < opdrachten.length; i++)
|
||||
{
|
||||
voor_key = oRs("prs_perslid_key").value;
|
||||
}
|
||||
oRs.Close();
|
||||
|
||||
// Kijk of er een opdracht bestaat met dit externe opdracht nummer.
|
||||
// Ben je bang dat het nummer vaker voorkomt dan kun je deze prefixen in de xsl
|
||||
@@ -218,7 +202,6 @@ for (i=0; i < opdrachten.length; i++)
|
||||
// Als het externe opdracht nummer al bestaat weten we zeker dat het om een update gaat.
|
||||
opdraction = "update";
|
||||
}
|
||||
oRs.Close();
|
||||
|
||||
if (opdraction == "insert")
|
||||
{
|
||||
@@ -250,12 +233,6 @@ for (i=0; i < opdrachten.length; i++)
|
||||
resulttekst = "Undefined stdmelding " + stdm_key;
|
||||
}
|
||||
|
||||
if (isNaN(voor_key))
|
||||
{
|
||||
resultcode = 3;
|
||||
resulttekst = "Undefined 'voor': " + voor_email;
|
||||
}
|
||||
|
||||
// Hier heb ik een geldige stdm_key.
|
||||
if (resultcode == -1) // Nog steeds geen fouten.
|
||||
{ // Bepaal kostenplaats via voor-user
|
||||
@@ -283,35 +260,6 @@ for (i=0; i < opdrachten.length; i++)
|
||||
__Log("Uitsluitend gemandateerd voor kostenplaats: " + kpn_nr);
|
||||
}
|
||||
}
|
||||
|
||||
if (opdr_kpn && opdr_kpn != "")
|
||||
{
|
||||
tsql = "SELECT prs_kostenplaats_key"
|
||||
+ " FROM prs_kostenplaats"
|
||||
+ " WHERE prs_kostenplaats_verwijder IS NULL"
|
||||
+ " AND (prs_kostenplaats_begin IS NULL"
|
||||
+ " OR prs_kostenplaats_begin < SYSDATE)"
|
||||
+ " AND (prs_kostenplaats_eind IS NULL"
|
||||
+ " OR prs_kostenplaats_eind > SYSDATE)"
|
||||
+ " AND prs_kostenplaats_upper = " + safe.quoted_sql_upper(opdr_kpn); // Unique
|
||||
oRs = Oracle.Execute(tsql);
|
||||
if (!oRs.EoF)
|
||||
{
|
||||
var opdr_kpn_key = oRs("prs_kostenplaats_key").Value;
|
||||
|
||||
tsql = "SELECT ''"
|
||||
+ " FROM prs_perslidkostenplaats"
|
||||
+ " WHERE prs_perslidkostenplaats_boeken = 1"
|
||||
+ " AND (prs_kostenplaats_key = " + opdr_kpn_key
|
||||
+ " OR prs_kostenplaats_key IS NULL)" // Mandated for all
|
||||
+ " AND prs_perslid_key = " + voor_key;
|
||||
oRs = Oracle.Execute(tsql);
|
||||
|
||||
if (!oRs.EoF) // persoon gemandateerd voor gegeven kostenplaats
|
||||
kpn_key = opdr_kpn_key;
|
||||
}
|
||||
}
|
||||
|
||||
if (resultcode == -1) // Nog steeds geen fouten.
|
||||
{
|
||||
var meld_oms = "Automatisch aangemaakte melding tbv. werkzaamheden ge<67>nitieerd in extern systeem met referentie: "+ externnr;
|
||||
@@ -409,12 +357,6 @@ for (i=0; i < opdrachten.length; i++)
|
||||
fields.push({ dbs: "mld_opdr_omschrijving", typ: "varchar", val: opdrachttekst, len: 4000 });
|
||||
}
|
||||
|
||||
// Flag, ignore if invalid
|
||||
if (!isNaN(flag) && flag >= 0 && flag < S("mld_opdracht_flags"))
|
||||
{
|
||||
fields.push({ dbs: "mld_opdr_flag", typ: "number", val: flag });
|
||||
}
|
||||
|
||||
var mldIns = buildInsert("mld_opdr", fields, { noValidateToken: true });
|
||||
var sql = mldIns.sql;
|
||||
var err = Oracle.Execute(sql, true);
|
||||
@@ -435,7 +377,7 @@ for (i=0; i < opdrachten.length; i++)
|
||||
mld.updatemeldingstatus (mld_key, 0);
|
||||
}
|
||||
}
|
||||
else if (opdraction == "update" || opdraction == "note")
|
||||
else if (opdraction == "update")
|
||||
{ // Bestaande opdracht zoeken
|
||||
var idarr = opdrid.split('/');
|
||||
mld_key = parseInt(idarr[0], 10);
|
||||
@@ -464,13 +406,6 @@ for (i=0; i < opdrachten.length; i++)
|
||||
}
|
||||
oRs.Close();
|
||||
}
|
||||
if (resultcode == -1 && opdraction == "note")
|
||||
{
|
||||
tsql = "INSERT INTO mld_opdr_note(mld_opdr_key, prs_perslid_key, mld_opdr_note_omschrijving)"
|
||||
+ " VALUES (" + opdr_key + "," + user_key + "," + safe.quoted_sql(opdropmerking) + ")";
|
||||
Oracle.Execute(tsql);
|
||||
resultcode = 0; // we zijn klaar.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -568,13 +503,6 @@ for (i=0; i < opdrachten.length; i++)
|
||||
if (autoorder) // Ooit: net als appendRemark via json configureerbaar maken?
|
||||
mld_fields.push({ dbs: "mld_melding_einddatum", typ: "date", val: opdrgereeddate, track: L("lcl_mld_enddate") });
|
||||
}
|
||||
|
||||
// Flag, ignore if invalid
|
||||
if (!isNaN(flag) && flag >= 0 && flag < S("mld_opdracht_flags"))
|
||||
{
|
||||
opdr_fields.push({ dbs: "mld_opdr_flag", typ: "number", val: flag });
|
||||
}
|
||||
|
||||
// We weten nu de updates, straks voeren we deze pas uit
|
||||
// Eerst de eventuele statuswijzigingen
|
||||
var newstatus = -1;
|
||||
@@ -826,10 +754,6 @@ for (i=0; i < opdrachten.length; i++)
|
||||
{
|
||||
resultcode = 0; // Ik heb gedaan wat ik moest en mocht doen voor deze opdracht.
|
||||
}
|
||||
else if (resultcode > 0)
|
||||
{
|
||||
__DoLog("api_opdrsoap fail.\nResultcode: {0}\nReturntekst: {1}".format(resultcode, resulttekst), "#00FF00");
|
||||
}
|
||||
|
||||
var binfo = {
|
||||
returncode: resultcode,
|
||||
@@ -856,13 +780,13 @@ for (i=0; i < opdrachten.length; i++)
|
||||
|
||||
xmlResp.appendChild(FCLTElement);
|
||||
|
||||
Response.ContentType = "text/xml";
|
||||
if (API.apidata.stylesheet)
|
||||
{ // Niet super efficient dat we eerst naar tekstuele xml gaan maar ach...
|
||||
STR2Stream(xmlResp.xml, API.apidata.stylesheet, Response, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
Response.ContentType = "text/xml";
|
||||
Response.Write(xmlResp.xml)
|
||||
}
|
||||
%>
|
||||
|
||||
@@ -441,7 +441,6 @@
|
||||
|
||||
xmlResp.appendChild(FCLTElement);
|
||||
|
||||
Response.ContentType = "text/xml";
|
||||
if (API.apidata.stylesheet)
|
||||
{
|
||||
// Niet super efficient dat we eerst naar tekstuele xml gaan maar ach...
|
||||
@@ -449,6 +448,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
Response.ContentType = "text/xml";
|
||||
Response.Write(xmlResp.xml)
|
||||
}
|
||||
%>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
LCL_Disable = 1
|
||||
THIS_FILE = "appl/api/api_ressoap_info.asp";
|
||||
|
||||
// __Logging = 1;
|
||||
// Session("logging")=1;
|
||||
|
||||
%>
|
||||
<!-- #include file="../Shared/common.inc" -->
|
||||
|
||||
@@ -38,10 +38,7 @@ __Log("== Entering shorturl.asp ==");
|
||||
'locatie': { gui: 'appl/alg/alg_locatie.asp?key=' },
|
||||
'melding': { gui: 'appl/mld/mld_melding.asp?mld_key=', mob: 'appl/pda/melding.asp?mld_key=' },
|
||||
'message': { gui: 'appl/msg/msg_message.asp?message_key=' },
|
||||
'opdracht': { gui: 'appl/mld/mld_opdr.asp?opdr_key=',
|
||||
mob: 'appl/pda/order.asp?opdr_key=',
|
||||
lckgui: 'appl/mld/mld_opdr_actions.asp?opdr_key=',
|
||||
lckmob: 'appl/mld/mld_opdr_actions.asp?opdr_key=' },
|
||||
'opdracht': { gui: 'appl/mld/mld_opdr.asp?opdr_key=', mob: 'appl/pda/order.asp?opdr_key=' },
|
||||
'perslid': { gui: 'appl/prs/prs_perslid.asp?prs_key=', mob: 'appl/pda/user_info.asp?prs_key=' },
|
||||
'reservering': { gui: 'appl/res/res_reservering.asp?rsv_ruimte_key=', mob: 'appl/pda/reservering.asp?rsv_ruimte_key=' },
|
||||
'ruimte': { gui: 'appl/alg/alg_ruimte.asp?key=', mob: 'appl/pda/ruimte.asp?ruimte_key=' },
|
||||
@@ -50,53 +47,6 @@ __Log("== Entering shorturl.asp ==");
|
||||
}
|
||||
|
||||
var keyparam = getQParamInt("k", -1);
|
||||
|
||||
var locked_bdradr_key = getQParamInt("lbdr", -1);
|
||||
if (locked_bdradr_key > 0)
|
||||
{ // Eerst: hmac controleren
|
||||
var sql = "SELECT prs_bedrijfadres_locksecret,"
|
||||
+ " prs_bedrijfadres_lockuser_key,"
|
||||
+ " prs_bedrijfadres_lockexpire"
|
||||
+ " FROM prs_bedrijfadres"
|
||||
+ " WHERE prs_bedrijfadres_key = " + locked_bdradr_key
|
||||
+ " AND prs_bedrijfadres_locksecret IS NOT NULL"
|
||||
+ " AND prs_bedrijfadres_lockuser_key IS NOT NULL";
|
||||
var oRs = Oracle.Execute(sql);
|
||||
if (oRs.EOF)
|
||||
shared.simpel_page("Fixed user for company '{0}' is not or no longer valid.".format(locked_bdradr_key));
|
||||
|
||||
var locksecret = oRs("prs_bedrijfadres_locksecret").Value;
|
||||
var lockuser_key = oRs("prs_bedrijfadres_lockuser_key").Value;
|
||||
var lockexpire = oRs("prs_bedrijfadres_lockexpire").Value;
|
||||
oRs.Close()
|
||||
__Log("Checking locked bdradr {0} expire {1} days".format(locked_bdradr_key, lockexpire));
|
||||
protectQS.verify({ sleutel: locksecret,
|
||||
expire: lockexpire * 24 * 60,
|
||||
checkpath: "/", // altijd tegen de root zonder default.asp
|
||||
no_user_key: true }); // tamper check
|
||||
|
||||
var user_allowed = Session("locked_user_allowed") || []; // Array voor als je meerdere tabjes open hebt
|
||||
var found = false;
|
||||
for (var i = 0; i < user_allowed.length; i++)
|
||||
{
|
||||
if (user_allowed[i].locked_user_key == lockuser_key &&
|
||||
user_allowed[i].xmlnode == u &&
|
||||
user_allowed[i].key == keyparam)
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
{
|
||||
user_allowed.push({ locked_user_key: lockuser_key,
|
||||
xmlnode: u,
|
||||
key: keyparam
|
||||
})
|
||||
Session("locked_user_allowed") = user_allowed;
|
||||
}
|
||||
}
|
||||
|
||||
// For flexiblity reasons: Literal or runtime parameter(s), just pass through...
|
||||
var rest = String(Request.ServerVariables("QUERY_STRING")); // Request.ServerVariables("QUERY_STRING") is url-encoded,
|
||||
// dat is hier safer dan Request.QueryString
|
||||
@@ -111,15 +61,13 @@ __Log("== Entering shorturl.asp ==");
|
||||
checkUserAgent(); // devicebits waren anders mogelijk nog niet gezet
|
||||
if (device.test(device.isDesktop) || device.test(device.isTouch))
|
||||
{
|
||||
url = locked_bdradr_key > 0? known_bookmarks[u].lckgui : known_bookmarks[u].gui;
|
||||
url = known_bookmarks[u].gui;
|
||||
}
|
||||
else
|
||||
{
|
||||
url = locked_bdradr_key > 0? known_bookmarks[u].lckmob || known_bookmarks[u].lckgui
|
||||
: known_bookmarks[u].mob || known_bookmarks[u].gui;
|
||||
url = known_bookmarks[u].mob || known_bookmarks[u].gui;
|
||||
isMobile = true;
|
||||
}
|
||||
|
||||
url = url + keyparam;
|
||||
|
||||
if (keyparam > -1)
|
||||
@@ -155,11 +103,6 @@ __Log("== Entering shorturl.asp ==");
|
||||
}
|
||||
|
||||
var url = oRs("fac_bookmark_path").Value;
|
||||
if (url.indexOf("{$*}") > 0) // default.asp?Jumpto=cust/uwva/pacta.asp{$*}
|
||||
{
|
||||
url = url.replace("{$*}", safe.url("?" + rest));
|
||||
rest = "";
|
||||
}
|
||||
var refresher = oRs("fac_bookmark_refreshtime").Value;
|
||||
var bookmark_naam = oRs("fac_bookmark_naam").Value;
|
||||
|
||||
@@ -213,7 +156,7 @@ __Log("== Entering shorturl.asp ==");
|
||||
else
|
||||
var theURL = protectQS.create(url);
|
||||
|
||||
if (locked_bdradr_key < 0 && isKnownBookmark && !isMobile && getQParamInt("internal", 0) == 0)
|
||||
if (isKnownBookmark && !isMobile && getQParamInt("internal", 0) == 0)
|
||||
{
|
||||
Session("FirstPage") = theURL;
|
||||
theURL = rooturl + "/";
|
||||
|
||||
@@ -25,7 +25,6 @@ var fac_id = Request.QueryString("fac_id").Count > 0&&String(Request.QueryString
|
||||
$(doInit);
|
||||
$(doBuild);
|
||||
});
|
||||
var RVT_token = "<%=safe.jsstring(protectRequest.theToken())%>";
|
||||
</script>
|
||||
<style>
|
||||
pre { font-size: 1.2em;
|
||||
@@ -39,7 +38,7 @@ var fac_id = Request.QueryString("fac_id").Count > 0&&String(Request.QueryString
|
||||
<body style='background-color:#E5EAF1; font-family: Helvetica; font-size: 0.8em;'>
|
||||
<form method="post" onsubmit="doSubmit();return false;">
|
||||
<table>
|
||||
<th colspan="2">FACILITOR API2 tester - FOR INTERNAL USE ONLY [ <a href="<%=safe.htmlattr(HTTP.urlzelf())%>/api2/" target="_blank" rel="noopener noreferrer">API reference</a> ]</th>
|
||||
<th colspan="2">FACILITOR API2 tester - FOR INTERNAL USE ONLY [ <a href="http://facws001/trunk/api2/">API reference</a> ]</th>
|
||||
<tr><td><label>Format</label></td>
|
||||
<td><input type='radio' id='format' name='format' value='json' checked='1'>json</input>
|
||||
<input type='radio' id='format' name='format' value='xml'>xml</input>
|
||||
@@ -52,11 +51,7 @@ var fac_id = Request.QueryString("fac_id").Count > 0&&String(Request.QueryString
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td><label>APIKEY</label></td>
|
||||
<td><input id="apikey" type="text" style="width:250px" value="APIPFO">
|
||||
<%
|
||||
if (user_key > 0) { %>
|
||||
Herkend als: <%= safe.html(user.oslogin()) %>
|
||||
<% } %>
|
||||
<td><input id="apikey" type="text" style="width:250px" value="APIPFO">
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td><label>API2</label></td>
|
||||
@@ -133,8 +128,7 @@ var fac_id = Request.QueryString("fac_id").Count > 0&&String(Request.QueryString
|
||||
<tr><td>StatusText:</td><td><span id="StatusText"></span></td></tr>
|
||||
<tr><td>Duration:</td><td><span id="Duration"></span></td></tr>
|
||||
<tr><td>Records:</td><td><span id="Records"></span></td></tr>
|
||||
<tr><td>Size:</td><td><span id="ResultSize"></span></td></tr>
|
||||
<tr><td>Result:<button onclick='$("#xml").val($("#Result").text())'>^^^</button></td>
|
||||
<tr><td>Result:<button onclick='$("#xml").val($("#Result").text().replace("\r\n", "\n"))'>^^^</button></td>
|
||||
<td style='border:1px solid #666;font-size:0.8em;background-color:#fafafa;min-width:800px;'>
|
||||
<pre id="Result" style="padding:0 8px 0 2px;"></pre>
|
||||
</td>
|
||||
|
||||
49
APPL/API2/TESTER/get_apinames.asp
Normal file
49
APPL/API2/TESTER/get_apinames.asp
Normal file
@@ -0,0 +1,49 @@
|
||||
<%@language = "javascript" %>
|
||||
<% /*
|
||||
$Revision$
|
||||
$Id$
|
||||
|
||||
File: get_apinames.asp
|
||||
Description: Levert de bestanden in in de aangegeven map staan op de server.
|
||||
Parameters:
|
||||
- -
|
||||
*/
|
||||
%>
|
||||
|
||||
<%
|
||||
ANONYMOUS_Allowed = 1;
|
||||
var JSON_Result = true;
|
||||
%>
|
||||
|
||||
<!-- #include file="../../Shared/json2.js" -->
|
||||
|
||||
<%
|
||||
/***** Get webform parameters *****/
|
||||
//var searchfolder = getQParam("folder", "appl/api2");
|
||||
// Geen autorisatie check nodig
|
||||
/***** End get webform parameters *****/
|
||||
//var fullpath = (Server.MapPath(searchfolder));
|
||||
var fullpath = Server.MapPath("../");
|
||||
var api2_names = [];
|
||||
|
||||
var objFso = new ActiveXObject("Scripting.FileSystemObject");
|
||||
var objFiles = objFso.GetFolder(fullpath);
|
||||
var allFiles = new Enumerator(objFiles.files);
|
||||
for (; !allFiles.atEnd(); allFiles.moveNext())
|
||||
{
|
||||
var attFile = allFiles.item();
|
||||
|
||||
var ext = objFso.GetExtensionName(attFile);
|
||||
if ((attFile.name.indexOf("api_") == 0) && (ext == "asp"))
|
||||
{
|
||||
var name = attFile.name.substring(4, attFile.name.indexOf(".asp"))
|
||||
api2_names.push(name);
|
||||
}
|
||||
|
||||
}
|
||||
api2_names.sort();
|
||||
var result = { success: true
|
||||
, apinames: api2_names
|
||||
};
|
||||
Response.Write(JSON.stringify(result));
|
||||
%>
|
||||
@@ -1,458 +0,0 @@
|
||||
/*
|
||||
$Id$
|
||||
|
||||
File: testall.js
|
||||
|
||||
Description: Test script voor API2
|
||||
Gebruik: Aanroepen met CScript testall.js
|
||||
|
||||
Dit script gebruikt /api2/apis om een lijst met API's op te halen en doet op allemaal een keer
|
||||
- een GET voor 'alle' records
|
||||
- een GET voor het eerste record daarvan
|
||||
- Op dat eerste record ook een keer elke include
|
||||
|
||||
Voorwaarden:
|
||||
- APIPFO moet gedefinieerd zijn bij een persoon
|
||||
- Die persoon moet *heel veel* rechten hebben (stop hem in alle groepen)
|
||||
- Er treden nu nog wel enkele fouten op die ik nog niet zo snel weg krijg
|
||||
*/
|
||||
|
||||
// Zie achteraan voor de echte code
|
||||
|
||||
if (!this.JSON) {
|
||||
JSON = {};
|
||||
}
|
||||
|
||||
(function () {
|
||||
|
||||
function f(n) {
|
||||
// Format integers to have at least two digits.
|
||||
return n < 10 ? '0' + n : n;
|
||||
}
|
||||
|
||||
if (typeof Date.prototype.toJSON !== 'function') {
|
||||
|
||||
Date.prototype.toJSON = function (key) {
|
||||
|
||||
return isFinite(this.valueOf()) ?
|
||||
this.getUTCFullYear() + '-' +
|
||||
f(this.getUTCMonth() + 1) + '-' +
|
||||
f(this.getUTCDate()) + 'T' +
|
||||
f(this.getUTCHours()) + ':' +
|
||||
f(this.getUTCMinutes()) + ':' +
|
||||
f(this.getUTCSeconds()) + 'Z' : null;
|
||||
};
|
||||
|
||||
String.prototype.toJSON =
|
||||
Number.prototype.toJSON =
|
||||
Boolean.prototype.toJSON = function (key) {
|
||||
return this.valueOf();
|
||||
};
|
||||
}
|
||||
|
||||
var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
|
||||
escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
|
||||
gap,
|
||||
indent,
|
||||
meta = { // table of character substitutions
|
||||
'\b': '\\b',
|
||||
'\t': '\\t',
|
||||
'\n': '\\n',
|
||||
'\f': '\\f',
|
||||
'\r': '\\r',
|
||||
'"' : '\\"',
|
||||
'\\': '\\\\'
|
||||
},
|
||||
rep;
|
||||
|
||||
|
||||
function quote(string) {
|
||||
|
||||
// If the string contains no control characters, no quote characters, and no
|
||||
// backslash characters, then we can safely slap some quotes around it.
|
||||
// Otherwise we must also replace the offending characters with safe escape
|
||||
// sequences.
|
||||
|
||||
escapable.lastIndex = 0;
|
||||
return escapable.test(string) ?
|
||||
'"' + string.replace(escapable, function (a) {
|
||||
var c = meta[a];
|
||||
return typeof c === 'string' ? c :
|
||||
'\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
|
||||
}) + '"' :
|
||||
'"' + string + '"';
|
||||
}
|
||||
|
||||
|
||||
function str(key, holder) {
|
||||
|
||||
// Produce a string from holder[key].
|
||||
|
||||
var i, // The loop counter.
|
||||
k, // The member key.
|
||||
v, // The member value.
|
||||
length,
|
||||
mind = gap,
|
||||
partial,
|
||||
value = holder[key];
|
||||
|
||||
// If the value has a toJSON method, call it to obtain a replacement value.
|
||||
|
||||
if (value && typeof value === 'object' &&
|
||||
typeof value.toJSON === 'function') {
|
||||
value = value.toJSON(key);
|
||||
}
|
||||
|
||||
// If we were called with a replacer function, then call the replacer to
|
||||
// obtain a replacement value.
|
||||
|
||||
if (typeof rep === 'function') {
|
||||
value = rep.call(holder, key, value);
|
||||
}
|
||||
|
||||
// What happens next depends on the value's type.
|
||||
|
||||
switch (typeof value) {
|
||||
case 'string':
|
||||
return quote(value);
|
||||
|
||||
case 'number':
|
||||
|
||||
// JSON numbers must be finite. Encode non-finite numbers as null.
|
||||
|
||||
return isFinite(value) ? String(value) : 'null';
|
||||
|
||||
case 'boolean':
|
||||
case 'null':
|
||||
|
||||
// If the value is a boolean or null, convert it to a string. Note:
|
||||
// typeof null does not produce 'null'. The case is included here in
|
||||
// the remote chance that this gets fixed someday.
|
||||
|
||||
return String(value);
|
||||
|
||||
// If the type is 'object', we might be dealing with an object or an array or
|
||||
// null.
|
||||
|
||||
case 'object':
|
||||
|
||||
// Due to a specification blunder in ECMAScript, typeof null is 'object',
|
||||
// so watch out for that case.
|
||||
|
||||
if (!value) {
|
||||
return 'null';
|
||||
}
|
||||
|
||||
// Make an array to hold the partial results of stringifying this object value.
|
||||
|
||||
gap += indent;
|
||||
partial = [];
|
||||
|
||||
// Is the value an array?
|
||||
|
||||
if (Object.prototype.toString.apply(value) === '[object Array]') {
|
||||
|
||||
// The value is an array. Stringify every element. Use null as a placeholder
|
||||
// for non-JSON values.
|
||||
|
||||
length = value.length;
|
||||
for (i = 0; i < length; i += 1) {
|
||||
partial[i] = str(i, value) || 'null';
|
||||
}
|
||||
|
||||
// Join all of the elements together, separated with commas, and wrap them in
|
||||
// brackets.
|
||||
|
||||
v = partial.length === 0 ? '[]' :
|
||||
gap ? '[\n' + gap +
|
||||
partial.join(',\n' + gap) + '\n' +
|
||||
mind + ']' :
|
||||
'[' + partial.join(',') + ']';
|
||||
gap = mind;
|
||||
return v;
|
||||
}
|
||||
|
||||
// If the replacer is an array, use it to select the members to be stringified.
|
||||
|
||||
if (rep && typeof rep === 'object') {
|
||||
length = rep.length;
|
||||
for (i = 0; i < length; i += 1) {
|
||||
k = rep[i];
|
||||
if (typeof k === 'string') {
|
||||
v = str(k, value);
|
||||
if (v) {
|
||||
partial.push(quote(k) + (gap ? ': ' : ':') + v);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
// Otherwise, iterate through all of the keys in the object.
|
||||
|
||||
for (k in value) {
|
||||
if (Object.hasOwnProperty.call(value, k)) {
|
||||
v = str(k, value);
|
||||
if (v) {
|
||||
partial.push(quote(k) + (gap ? ': ' : ':') + v);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Join all of the member texts together, separated with commas,
|
||||
// and wrap them in braces.
|
||||
|
||||
v = partial.length === 0 ? '{}' :
|
||||
gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' +
|
||||
mind + '}' : '{' + partial.join(',') + '}';
|
||||
gap = mind;
|
||||
return v;
|
||||
}
|
||||
}
|
||||
|
||||
// If the JSON object does not yet have a stringify method, give it one.
|
||||
|
||||
if (typeof JSON.stringify !== 'function') {
|
||||
JSON.stringify = function (value, replacer, space) {
|
||||
|
||||
// The stringify method takes a value and an optional replacer, and an optional
|
||||
// space parameter, and returns a JSON text. The replacer can be a function
|
||||
// that can replace values, or an array of strings that will select the keys.
|
||||
// A default replacer method can be provided. Use of the space parameter can
|
||||
// produce text that is more easily readable.
|
||||
|
||||
var i;
|
||||
gap = '';
|
||||
indent = '';
|
||||
|
||||
// If the space parameter is a number, make an indent string containing that
|
||||
// many spaces.
|
||||
|
||||
if (typeof space === 'number') {
|
||||
for (i = 0; i < space; i += 1) {
|
||||
indent += ' ';
|
||||
}
|
||||
|
||||
// If the space parameter is a string, it will be used as the indent string.
|
||||
|
||||
} else if (typeof space === 'string') {
|
||||
indent = space;
|
||||
}
|
||||
|
||||
// If there is a replacer, it must be a function or an array.
|
||||
// Otherwise, throw an error.
|
||||
|
||||
rep = replacer;
|
||||
if (replacer && typeof replacer !== 'function' &&
|
||||
(typeof replacer !== 'object' ||
|
||||
typeof replacer.length !== 'number')) {
|
||||
throw new Error('JSON.stringify');
|
||||
}
|
||||
|
||||
// Make a fake root object containing our value under the key of ''.
|
||||
// Return the result of stringifying the value.
|
||||
|
||||
return str('', {'': value});
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// If the JSON object does not yet have a parse method, give it one.
|
||||
|
||||
if (typeof JSON.parse !== 'function') {
|
||||
JSON.parse = function (text, reviver) {
|
||||
|
||||
// The parse method takes a text and an optional reviver function, and returns
|
||||
// a JavaScript value if the text is a valid JSON text.
|
||||
|
||||
var j;
|
||||
|
||||
function walk(holder, key) {
|
||||
|
||||
// The walk method is used to recursively walk the resulting structure so
|
||||
// that modifications can be made.
|
||||
|
||||
var k, v, value = holder[key];
|
||||
if (value && typeof value === 'object') {
|
||||
for (k in value) {
|
||||
if (Object.hasOwnProperty.call(value, k)) {
|
||||
v = walk(value, k);
|
||||
if (v !== undefined) {
|
||||
value[k] = v;
|
||||
} else {
|
||||
delete value[k];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return reviver.call(holder, key, value);
|
||||
}
|
||||
|
||||
|
||||
// Parsing happens in four stages. In the first stage, we replace certain
|
||||
// Unicode characters with escape sequences. JavaScript handles many characters
|
||||
// incorrectly, either silently deleting them, or treating them as line endings.
|
||||
|
||||
cx.lastIndex = 0;
|
||||
if (cx.test(text)) {
|
||||
text = text.replace(cx, function (a) {
|
||||
return '\\u' +
|
||||
('0000' + a.charCodeAt(0).toString(16)).slice(-4);
|
||||
});
|
||||
}
|
||||
|
||||
// In the second stage, we run the text against regular expressions that look
|
||||
// for non-JSON patterns. We are especially concerned with '()' and 'new'
|
||||
// because they can cause invocation, and '=' because it can cause mutation.
|
||||
// But just to be safe, we want to reject all unexpected forms.
|
||||
|
||||
// We split the second stage into 4 regexp operations in order to work around
|
||||
// crippling inefficiencies in IE's and Safari's regexp engines. First we
|
||||
// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
|
||||
// replace all simple value tokens with ']' characters. Third, we delete all
|
||||
// open brackets that follow a colon or comma or that begin the text. Finally,
|
||||
// we look to see that the remaining characters are only whitespace or ']' or
|
||||
// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
|
||||
|
||||
if (/^[\],:{}\s]*$/.
|
||||
test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@').
|
||||
replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
|
||||
replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
|
||||
|
||||
// In the third stage we use the eval function to compile the text into a
|
||||
// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
|
||||
// in JavaScript: it can begin a block or an object literal. We wrap the text
|
||||
// in parens to eliminate the ambiguity.
|
||||
|
||||
j = eval('(' + text + ')');
|
||||
|
||||
// In the optional fourth stage, we recursively walk the new structure, passing
|
||||
// each name/value pair to a reviver function for possible transformation.
|
||||
|
||||
return typeof reviver === 'function' ?
|
||||
walk({'': j}, '') : j;
|
||||
}
|
||||
|
||||
// If the text is not JSON parseable, then a SyntaxError is thrown.
|
||||
|
||||
throw new SyntaxError('JSON.parse');
|
||||
};
|
||||
}
|
||||
}());
|
||||
String.prototype.format = function()
|
||||
{
|
||||
var formatted = this;
|
||||
for (var i = 0; i < arguments.length; i++)
|
||||
{
|
||||
var regexp = new RegExp('\\{'+i+'\\}', 'gi');
|
||||
formatted = formatted.replace(regexp, arguments[i]);
|
||||
}
|
||||
return formatted;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// include=reservableequipment lijkt een 404 te geven maar de volgende werkt wel?
|
||||
// http://uwva.facws001/branch20171/api2/reservablerooms/10802.html?include=reservableequipment
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
WScript.Echo("Zorg dat je Fiddler open hebt staan");
|
||||
|
||||
var G_fclt_url = 'http://uwva.facws001.sg.nl/trunk/';
|
||||
var G_fclt_url = 'http://uwva.lokalhost/trunk/';
|
||||
//var G_fclt_url = 'http://uwva.facws001/branch20171/';
|
||||
var G_fclt_apikey = 'APIPFO';
|
||||
|
||||
var apis = getAPI2JSON("GET", "apis");
|
||||
for (var api in apis.apis)
|
||||
{
|
||||
testOne(apis.apis[api].id, apis.apis[api].docparam);
|
||||
}
|
||||
|
||||
|
||||
function testOne(api2_name, docparam)
|
||||
{
|
||||
var url = "{0}".format(api2_name);
|
||||
var data = getAPI2JSON("GET", url + (docparam?"?x=1"+docparam:""));
|
||||
if (!data)
|
||||
return;
|
||||
if (api2_name in data)
|
||||
{
|
||||
if (data[api2_name].length && data[api2_name] instanceof Array)
|
||||
{
|
||||
var model = getAPI2JSON("GET", api2_name + ".api" + (docparam?"?x=1"+docparam:""));
|
||||
if (!model)
|
||||
{
|
||||
WScript.echo("GET van api2_name + ".api + " werkt niet?");
|
||||
return;
|
||||
}
|
||||
|
||||
url += "/" + data[api2_name][0]["id"];
|
||||
var data = getAPI2JSON("GET", url + (docparam?"?x=1"+docparam:""));
|
||||
if (!(model.record_name in data))
|
||||
{
|
||||
WScript.echo("Data niet gevonden?");
|
||||
return;
|
||||
}
|
||||
|
||||
if ("includes" in model)
|
||||
{
|
||||
for (var inc in model.includes)
|
||||
var data = getAPI2JSON("GET", url + "?include=" + model.includes[inc]);
|
||||
if (!model)
|
||||
{
|
||||
WScript.echo("GET van " + url + "?include=" + model.includes[inc] + " werkt niet?");
|
||||
return;
|
||||
}
|
||||
if (!(model.record_name in data))
|
||||
{
|
||||
WScript.echo("Data niet gevonden als include toegevoegd?");
|
||||
WScript.Quit();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getAPI2JSON(method, url, data)
|
||||
{
|
||||
var url = G_fclt_url + "api2/" + url;
|
||||
WScript.Echo("Getting: " + url);
|
||||
var objXMLHTTP = FcltAPI2("GET", url);
|
||||
if (objXMLHTTP)
|
||||
{
|
||||
return eval ("(" + objXMLHTTP.responseText + ")");
|
||||
}
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
function FcltAPI2(method, url, data)
|
||||
{
|
||||
var objXMLHTTP = new ActiveXObject("MSXML2.ServerXMLHTTP.6.0");
|
||||
var SXH_PROXY_SET_PROXY = 2;
|
||||
objXMLHTTP.setProxy(SXH_PROXY_SET_PROXY, "127.0.0.1:8888");
|
||||
|
||||
objXMLHTTP.open(method, url, false);
|
||||
objXMLHTTP.setRequestHeader ("X-FACILITOR-API-Key", G_fclt_apikey);
|
||||
objXMLHTTP.setRequestHeader ("Accept", "application/json");
|
||||
objXMLHTTP.send(data);
|
||||
if (objXMLHTTP.status >= 200 && objXMLHTTP.status <= 299)
|
||||
{
|
||||
return objXMLHTTP;
|
||||
}
|
||||
WScript.Echo(objXMLHTTP.responseText);
|
||||
WScript.Echo(objXMLHTTP.status);
|
||||
WScript.Echo(objXMLHTTP.statusText);
|
||||
return null;
|
||||
}
|
||||
@@ -6,8 +6,8 @@ function callbackDone(data, textStatus, jqXHR)
|
||||
$("#StatusText").text(textStatus);
|
||||
$("#Duration").text(Math.floor(new Date - tm) + "ms");
|
||||
var txt = String(jqXHR.responseText);
|
||||
txt = txt.replace(/\012/ig, "\n\r"); // beter in IE
|
||||
$("#Result").text(txt);
|
||||
$("#ResultSize").text(txt.length);
|
||||
|
||||
var objects_count = 1;
|
||||
if (jqXHR.responseText.indexOf("[") > 0)
|
||||
@@ -23,6 +23,7 @@ function callbackFail(jqXHR, textStatus, errorThrown)
|
||||
$("#Status").text(jqXHR.status + " " + (typeof errorThrown == "string"?errorThrown:errorThrown.message)).css("background-color", "red");
|
||||
$("#StatusText").text(textStatus);
|
||||
var txt = String(jqXHR.responseText);
|
||||
txt = txt.replace(/\012/ig, "\n\r"); // beter in IE
|
||||
$("#Result").text(txt);
|
||||
}
|
||||
function doSubmit()
|
||||
@@ -41,9 +42,7 @@ function doSubmit()
|
||||
tm = new Date;
|
||||
$.ajax(url, { type: method,
|
||||
data: data,
|
||||
headers: { "X-FACILITOR-API-Key": apikey,
|
||||
"X-CSRF-TOKEN": RVT_token
|
||||
}
|
||||
headers: { "X-FACILITOR-API-Key": apikey }
|
||||
// dan werkt de header niet dataType: "jsonp"
|
||||
}
|
||||
).done(callbackDone).fail(callbackFail);
|
||||
@@ -74,30 +73,17 @@ function doBuild()
|
||||
|
||||
function doInit()
|
||||
{
|
||||
var apikey = $("#apikey").val();
|
||||
//jQuery.support.cors = true; // in IE niet al te moeilijk doen over cross-domain.
|
||||
var url = $("#urlbase").val() + "/api2/apis.json";
|
||||
$.ajax(url, { type: "GET",
|
||||
//data: data,
|
||||
headers: { "X-FACILITOR-API-Key": apikey,
|
||||
"X-CSRF-TOKEN": RVT_token
|
||||
}
|
||||
// dan werkt de header niet dataType: "jsonp"
|
||||
}
|
||||
).done(process_api_list).fail(callbackFail);
|
||||
var path = "appl/api2";
|
||||
$.getJSON("get_apinames.asp?3", process_api_list);
|
||||
}
|
||||
|
||||
function process_api_list(data)
|
||||
{
|
||||
$("#api").empty();
|
||||
var lastmodule = "";
|
||||
$.each( data.apis
|
||||
$.each( data.apinames
|
||||
, function (index, value)
|
||||
{
|
||||
if (lastmodule != this.modulecode)
|
||||
$("#api").append("<optgroup label='" + this.modulecode + ": " + this.module + "'></option>");
|
||||
lastmodule = this.modulecode;
|
||||
var apiname = this.id;
|
||||
apiname = data.apinames[index];
|
||||
$("#api").append("<option value="+ apiname +">" + apiname + "</option>");
|
||||
}
|
||||
);
|
||||
|
||||
@@ -12,12 +12,11 @@
|
||||
*/
|
||||
%>
|
||||
<!-- #include file="../Shared/save2db.inc" -->
|
||||
<!-- #include file="api2_tools.inc" -->
|
||||
<%
|
||||
api2 = {
|
||||
form2JSONdata: function _form2JSONdata(model, params, formfields) // Maak een jsondata-object voor gebruik vanuit model_xxx.inc
|
||||
{
|
||||
var jsondata = {id: params.filter.id};
|
||||
var jsondata ={id: params.filter.id};
|
||||
|
||||
// Form parameters van gewone velden.
|
||||
for (i=0; i<formfields.length; i++)
|
||||
@@ -82,10 +81,7 @@ api2 = {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (params.multiadd == formfields[i].frm)
|
||||
val = getFParamIntArray(formfields[i].frm, null);
|
||||
else
|
||||
val = getFParamInt(formfields[i].frm, null);
|
||||
val = getFParamInt(formfields[i].frm, null);
|
||||
}
|
||||
break;
|
||||
case "check":
|
||||
@@ -101,13 +97,6 @@ api2 = {
|
||||
case "varchar":
|
||||
val = getFParam(formfields[i].frm, null);
|
||||
break;
|
||||
case "processingtime":
|
||||
val = {
|
||||
"duration": getFParamFloat(formfields[i].frm, null),
|
||||
"unit": getFParam(formfields[i].frm + "_eenheid", "D")
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
{
|
||||
__DoLog(model.fields[formfields[i].name].typ);
|
||||
@@ -134,7 +123,6 @@ api2 = {
|
||||
if (fld.substring(0,1) == "_")
|
||||
continue;
|
||||
var field = model.fields[fld];
|
||||
|
||||
if ("filter" in field)
|
||||
var filter = field.filter
|
||||
else // default filtertypes
|
||||
@@ -155,7 +143,6 @@ api2 = {
|
||||
break;
|
||||
case "varchar":
|
||||
case "memo":
|
||||
case "html":
|
||||
filter = "like";
|
||||
break;
|
||||
case "date":
|
||||
@@ -184,9 +171,6 @@ api2 = {
|
||||
continue;
|
||||
if (filterval < 0 && field.typ == "key")
|
||||
continue;
|
||||
if (filter == "like" && typeof filterval == "string" &&
|
||||
(filterval.toUpperCase() == "NULL" || filterval.toUpperCase() == "NOT NULL"))
|
||||
continue; // niet compatible met "like" filter
|
||||
}
|
||||
|
||||
// Voor ranges komt de naam (misschien) niet letterlijk voor, maar (mogelijk) met start_ of end_ ervoor
|
||||
@@ -199,26 +183,18 @@ api2 = {
|
||||
filterval1 = filterval;
|
||||
if ((filterval1 === "" || filterval1 === null) && (filterval2 === "" || filterval2 === null))
|
||||
continue;
|
||||
if (typeof filterval1 == "string" && (filterval1.toUpperCase() == "NULL" || filterval1.toUpperCase() == "NOT NULL"))
|
||||
continue; // niet compatible met "range" filter
|
||||
}
|
||||
// Nu is ook voor ranges alles weer normaal
|
||||
var clause;
|
||||
var operand = " = ";
|
||||
if (filterval && typeof filterval == "string" &&
|
||||
(filterval.toUpperCase() == "NULL" || filterval.toUpperCase() == "NOT NULL"))
|
||||
{
|
||||
operand = " IS ";
|
||||
var safe_val = filterval;
|
||||
}
|
||||
else switch (field.typ)
|
||||
switch (field.typ)
|
||||
{
|
||||
case "key":
|
||||
if (!filterval)
|
||||
continue;
|
||||
if (filterval instanceof Array)
|
||||
{
|
||||
safe_val = filterval.join(", ");
|
||||
safe_val = filterval.join(",");
|
||||
if (typeof filter != 'function')
|
||||
safe_val = "(" + safe_val + ")";
|
||||
operand = " IN ";
|
||||
@@ -254,10 +230,7 @@ api2 = {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (String(filterval).toLowerCase() == "self")
|
||||
var safe_val = user_key;
|
||||
else
|
||||
var safe_val = parseInt(filterval, 10);
|
||||
var safe_val = parseInt(filterval, 10);
|
||||
if (isNaN(safe_val))
|
||||
{
|
||||
return ["0=1"];
|
||||
@@ -315,14 +288,7 @@ api2 = {
|
||||
break;
|
||||
case "check":
|
||||
case "check0":
|
||||
if (filterval == "on")
|
||||
var safe_val = 1;
|
||||
else if (filterval == "off")
|
||||
var safe_val = 0;
|
||||
else
|
||||
var safe_val = parseInt(filterval, 10);
|
||||
if (field.invert)
|
||||
safe_val = (safe_val==1?0:1);
|
||||
var safe_val = parseInt(filterval, 10);
|
||||
if (isNaN(safe_val))
|
||||
{
|
||||
return ["0=1"]; // niets gevonden
|
||||
@@ -330,7 +296,6 @@ api2 = {
|
||||
break;
|
||||
case "varchar": // Als fld.match(/^fclt_d_/) dan is het een old-style rapport filterveld
|
||||
case "memo":
|
||||
case "html":
|
||||
if (filterval instanceof Array)
|
||||
{
|
||||
safe_val = safe.quoted_sql_join(filterval);
|
||||
@@ -348,12 +313,7 @@ api2 = {
|
||||
var safe_val = safe.quoted_sql_wild(filterval);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (field.caseinsensitive)
|
||||
var safe_val = safe.quoted_sql_upper(filterval);
|
||||
else
|
||||
var safe_val = safe.quoted_sql(filterval);
|
||||
}
|
||||
var safe_val = safe.quoted_sql(filterval);
|
||||
break;
|
||||
case "like":
|
||||
var safe_val = safe.quoted_sql_wild("%"+filterval+"%");
|
||||
@@ -399,12 +359,12 @@ api2 = {
|
||||
if (filterval1) {
|
||||
var safe_val1 = api2.toDate(filterval1);
|
||||
var withtime = (field.typ == "datetime" && api2.hasTime(safe_val1));
|
||||
safe_val1 = withtime?safe_val1.toSQL(true, true):safe_val1.beginToSQL();
|
||||
safe_val1 = withtime?safe_val1.toSQL(true):safe_val1.beginToSQL();
|
||||
}
|
||||
if (filterval2) {
|
||||
var safe_val2 = api2.toDate(filterval2);
|
||||
var withtime = (field.typ == "datetime" && api2.hasTime(safe_val2));
|
||||
safe_val2 = withtime?safe_val2.toSQL(true, true):safe_val2.endToSQL();
|
||||
safe_val2 = withtime?safe_val2.toSQL(true):safe_val2.endToSQL();
|
||||
}
|
||||
if (filterval1 && filterval2) {
|
||||
operand = " BETWEEN ";
|
||||
@@ -434,17 +394,11 @@ api2 = {
|
||||
{
|
||||
if (operand != " IN ")
|
||||
operand = " LIKE ";
|
||||
if (field.typ == "varchar" || field.typ == "memo" || field.typ == "html")
|
||||
if (field.typ == "varchar" || field.typ == "memo")
|
||||
{
|
||||
if (field.islcl)
|
||||
dbs = 'lcl.l({0}, 1)'.format(dbs);
|
||||
field.caseinsensitive = true;
|
||||
}
|
||||
}
|
||||
if (field.caseinsensitive)
|
||||
{
|
||||
dbs = "UPPER(" + dbs + ")";
|
||||
dbs = "UPPER("+dbs+")";
|
||||
safe_val = safe_val.toUpperCase();
|
||||
}
|
||||
}
|
||||
if (filter == "range" && fld.match(/^fclt_d_/))
|
||||
{
|
||||
@@ -572,17 +526,6 @@ api2 = {
|
||||
dbs = model.aliasprefix + fld;
|
||||
selects.push(field.sql + " AS " + dbs);
|
||||
}
|
||||
else if (field.typ == "processingtime")
|
||||
{
|
||||
var sqltijd = "(SELECT xx." + field.dbs + ".tijdsduur"
|
||||
+ " FROM " + model.table + " xx"
|
||||
+ " WHERE xx." + model.primary + " = " + model.table + "." + model.primary + ")";
|
||||
selects.push(sqltijd + " AS " + fld + "_tijdsduur");
|
||||
var sqleenh = "(SELECT xx." + field.dbs + ".eenheid"
|
||||
+ " FROM " + model.table + " xx"
|
||||
+ " WHERE xx." + model.primary + " = " + model.table + "." + model.primary + ")";
|
||||
selects.push(sqleenh + " AS " + fld + "_eenheid");
|
||||
}
|
||||
else if (dbs)
|
||||
{
|
||||
// veldnamen moeten gelijk zijn bij het ophalen. Zie ook: sql2jsonval
|
||||
@@ -685,20 +628,14 @@ api2 = {
|
||||
var incquery = api2.sqlfields(params, inc.model);
|
||||
|
||||
selects = selects.concat (incquery.selects);
|
||||
if (inc.model.gparams && inc.model.gparams.GET.wheres)
|
||||
{
|
||||
var tablesql = "(SELECT * FROM {0} WHERE {1}) {2}".format(incquery.tables.join(", "),
|
||||
inc.model.gparams.GET.wheres.join(" AND "),
|
||||
inc.model.table);
|
||||
tables.push(tablesql);
|
||||
}
|
||||
else
|
||||
tables = tables.concat (incquery.tables);
|
||||
tables = tables.concat (incquery.tables);
|
||||
wheres = wheres.concat (incquery.wheres);
|
||||
|
||||
if (inc.model.gparams && inc.model.gparams.GET.tables)
|
||||
tables = tables.concat(inc.model.gparams.GET.tables);
|
||||
|
||||
if (inc.model.gparams && inc.model.gparams.GET.wheres)
|
||||
wheres = wheres.concat(inc.model.gparams.GET.wheres);
|
||||
|
||||
// Bij includes tonen we ook verwijderde records indien gewenst.
|
||||
if (inc.model.soft_delete &&
|
||||
@@ -775,8 +712,6 @@ api2 = {
|
||||
continue;
|
||||
if (field.readonly)
|
||||
continue;
|
||||
if (field.insertonly && !params.isNew)
|
||||
continue;
|
||||
|
||||
if (field.fnval)
|
||||
var newval = field.fnval(jsondata);
|
||||
@@ -791,30 +726,10 @@ api2 = {
|
||||
switch (field.typ)
|
||||
{
|
||||
case "key": // De foreign keys action { "id": "5", "name": "afhalen" }
|
||||
if (newval && typeof newval == "object")
|
||||
{
|
||||
if ("id" in newval)
|
||||
{ // dereference
|
||||
newval = newval.id;
|
||||
jsondata[fld] = newval;
|
||||
}
|
||||
else if ("name" in newval && field.foreign && typeof field.foreign != 'function')
|
||||
{
|
||||
if (typeof field.foreign == 'string')
|
||||
{
|
||||
field.foreign = foreignKeyTable(field.foreign);
|
||||
}
|
||||
if (field.foreign.desc_is_unique) // Dan mag je die bij saven ook opgeven
|
||||
{
|
||||
field.typ = "sql";
|
||||
var where = "{0} = {1}".format(field.foreign.desc, safe.quoted_sql(newval.name));
|
||||
if (typeof field.foreign.desc_is_unique == "string")
|
||||
where += " AND " + field.foreign.desc_is_unique;
|
||||
newval = "(SELECT {0} FROM {1} WHERE {2})".format(field.foreign.key,
|
||||
field.foreign.tbl,
|
||||
where);
|
||||
}
|
||||
}
|
||||
if (newval && typeof newval == "object" && "id" in newval)
|
||||
{ // dereference
|
||||
newval = newval.id;
|
||||
jsondata[fld] = newval;
|
||||
}
|
||||
break;
|
||||
case "date":
|
||||
@@ -876,50 +791,39 @@ api2 = {
|
||||
|
||||
var incmodel = inc.model;
|
||||
|
||||
// Vul existing_includes met bestaande records in de database
|
||||
var sql = "SELECT " + incmodel.primary
|
||||
+ " FROM " + incmodel.table
|
||||
+ " WHERE " + incmodel.table + "." + incmodel.fields[inc.joinfield].dbs + "=" + the_key;
|
||||
var existing_includes = {};
|
||||
if (!params.isNew)
|
||||
var oRs = Oracle.Execute(sql);
|
||||
while (!oRs.Eof)
|
||||
{
|
||||
// Vul existing_includes met bestaande records in de database
|
||||
if ("fntablesql" in incmodel)
|
||||
incmodel.tablesql = incmodel.fntablesql();
|
||||
|
||||
var sql = "SELECT " + incmodel.primary
|
||||
+ " FROM " + (incmodel.tablesql || incmodel.table)
|
||||
+ " WHERE " + incmodel.table + "." + incmodel.fields[inc.joinfield].dbs + "=" + the_key;
|
||||
var oRs = Oracle.Execute(sql);
|
||||
while (!oRs.Eof)
|
||||
{
|
||||
existing_includes[oRs(incmodel.primary).Value] = { found: false }; // vooralsnog niet in json-data gevonden
|
||||
oRs.MoveNext();
|
||||
}
|
||||
oRs.Close();
|
||||
existing_includes[oRs(incmodel.primary).Value] = { found: false }; // vooralsnog niet in json-data gevonden
|
||||
oRs.MoveNext();
|
||||
}
|
||||
oRs.Close();
|
||||
var incdata = jsondata[incname]; // Array zoals via API aangeleverd
|
||||
for (var j=0; j<incdata.length; j++)
|
||||
{
|
||||
var inckey = incdata[j][incmodel.keyfield || "id"]; // Die kan er zijn. custom_field werkt via keyfield
|
||||
if (incmodel.keyfield || !(inckey > 0) || params.isNew)
|
||||
var inckey = incdata[j]["id"]; // Die moet er zijn
|
||||
if (!inckey || inckey < 0 || params.isNew)
|
||||
{
|
||||
delete incdata[j]["id"]; // voor als je bij isNew toch keys had meegegeven
|
||||
incdata[j][inc.joinfield] = the_key; // de parent_key altijd zetten
|
||||
__Log("Nu ga ik een '{0}' toevoegen".format(incname));
|
||||
incmodel.REST_POST(params, incdata[j], the_key);
|
||||
}
|
||||
else if (inckey in existing_includes)
|
||||
{
|
||||
__Log("Nu ga ik '{0}' {1} updaten".format(incname, inckey));
|
||||
incmodel.REST_PUT(params, incdata[j], inckey, the_key);
|
||||
incmodel.REST_PUT(params, incdata[j], inckey);
|
||||
existing_includes[inckey].found = true;
|
||||
}
|
||||
}
|
||||
if (!incmodel.keyfield) // niet voor custom_fields
|
||||
for (oldi in existing_includes)
|
||||
{
|
||||
for (oldi in existing_includes)
|
||||
if (!existing_includes[oldi].found)
|
||||
{
|
||||
if (!existing_includes[oldi].found)
|
||||
{
|
||||
incmodel.REST_DELETE(params, oldi);
|
||||
}
|
||||
incmodel.REST_DELETE(params, oldi);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -931,45 +835,33 @@ api2 = {
|
||||
}
|
||||
},
|
||||
// Geeft de GET terug van een enkel veld
|
||||
// Onder bepaalde omstandigheden wordt deze functie *heel* veel aangroepen
|
||||
// Houd hem daarom efficient.
|
||||
sql2jsonval: function _sql2jsonval(oRs, fld, model)
|
||||
{
|
||||
var field = model.fields[fld];
|
||||
var sqlfieldname = (model.aliasprefix ? api2.sqlfield_alias(model, fld) : field.dbs);
|
||||
|
||||
if (field.typ == "processingtime")
|
||||
{
|
||||
var val = { "duration": oRs(fld + "_tijdsduur").Value,
|
||||
"unit": oRs(fld + "_eenheid").Value
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
if (field.val instanceof Function)
|
||||
var val = field.val(oRs, field, model, sqlfieldname);
|
||||
else if (field.dbs.indexOf(".") < 0)
|
||||
{
|
||||
var val = oRs(sqlfieldname).Value;
|
||||
}
|
||||
else
|
||||
var val = oRs(field.dbs.split(".")[1]).Value;
|
||||
|
||||
if (val === null && !field.invert)
|
||||
return val;
|
||||
|
||||
switch (field.typ)
|
||||
if (field.typ == "check" || field.typ == "check0")
|
||||
{
|
||||
case "check":
|
||||
case "check0":
|
||||
if (field.invert)
|
||||
val = (val==1?0:1);
|
||||
return val;
|
||||
break;
|
||||
case "date":
|
||||
case "datetime":
|
||||
case "time": // In de database ondersteunen we dit niet maar komt voor bij fac_report
|
||||
return new Date(val);
|
||||
break;
|
||||
if (field.invert)
|
||||
val = (val==1?0:1);
|
||||
}
|
||||
|
||||
if (val === null)
|
||||
return val;
|
||||
if (field.typ == "date")
|
||||
val = new Date(val);
|
||||
if (field.typ == "datetime")
|
||||
val = new Date(val);
|
||||
if (field.typ == "time") // In de database ondersteunen we dit niet maar komt voor bij fac_report
|
||||
val = new Date(val);
|
||||
// Wat te doen met lege waarde
|
||||
// action: null
|
||||
// action: {key: null, name: null}
|
||||
@@ -1025,19 +917,14 @@ api2 = {
|
||||
result.push(filter[f] + ";" + spl[filter[f]]);
|
||||
return result.join(";");
|
||||
},
|
||||
splitLOV: function _splitLOV(LOV, nameprefix)
|
||||
splitLOV: function _splitLOV(LOV)
|
||||
{
|
||||
var splits = LOV.split(";");
|
||||
if (splits % 2)
|
||||
abort_with_warning("LOV '{0}' mismatch".format(LOV));
|
||||
var result = {};
|
||||
for (var i=0; i < splits.length / 2; i++)
|
||||
{
|
||||
var name = splits[i*2];
|
||||
if (nameprefix)
|
||||
name = nameprefix + name;
|
||||
result[name] = splits[i*2 + 1];
|
||||
}
|
||||
result[splits[i*2]] = splits[i*2 + 1];
|
||||
return result;
|
||||
},
|
||||
splitLOV2sql: function _splitLOV(LOV)
|
||||
@@ -1083,8 +970,7 @@ api2 = {
|
||||
return timetable.join(";");
|
||||
},
|
||||
// Geef alle velden van een record terug
|
||||
// ?? Alleen bij includes in gebruik ??
|
||||
sql2jsonfields: function _sql2jsonfields(params, oRs, model)
|
||||
sql2jsonfields: function _sql2jsonfields(oRs, model)
|
||||
{
|
||||
var record = {};
|
||||
for (var fld in model.fields)
|
||||
@@ -1102,7 +988,7 @@ api2 = {
|
||||
record[fld] = val;
|
||||
}
|
||||
if ("post_get" in model)
|
||||
model.post_get(params, record);
|
||||
model.post_get(record);
|
||||
return record;
|
||||
},
|
||||
sql2json: function _sql2json(params, sql, model)
|
||||
@@ -1117,10 +1003,10 @@ api2 = {
|
||||
var oRs = Oracle.Execute(sql, params.errmsg);
|
||||
if (params.errmsg && oRs.friendlyMsg)
|
||||
{
|
||||
var record = {};
|
||||
record[model.list.columns[0]] = oRs.friendlyMsg;
|
||||
data.push(record);
|
||||
return data;
|
||||
var record = {};
|
||||
record[model.list.columns[0]] = oRs.friendlyMsg;
|
||||
data.push(record);
|
||||
return data;
|
||||
}
|
||||
|
||||
var lastkey = 0;
|
||||
@@ -1133,8 +1019,6 @@ api2 = {
|
||||
limit = params.filter.limit;
|
||||
if (params.filter.nolimit || limit == -1)
|
||||
limit = 99999999; // Excel/CSV alles tonen
|
||||
|
||||
var to_skip = params.filter.offset || 0;
|
||||
while (!oRs.Eof)
|
||||
{
|
||||
if (data.length >= limit) // Alleen nog maar tellen
|
||||
@@ -1153,7 +1037,6 @@ api2 = {
|
||||
oRs.MoveNext();
|
||||
continue;
|
||||
}
|
||||
var newrecord = true;
|
||||
if (model.primary)
|
||||
{
|
||||
var key = oRs(model.primary).Value;
|
||||
@@ -1166,18 +1049,13 @@ api2 = {
|
||||
|
||||
if (lastkey && !isEmptyObject(record)) // Record was er mogelijk uit gefilterd
|
||||
{
|
||||
if (to_skip > 0)
|
||||
to_skip --;
|
||||
else
|
||||
data.push(record);
|
||||
data.push(record);
|
||||
total_count ++;
|
||||
if (data.length == limit)
|
||||
continue; // alleen nog tellen, 'volgende' record niet meer opbouwen
|
||||
}
|
||||
var record = {};
|
||||
}
|
||||
else
|
||||
newrecord = false; // er komen nog wel include-records achteraan
|
||||
}
|
||||
|
||||
// Complexe filtering die we niet voor elkaar kregen met een WHERE-clause
|
||||
@@ -1192,24 +1070,19 @@ api2 = {
|
||||
}
|
||||
|
||||
var fld;
|
||||
if (newrecord) // dan moeten de velden van het basis model eerst
|
||||
for (fld in model.fields)
|
||||
{
|
||||
for (fld in model.fields)
|
||||
{
|
||||
if (fld.substring(0,1) == "_")
|
||||
continue;
|
||||
var field = model.fields[fld];
|
||||
if (field.hidden)
|
||||
continue;
|
||||
if ("fields" in params.filter && !inArray(fld, params.filter.fields.split(",")))
|
||||
continue;
|
||||
if (fld.substring(0,1) == "_")
|
||||
continue;
|
||||
var field = model.fields[fld];
|
||||
if (field.hidden)
|
||||
continue;
|
||||
|
||||
var val = api2.sql2jsonval(oRs, fld, model)
|
||||
//waarom was dit aanwezig?
|
||||
//if (field.readonly && !val.id)
|
||||
// continue;
|
||||
record[fld] = val;
|
||||
}
|
||||
var val = api2.sql2jsonval(oRs, fld, model)
|
||||
//waarom was dit aanwezig?
|
||||
//if (field.readonly && !val.id)
|
||||
// continue;
|
||||
record[fld] = val;
|
||||
}
|
||||
if (params.include && model.includes)
|
||||
{
|
||||
@@ -1227,19 +1100,9 @@ api2 = {
|
||||
{ // Standaard include via model. Ons 'hoofd' record zal meerdere keren
|
||||
// uit de query komen met telkens een ander 'include' record
|
||||
incmodel.aliasprefix = incmodel.aliasprefix || "";
|
||||
var inc_key = oRs(incmodel.aliasprefix + incmodel.primary).value;
|
||||
if (inc_key == null) // Geen record door outer join
|
||||
if (oRs(incmodel.aliasprefix + incmodel.primary).value == null) // Geen record door outer join
|
||||
continue;
|
||||
// Nu kan het zo zijn dat ons include record al eerder is toegevoegd
|
||||
// Kan gebeuren bij res_ruimte als je een include van res_alg_ruimte *en* opstelling doet
|
||||
var incfound = false;
|
||||
for (var i = 0; i < record[incname].length && !incfound; i++)
|
||||
{
|
||||
if (record[incname][i].id == inc_key)
|
||||
incfound = true;
|
||||
}
|
||||
if (!incfound)
|
||||
record[incname].push(api2.sql2jsonfields(params, oRs, incmodel));
|
||||
record[incname].push(api2.sql2jsonfields(oRs, incmodel));
|
||||
}
|
||||
else if (model.includes[incname].func) // include via callback functie zoals reservablerooms/occupation
|
||||
{
|
||||
@@ -1261,38 +1124,31 @@ api2 = {
|
||||
lastkey = key;
|
||||
if (!model.primary)
|
||||
{
|
||||
if (to_skip > 0)
|
||||
to_skip --;
|
||||
else
|
||||
data.push(record);
|
||||
data.push(record);
|
||||
record = {};
|
||||
total_count ++;
|
||||
}
|
||||
oRs.MoveNext();
|
||||
}
|
||||
oRs.Close();
|
||||
if (lastkey && data.length < limit)
|
||||
{
|
||||
total_count ++;
|
||||
if (to_skip > 0)
|
||||
to_skip --;
|
||||
else
|
||||
data.push(record);
|
||||
data.push(record);
|
||||
}
|
||||
if ("merged_model" in model) // de disc_params truc
|
||||
{
|
||||
model.merged_model.limit = limit;
|
||||
model.merged_model.offset = params.filter.offset || 0;
|
||||
//model.offset = offset;
|
||||
model.merged_model.total_count = total_count;
|
||||
}
|
||||
model.limit = limit;
|
||||
model.offset = params.filter.offset || 0;
|
||||
//model.offset = offset;
|
||||
model.total_count = total_count;
|
||||
return data;
|
||||
},
|
||||
error: function (code, msg)
|
||||
{
|
||||
abort_with_warning(msg, code);
|
||||
abort_with_warning(msg, code)
|
||||
},
|
||||
find_fieldindex_by_dbsname: function(array, value)
|
||||
{
|
||||
@@ -1382,7 +1238,7 @@ api2 = {
|
||||
if (dt && dt instanceof Date)
|
||||
return dt;
|
||||
}
|
||||
api2.error(400, "Invalid date format");
|
||||
NOT_A_DATE;
|
||||
},
|
||||
generic_REST: function(model, gparams)
|
||||
{
|
||||
@@ -1403,30 +1259,6 @@ api2 = {
|
||||
model.REST_DELETE = generic_REST_DELETE(model, gparams);
|
||||
}
|
||||
},
|
||||
GET: function _GET(model, key, params) // Haal <20><>n enkel record op of null als niet gevonden
|
||||
{ // Key is optioneel, dan meot je zelf in params maar goed filteren
|
||||
if (typeof key == "object")
|
||||
{
|
||||
params = key;
|
||||
key = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
params = params || {};
|
||||
params.filter = params.filter || {};
|
||||
params.filter.id = key;
|
||||
}
|
||||
|
||||
var xxx_array = model.REST_GET(params);
|
||||
if (!xxx_array.length)
|
||||
return null;
|
||||
return xxx_array[0];
|
||||
},
|
||||
POST: function _POST(model, jsondata, parent_key) // Maak <20><>n enkel record aan
|
||||
{ // Key is optioneel, dan meot je zelf in params maar goed filteren
|
||||
var params = {};
|
||||
return model.REST_POST(params, jsondata, parent_key);
|
||||
},
|
||||
merge_disc_params_model: function(deze, template_model)
|
||||
{
|
||||
template_model.merged_model = deze; // hebben we nodig om total_count te kunnen zetten
|
||||
@@ -1470,14 +1302,6 @@ function generic_REST_GET(model, gparams)
|
||||
var wheres = api2.sqlfilter(params, model);
|
||||
query.wheres = query.wheres.concat(wheres);
|
||||
|
||||
if ("disc_params" in model) // Daar mag je ook op filteren
|
||||
{
|
||||
if (params.filter && "id" in params.filter)
|
||||
delete params.filter.id; // anders wordt de disc_params_key onterecht gefilterd.
|
||||
var wheres = api2.sqlfilter(params, model.disc_params.model);
|
||||
query.wheres = query.wheres.concat(wheres);
|
||||
}
|
||||
|
||||
if (gparams.GET.tables)
|
||||
query.tables = query.tables.concat(gparams.GET.tables);
|
||||
|
||||
@@ -1505,10 +1329,7 @@ function generic_REST_GET(model, gparams)
|
||||
for (var i = 0; i < params.orderby.length; i++)
|
||||
{
|
||||
var field = model.fields[params.orderby[i]];
|
||||
if (field.sql)
|
||||
orderbys.push(field.sql);
|
||||
else
|
||||
orderbys.push(field._foreignname || field.dbs);
|
||||
orderbys.push(field._foreignname || field.dbs);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1526,9 +1347,9 @@ function generic_REST_GET(model, gparams)
|
||||
|
||||
if (!orderbys.length)
|
||||
{
|
||||
if (model.fields && "name" in model.fields)
|
||||
if ("name" in model.fields)
|
||||
orderbys.push(model.fields.name.dbs);
|
||||
else if (model.fields && "id" in model.fields)
|
||||
else if ("id" in model.fields)
|
||||
orderbys.push(model.fields.id.dbs);
|
||||
else
|
||||
orderbys.push(1); // FAC_VERSION heeft niets van dit alles
|
||||
@@ -1537,7 +1358,7 @@ function generic_REST_GET(model, gparams)
|
||||
sql += " ORDER BY " + orderbys.join(", "); // TODO: Altijd goed met includes?
|
||||
|
||||
// Probeer ook nog de 1e include te sorteren. Fraaier met subframes in scaffolding
|
||||
if (params.include && params.include.length && model.includes && params.include[0] in model.includes)
|
||||
if (params.include && params.include.length && model.includes)
|
||||
{
|
||||
var inc0 = model.includes[params.include[0]].model;
|
||||
if (inc0.fields["sequence"])
|
||||
@@ -1563,10 +1384,7 @@ function generic_REST_GET(model, gparams)
|
||||
var sql = "SELECT * FROM (" + sql + ") WHERE ROWNUM <= " + (maxcnt + 1); // Eentje extra om overflow-melding te triggeren in resultsettable
|
||||
}
|
||||
|
||||
if (model.fields)
|
||||
var json = api2.sql2json (params, sql, model);
|
||||
else
|
||||
json = {};
|
||||
var json = api2.sql2json (params, sql, model);
|
||||
|
||||
if ("disc_params" in model)
|
||||
{
|
||||
@@ -1592,14 +1410,11 @@ function generic_REST_POST(model, gparams)
|
||||
if (!model.fields["id"].seq) // We willen per se een sequence
|
||||
return false;
|
||||
|
||||
return function _generic_REST_POST(params, jsondata, parent_key)
|
||||
return function _generic_REST_POST(params, jsondata)
|
||||
{
|
||||
params.isNew = true; // negeer eventuele bestaande keys
|
||||
if (model.autfunction !== false)
|
||||
{
|
||||
var autparams = user.checkAutorisation(model.autfunction);
|
||||
user.auth_required_or_abort(autparams.PRSwritelevel < 9 && autparams.ALGwritelevel < 9);
|
||||
}
|
||||
user.auth_required_or_abort(autparams.PRSwritelevel < 9 && autparams.ALGwritelevel < 9);
|
||||
|
||||
if ("disc_params" in model)
|
||||
{
|
||||
@@ -1608,7 +1423,7 @@ function generic_REST_POST(model, gparams)
|
||||
var jsondata_dp = { };
|
||||
for (var fld in jsondata)
|
||||
{
|
||||
if (fld in model.disc_params.model.fields && !(fld in model.fields))
|
||||
if (fld in this.disc_params.model.fields && !(fld in model.fields))
|
||||
{
|
||||
jsondata_dp[fld] = jsondata[fld];
|
||||
delete jsondata[fld];
|
||||
@@ -1627,14 +1442,11 @@ function generic_REST_POST(model, gparams)
|
||||
var xxxIns = buildInsert(model.table, dbfields, { noValidateToken: true });
|
||||
var the_key = xxxIns.sequences[model.fields.id.dbs];
|
||||
// TODO: Generieke tracking?
|
||||
// TODO: de includes?
|
||||
|
||||
var err = Oracle.Execute(xxxIns.sql, true);
|
||||
if (err.friendlyMsg)
|
||||
api2.error(400, err.friendlyMsg); // Veronderstel Bad Request
|
||||
if (model.trackcode && user_key > 0) // Bij SAML user-provisioning is er nog niet niemand ingelogd.
|
||||
shared.trackaction(model.trackcode, the_key, L("lcl_inserted0").format(model.record_title));
|
||||
|
||||
var inctrack = api2.process_includes(params, model, jsondata, the_key);
|
||||
abort_with_warning(err.friendlyMsg);
|
||||
|
||||
if ("disc_params" in model)
|
||||
{
|
||||
@@ -1646,7 +1458,7 @@ function generic_REST_POST(model, gparams)
|
||||
var err = Oracle.Execute(xxxIns.sql, true);
|
||||
if (err.friendlyMsg)
|
||||
{
|
||||
var sql = "DELETE FROM " + model.table + " WHERE " + model.fields.id.dbs + " = " + the_key;
|
||||
var sql = "DELETE FROM " + this.table + " WHERE " + this.fields.id.dbs + " = " + the_key;
|
||||
Oracle.Execute(sql);
|
||||
abort_with_warning(err.friendlyMsg);
|
||||
}
|
||||
@@ -1663,10 +1475,8 @@ function generic_REST_PUT(model, gparams)
|
||||
return function _generic_REST_PUT(params, jsondata, the_key)
|
||||
{
|
||||
if (model.autfunction !== false)
|
||||
{
|
||||
var autparams = user.checkAutorisation(model.autfunction);
|
||||
user.auth_required_or_abort(autparams.PRSwritelevel < 9 && autparams.ALGwritelevel < 9);
|
||||
}
|
||||
user.auth_required_or_abort(autparams.PRSwritelevel < 9 && autparams.ALGwritelevel < 9);
|
||||
|
||||
if ("disc_params" in model)
|
||||
{
|
||||
@@ -1674,50 +1484,34 @@ function generic_REST_PUT(model, gparams)
|
||||
var jsondata_dp = { };
|
||||
for (var fld in jsondata)
|
||||
{
|
||||
if (fld in model.disc_params.model.fields && !(fld in model.fields))
|
||||
if (fld in this.disc_params.model.fields && !(fld in model.fields))
|
||||
{
|
||||
jsondata_dp[fld] = jsondata[fld];
|
||||
// delete jsondata[fld]; neen, dan gaat multi-save fout
|
||||
delete jsondata[fld];
|
||||
}
|
||||
}
|
||||
model.disc_params.model.fields[model.disc_params.joinfield].readonly = true; // Voor de zekerheid
|
||||
jsondata_dp[model.disc_params.joinfield] = the_key;
|
||||
jsondata_dp[this.disc_params.joinfield] = the_key;
|
||||
}
|
||||
|
||||
if (params.custom_fields_only)
|
||||
{
|
||||
var xxxUpd = { trackarray: [] };
|
||||
}
|
||||
else
|
||||
{
|
||||
var dbfields = api2.update_fields(params, model, jsondata);
|
||||
var wheres = [model.fields["id"].dbs + " = " + the_key];
|
||||
var xxxUpd = buildTrackingUpdate(model.table, wheres.join(" AND " ), dbfields, { noValidateToken: true });
|
||||
// TODO: Generieke tracking?
|
||||
var dbfields = api2.update_fields(params, model, jsondata);
|
||||
var wheres = [model.fields["id"].dbs + " = " + the_key];
|
||||
var xxxUpd = buildTrackingUpdate(model.table, wheres.join(" AND " ), dbfields, { noValidateToken: true });
|
||||
// TODO: Generieke tracking?
|
||||
// TODO: de includes?
|
||||
|
||||
if (xxxUpd) // Misschien geen velden opgegeven.
|
||||
{
|
||||
var err = Oracle.Execute(xxxUpd.sql, true);
|
||||
if (err.friendlyMsg)
|
||||
api2.error(400, err.friendlyMsg); // Veronderstel Bad Request
|
||||
if (model.trackcode && xxxUpd.trackarray.length > 0)
|
||||
shared.trackaction(model.trackcode, the_key, L("lcl_updated") + "\n" + xxxUpd.trackarray.join("\n"));
|
||||
}
|
||||
}
|
||||
var inctrack = api2.process_includes(params, model, jsondata, the_key);
|
||||
var err = Oracle.Execute(xxxUpd.sql, true);
|
||||
if (err.friendlyMsg)
|
||||
abort_with_warning(err.friendlyMsg);
|
||||
|
||||
if (!params.custom_fields_only && "disc_params" in model)
|
||||
if ("disc_params" in model)
|
||||
{
|
||||
// Nu de one-on-one tabel
|
||||
var dbfields = api2.update_fields(params, model.disc_params.model, jsondata_dp);
|
||||
var dbfields = api2.update_fields(params, this.disc_params.model, jsondata_dp);
|
||||
var wheres = [model.disc_params.model.fields[model.disc_params.joinfield].dbs + " = " + the_key];
|
||||
var xxxUpd = buildTrackingUpdate(model.disc_params.model.table, wheres.join(" AND " ), dbfields, { noValidateToken: true });
|
||||
if (xxxUpd) // Misschien geen velden opgegeven.
|
||||
{
|
||||
var err = Oracle.Execute(xxxUpd.sql, true);
|
||||
if (err.friendlyMsg)
|
||||
api2.error(400, err.friendlyMsg); // Veronderstel Bad Request
|
||||
}
|
||||
var err = Oracle.Execute(xxxUpd.sql, true);
|
||||
if (err.friendlyMsg)
|
||||
abort_with_warning(err.friendlyMsg);
|
||||
}
|
||||
|
||||
return { key: the_key, warning: "" };
|
||||
@@ -1731,10 +1525,8 @@ function generic_REST_DELETE(model, gparams)
|
||||
return function _generic_REST_DELETE(params, the_key)
|
||||
{
|
||||
if (model.autfunction !== false)
|
||||
{
|
||||
var autparams = user.checkAutorisation(model.autfunction);
|
||||
user.auth_required_or_abort(autparams.PRSwritelevel < 9 && autparams.ALGwritelevel < 9);
|
||||
}
|
||||
user.auth_required_or_abort(autparams.PRSwritelevel < 9 && autparams.ALGwritelevel < 9);
|
||||
|
||||
if (model.soft_delete)
|
||||
{
|
||||
@@ -1751,7 +1543,7 @@ function generic_REST_DELETE(model, gparams)
|
||||
|
||||
var err = Oracle.Execute(sql, true);
|
||||
if (err.friendlyMsg)
|
||||
api2.error(400, err.friendlyMsg); // Veronderstel Bad Request
|
||||
abort_with_warning(err.friendlyMsg);
|
||||
|
||||
return { key: the_key, warning: "" };
|
||||
}
|
||||
|
||||
@@ -1,164 +0,0 @@
|
||||
<% /*
|
||||
$Revision$
|
||||
$Id$
|
||||
|
||||
File: api2_dispatch.inc
|
||||
Description: Mapping tussen externe API-naam en interne bestandnaam
|
||||
Notes:
|
||||
|
||||
Status:
|
||||
|
||||
*/
|
||||
|
||||
var api2_mapper = {
|
||||
// De 'name' moet hier gelijk zijn aan model.records_name
|
||||
|
||||
"swagger" : { "filename": "appl/api2/api_swagger.asp" },
|
||||
|
||||
"realestateproperties" : { "filename": "appl/mgt/alg_kenmerk.asp", "docparam": "&level=R" },
|
||||
"buildingfunctions" : { "filename": "appl/mgt/alg_srtgebouw.asp" },
|
||||
"terrainfunctions" : { "filename": "appl/mgt/alg_srtterreinsector.asp" },
|
||||
"regions" : { "filename": "appl/api2/api_regions.asp", "module": "ALG" },
|
||||
"buildings" : { "filename": "appl/api2/api_buildings.asp", "module": "ALG" },
|
||||
"floors" : { "filename": "appl/api2/api_floors.asp", "module": "ALG" },
|
||||
"locations" : { "filename": "appl/api2/api_locations.asp", "module": "ALG" },
|
||||
"rooms" : { "filename": "appl/api2/api_rooms.asp", "module": "ALG" },
|
||||
"districts" : { "filename": "appl/api2/api_districts.asp", "module": "ALG" },
|
||||
"orderdisciplines" : { "filename": "appl/mgt/bes_discipline.asp" },
|
||||
"ordercatalogues" : { "filename": "appl/mgt/bes_disciplineprod.asp" },
|
||||
"orderunits" : { "filename": "appl/mgt/bes_grootheid.asp" },
|
||||
"orderlineproperties" : { "filename": "appl/mgt/bes_kenmerk.asp" },
|
||||
"orderproperties" : { "filename": "appl/mgt/bes_kenmerkbestel.asp" },
|
||||
"orderarticlegroups" : { "filename": "appl/mgt/bes_srtgroep.asp" },
|
||||
"orderpropertytypes" : { "filename": "appl/mgt/bes_srtkenmerk.asp" },
|
||||
"orderproductgroups" : { "filename": "appl/mgt/bes_srtprodgroep.asp", "lcl_name": "bes_srtgroep_m" },
|
||||
"orderpacelisttables" : { "filename": "appl/mgt/bes_staffeltabel.asp" },
|
||||
"visitoractions" : { "filename": "appl/mgt/bez_actie.asp" },
|
||||
"visitorproperties" : { "filename": "appl/mgt/bez_kenmerk.asp" },
|
||||
"appointments" : { "filename": "appl/api2/api_appointments.asp", "module": "BEZ" },
|
||||
"visitors" : { "filename": "appl/api2/api_visitors.asp", "module": "BEZ" },
|
||||
"budget" : { "filename": "appl/bgt/bgt_budget.asp" },
|
||||
"budgetmutations" : { "filename": "appl/bgt/bgt_budgetmutatie.asp"},
|
||||
"budgetdisciplines" : { "filename": "appl/bgt/bgt_discipline.asp" },
|
||||
"budgetcostcategories" : { "filename": "appl/bgt/bgt_kostenrubriek.asp" },
|
||||
"budgetprojects" : { "filename": "appl/bgt/bgt_project.asp" },
|
||||
"graphiclabels" : { "filename": "appl/mgt/cad_label.asp" },
|
||||
"graphiclegends" : { "filename": "appl/mgt/cad_legenda.asp" },
|
||||
"graphiclegendvalues" : { "filename": "appl/mgt/cad_legendawaarde.asp" },
|
||||
"graphicthemes" : { "filename": "appl/mgt/cad_thema.asp" },
|
||||
"contractdisciplines" : { "filename": "appl/mgt/cnt_discipline.asp" },
|
||||
"contractproperties" : { "filename": "appl/mgt/cnt_kenmerk.asp" },
|
||||
"contractpropertytypes" : { "filename": "appl/mgt/cnt_srtkenmerk.asp" },
|
||||
"contractperiods" : { "filename": "appl/mgt/cnt_termijn.asp" },
|
||||
"taskdisciplines" : { "filename": "appl/mgt/ctr_discipline.asp" },
|
||||
"audits" : { "filename": "appl/mgt/fac_audit.asp" },
|
||||
"emailsettings" : { "filename": "appl/mgt/fac_email_setting.asp" },
|
||||
"exportfunctions" : { "filename": "appl/mgt/fac_export_app.asp" },
|
||||
"authorizationfunctions" : { "filename": "appl/mgt/fac_functie.asp" },
|
||||
"authorizationgroups" : { "filename": "appl/api2/api_authorizationgroups.asp" },
|
||||
"authorizations" : { "filename": "appl/mgt/fac_groeprechten.asp", "nodoc": true },
|
||||
"identityproviders" : { "filename": "appl/mgt/aut_idp.asp" },
|
||||
"importfunctions" : { "filename": "appl/mgt/fac_import_app.asp" },
|
||||
"notificationjobs" : { "filename": "appl/mgt/fac_notificatie_job.asp" },
|
||||
"profiles" : { "filename": "appl/mgt/fac_profiel.asp" },
|
||||
"profilevalues" : { "filename": "appl/mgt/fac_profielwaarde.asp" },
|
||||
"notificationtypes" : { "filename": "appl/mgt/fac_srtnotificatie.asp" },
|
||||
"customgraphs" : { "filename": "appl/mgt/fac_usrgraph.asp", "nodoc": true },
|
||||
"customtables" : { "filename": "appl/mgt/fac_usrtab.asp" },
|
||||
"widgets" : { "filename": "appl/mgt/fac_widget.asp" },
|
||||
"knowledgeproperties" : { "filename": "appl/mgt/faq_kenmerk.asp" },
|
||||
"vattables" : { "filename": "appl/mgt/fin_btwtabel.asp" },
|
||||
"invoiceproperties" : { "filename": "appl/mgt/fin_kenmerk.asp" },
|
||||
// "saleinvoicelines" : { "filename": "appl/mgt/fin_verkoopfactuur.asp", "nodoc": true },
|
||||
"taskhandlings" : { "filename": "appl/mgt/ins_controlemode.asp" },
|
||||
"objectdisciplines" : { "filename": "appl/mgt/ins_discipline.asp" },
|
||||
"objectproperties" : { "filename": "appl/mgt/ins_kenmerk.asp" },
|
||||
"recurringtasks" : { "filename": "appl/mgt/ins_srtcontrole.asp" },
|
||||
"objectgroups" : { "filename": "appl/mgt/ins_srtgroep.asp" },
|
||||
"objectpropertytypes" : { "filename": "appl/mgt/ins_srtkenmerk.asp" },
|
||||
"alldisciplines" : { "filename": "appl/mgt/ins_tab_discipline.asp" },
|
||||
"issueclosingtexts" : { "filename": "appl/mgt/mld_afmeldtekst.asp" },
|
||||
"backofficegroups" : { "filename": "appl/mgt/mld_behandelgroep.asp" },
|
||||
"servicelevels" : { "filename": "appl/mgt/mld_dienstniveau.asp" },
|
||||
"issuedisciplines" : { "filename": "appl/mgt/mld_discipline.asp" },
|
||||
"unproductivetimes" : { "filename": "appl/mgt/mld_impropdr.asp" },
|
||||
"issueproperties" : { "filename": "appl/mgt/mld_mld_kenmerk.asp" },
|
||||
"issueorderproperties" : { "filename": "appl/mgt/mld_kenmerk.asp" },
|
||||
"expenses" : { "filename": "appl/mgt/mld_kosten.asp" },
|
||||
"callsources" : { "filename": "appl/mgt/mld_meldbron.asp" },
|
||||
"disciplinetypes" : { "filename": "appl/mgt/mld_srtdiscipline.asp" },
|
||||
"issuepropertytypes" : { "filename": "appl/mgt/mld_srtkenmerk.asp" },
|
||||
"callgroups" : { "filename": "appl/mgt/mld_stdmeldinggroep.asp" },
|
||||
"issueordertypes" : { "filename": "appl/mgt/mld_typeopdr.asp" },
|
||||
"daysoff" : { "filename": "appl/mgt/mld_vrije_dagen.asp" },
|
||||
"workflows" : { "filename": "appl/mgt/mld_workflow.asp" },
|
||||
"workflowsteps" : { "filename": "appl/mgt/mld_workflowstep.asp", "nodoc": true },
|
||||
"workflowexpressions" : { "filename": "appl/mgt/mld_workflow_expression.asp" },
|
||||
"issuedisciplines" : { "filename": "appl/api2/api_issuedisciplines.asp", "module": "MLD" },
|
||||
// "orders" : { "filename": "appl/api2/api_orders.asp", "module": "MLD" },
|
||||
"orders" : { "filename": "appl/bgt/mld_opdr.asp", "module": "MLD" },
|
||||
"issues" : { "filename": "appl/api2/api_issues.asp", "module": "MLD" },
|
||||
"issuetypes" : { "filename": "appl/mgt/mld_stdmelding.asp", "module": "MLD" },
|
||||
"pinboardcategories" : { "filename": "appl/mgt/mrk_discipline.asp" },
|
||||
"services" : { "filename": "appl/mgt/prs_dienst.asp" },
|
||||
"basisproperties" : { "filename": "appl/mgt/prs_kenmerk.asp", "docparam": "&level=P" },
|
||||
"combinationvalidations" : { "filename": "appl/mgt/prs_kostencombinatie.asp" },
|
||||
"costtypes" : { "filename": "appl/mgt/prs_kostensoort.asp" },
|
||||
"costtypegroups" : { "filename": "appl/mgt/prs_kostensoortgrp.asp" },
|
||||
"costcentregroups" : { "filename": "appl/mgt/prs_kostenplaatsgrp.asp" },
|
||||
"costcentres" : { "filename": "appl/mgt/prs_kostenplaats.asp" },
|
||||
"persons" : { "filename": "appl/api2/api_persons.asp", "nodoc": true },
|
||||
"mandates" : { "filename": "appl/mgt/prs_perslidkostenplaats.asp" },
|
||||
"relationtypes" : { "filename": "appl/mgt/prs_relatietype.asp" },
|
||||
"employeefunctions" : { "filename": "appl/mgt/prs_srtperslid.asp" },
|
||||
"basispacelists" : { "filename": "appl/mgt/prs_staffel.asp" },
|
||||
"bookingactivities" : { "filename": "appl/mgt/res_activiteit.asp" },
|
||||
"bookingconsumables" : { "filename": "appl/mgt/res_artikel.asp" },
|
||||
"bookingcycles" : { "filename": "appl/mgt/res_cyclus.asp" },
|
||||
"bookingitems" : { "filename": "appl/mgt/res_deel.asp" },
|
||||
"bookingdisciplines" : { "filename": "appl/mgt/res_discipline.asp" },
|
||||
"bookingproperties" : { "filename": "appl/mgt/res_kenmerk.asp" },
|
||||
"bookingconfigurations" : { "filename": "appl/mgt/res_opstelling.asp" },
|
||||
"bookingrooms" : { "filename": "appl/mgt/res_ruimte.asp" },
|
||||
"bookingactivitytypes" : { "filename": "appl/mgt/res_srtactiviteit.asp" },
|
||||
"bookingconsumablescopes" : { "filename": "appl/mgt/res_srtartikel_onrgoed.asp" },
|
||||
"bookingpropertytypes" : { "filename": "appl/mgt/res_srtkenmerk.asp" },
|
||||
"reservationequipment" : { "filename": "appl/api2/api_reservationequipment.asp", "module": "RES" },
|
||||
"reservations" : { "filename": "appl/api2/api_reservations.asp", "module": "RES" },
|
||||
"reservablerooms" : { "filename": "appl/api2/api_reservablerooms.asp", "module": "RES" },
|
||||
"reservableconsumables" : { "filename": "appl/api2/api_reservableconsumables.asp", "module": "RES" },
|
||||
"reservationconsumables" : { "filename": "appl/api2/api_reservationconsumables.asp", "module": "RES" },
|
||||
"reservableequipment" : { "filename": "appl/api2/api_reservableequipment.asp", "module": "RES" },
|
||||
"reservablecatalog" : { "filename": "appl/api2/api_reservablecatalog.asp", "module": "RES" },
|
||||
"res_ruimtes" : { "filename": "appl/api2/api_res_ruimtes.asp", "module": "RES" },
|
||||
|
||||
"attachments" : { "filename": "appl/api2/api_attachments.asp", "module": "API", "nodoc": true },
|
||||
"doc" : { "filename": "appl/api2/api_doc.asp", "module": "API" },
|
||||
"apis" : { "filename": "appl/api2/api_apis.asp", "module": "API" },
|
||||
"about" : { "filename": "appl/api2/api_about.asp", "module": "API" },
|
||||
"cadcontours" : { "filename": "appl/api2/api_cadcontours.asp", "module": "CAD", "nodoc": true },
|
||||
"contracts" : { "filename": "appl/api2/api_contracts.asp", "module": "CNT" },
|
||||
"notes" : { "filename": "appl/api2/api_notes.asp", "module": "FAC", "docparam": "&module=MLD" },
|
||||
"approvals" : { "filename": "appl/api2/api_approvals.asp", "module": "FAC" },
|
||||
"settings" : { "filename": "appl/api2/api_settings.asp", "module": "FAC" },
|
||||
"reportsx" : { "filename": "appl/api2/api_reportsx.asp", "module": "FAC" },
|
||||
"reports" : { "filename": "appl/api2/api_reports.asp", "module": "FAC", "nodoc": true },
|
||||
"invoices" : { "filename": "appl/api2/api_invoices.asp", "module": "FIN" },
|
||||
"objects" : { "filename": "appl/api2/api_objects.asp", "module": "INS" },
|
||||
"inspections" : { "filename": "appl/api2/api_ins_deelsrtcontrole.asp", "module": "INS" },
|
||||
"statehistory" : { "filename": "appl/mgt/ins_deel_state_history.asp", "module": "INS" },
|
||||
"companies" : { "filename": "appl/api2/api_companies.asp", "module": "PRS" },
|
||||
"departments" : { "filename": "appl/mgt/prs_afdeling.asp", "module": "PRS" },
|
||||
|
||||
"generictables" : { "filename": "appl/mgt/mgt_generic.asp", "hidden": true },
|
||||
"systemtables" : { "filename": "appl/mgt/user_tables.asp", "hidden": true },
|
||||
"workflowexpressions" : { "filename": "appl/mgt/mld_workflow_expression.asp", "hidden": true } // dit is geen model
|
||||
}
|
||||
|
||||
function api2_dispatch(api2_name)
|
||||
{
|
||||
api2_name = api2_name.toLowerCase();
|
||||
if (api2_name in api2_mapper)
|
||||
return api2_mapper[api2_name].filename;
|
||||
}
|
||||
%>
|
||||
@@ -11,29 +11,45 @@
|
||||
*/
|
||||
%>
|
||||
<!-- #include file="api2.inc" -->
|
||||
<!-- #include file="api2_swagger.inc" -->
|
||||
<!-- #include file="../scf/scaffolding_common.inc" -->
|
||||
<%
|
||||
var DEZE = this;
|
||||
api2_rest = {
|
||||
authenticate: function _authenticate()
|
||||
{
|
||||
var method = String(Request.ServerVariables("REQUEST_METHOD"));
|
||||
if (method != "GET" && Session("stateless") != 1) // Vereis dan wel het CSRF token
|
||||
var APIKEY;
|
||||
if (S("fac_api_key_in_url"))
|
||||
APIKEY = getQParam("APIKEY", "");
|
||||
if (!APIKEY && Request.ServerVariables("HTTP_X_FACILITOR_API_KEY").Count)
|
||||
APIKEY = String(Request.ServerVariables("HTTP_X_FACILITOR_API_KEY")); // Meegegeven als X-FACILITOR-API-Key
|
||||
|
||||
if (!APIKEY && Session("user_key") > 0)
|
||||
{
|
||||
var token = Request.ServerVariables("HTTP_X_CSRF_TOKEN").Count // Meegegeven als X-CSRF-TOKEN
|
||||
? String(Request.ServerVariables("HTTP_X_CSRF_TOKEN"))
|
||||
: "";
|
||||
protectRequest.validateToken(token);
|
||||
user_key = Session("user_key"); // Hierdoor is de API intern te gebruiken zonder authenticatie
|
||||
}
|
||||
if (user_key < 0)
|
||||
else
|
||||
{
|
||||
Response.Status = "401 Unauthorized";
|
||||
// Sommige applicaties kunnen in reactie hierop een b64 encoded username:password sturen
|
||||
// Die onderscheppen wij in LoginTry.asp uiteindelijk
|
||||
if (S("basic_auth_realm"))
|
||||
Response.AddHeader("WWW-Authenticate", "Basic realm=\"" + S("basic_auth_realm") + "\"");
|
||||
Response.End;
|
||||
if (Session("user_key") > 0)
|
||||
{} // Tijdens ontwikkeling heb je soms in tweede tab de GUI open. Laat dat ongemoeid.
|
||||
else
|
||||
Session.Abandon(); // Altijd, voor de zekerheid
|
||||
|
||||
var sql = "SELECT prs_perslid_key, prs_perslid_naam"
|
||||
+ " FROM prs_perslid"
|
||||
+ " WHERE prs_perslid_verwijder IS NULL"
|
||||
+ " AND prs_perslid_apikey = " + safe.quoted_sql(APIKEY);
|
||||
var oRs = Oracle.Execute(sql);
|
||||
if (oRs.Eof || !APIKEY)
|
||||
{
|
||||
Response.Status = "401 Unauthorized";
|
||||
// Sommige applicaties kunnen in reactie hierop een b64 encoded username:password sturen
|
||||
// Die onderscheppen wij in LoginTry.asp uiteindelijk
|
||||
if (S("basic_auth_realm"))
|
||||
Response.AddHeader("WWW-Authenticate", "Basic realm=\"" + S("basic_auth_realm") + "\"");
|
||||
Response.End;
|
||||
};
|
||||
__Log("API2 User is: " + oRs("prs_perslid_naam").Value);
|
||||
/* global */ user_key = oRs("prs_perslid_key").Value;
|
||||
|
||||
if (typeof NO_ADDHEADER == "undefined" && Request.Servervariables("HTTP_FCLT_VERSION").Count > 0)
|
||||
{ // wordt opgepikt door FCLTAPI.DLL voor in de logging en daarna gestript. Niet in Fiddler dus
|
||||
@@ -68,6 +84,7 @@ api2_rest = {
|
||||
oRs.Close()
|
||||
}
|
||||
|
||||
/* global */ user = new Perslid(user_key); // wordt mogelijk nog overruled door imporsonate
|
||||
CheckForLogging(Request.QueryString("logging")); // Nu pas kan autorisatie via user gecontroleerd worden
|
||||
},
|
||||
|
||||
@@ -117,29 +134,11 @@ api2_rest = {
|
||||
var wasCodePage = Session.Codepage;
|
||||
Session.Codepage = 65001; // We doen *uitsluitend* utf-8
|
||||
Response.Charset = 'utf-8';
|
||||
var inputformat = outputformat = getQParamSafe("format", "invalid").toLowerCase();
|
||||
if (outputformat == "auto")
|
||||
{
|
||||
var accept = String(Request.ServerVariables("HTTP_ACCEPT")).split(",")[0]; // Altijd alleen eerste bekijken
|
||||
switch (accept.toLowerCase())
|
||||
{
|
||||
case "application/xml": outputformat = "xml"; break;
|
||||
case "application/json": outputformat = "json"; break;
|
||||
case "text/html": outputformat = "html"; break; // vanuit browser?
|
||||
default: outputformat = "json";
|
||||
}
|
||||
}
|
||||
|
||||
if (outputformat == "json")
|
||||
var format = getQParamSafe("format", "invalid").toLowerCase();
|
||||
if (format == "json")
|
||||
/* global */ JSON_Result = true; // Zelf doen we er niets mee maar
|
||||
// shared.simple_page kijkt er naar
|
||||
|
||||
var orgError = api2.error;
|
||||
api2.error = function (code, msg)
|
||||
{
|
||||
api2_rest.plugin.error_handler(code, msg, orgError);
|
||||
}
|
||||
|
||||
api2_rest.authenticate();
|
||||
// Kip-ei: de omzetting naar new model() mag pas als je geauthenticeerd bent
|
||||
// Hierboven willen we het echter al wel meegeven
|
||||
@@ -155,136 +154,74 @@ api2_rest = {
|
||||
Response.Status = "405 Method not allowed";
|
||||
Response.End;
|
||||
}
|
||||
// JGL: Met zeer grote tegenzin behoorlijk UWVA specifiek
|
||||
if (Session("isWriteonlyApi2User"))
|
||||
{
|
||||
if (method == "PUT" || (method == "GET" && getQParam("api2") == "reports"))
|
||||
{
|
||||
// Dat is toegestaan
|
||||
}
|
||||
else
|
||||
{
|
||||
Response.Status = api2.error(400, "Method not supported for this user");
|
||||
}
|
||||
}
|
||||
|
||||
var key = getQParamInt("id", -1); // Voor POST/PUT/DELETE
|
||||
|
||||
var jsondata = {};
|
||||
var filter = shared.qs2json(model);
|
||||
filter = api2_rest.plugin.transform_filter(filter);
|
||||
var requestparams = { filter: filter, include: getQParamArray("include", []) };
|
||||
if (filter.mode == "attachment" && !("includes" in model && "custom_fields" in model.includes))
|
||||
api2.error(400, "Attachment not supported for this model");
|
||||
|
||||
if (filter.mode == "attachment")
|
||||
{
|
||||
if (key > 0 && method == "POST") // het bestand mag dan wel nieuw zijn (POST is van toepassing),
|
||||
method = "PUT"; // intern is het een update van een bestaand record, dus PUT
|
||||
}
|
||||
|
||||
if (!("REST_" + method in model) || !model["REST_" + method])
|
||||
if (!("REST_" + method in model))
|
||||
{
|
||||
Response.Status = "501 Not Implemented";
|
||||
// TODO The response MUST include an Allow header containing a list of valid methods for the requested resource.
|
||||
Response.End;
|
||||
}
|
||||
var jsondata = {};
|
||||
var filter = shared.qs2json(model);
|
||||
filter = api2_rest.plugin.transform_filter(filter);
|
||||
var requestparams = { filter: filter, include: getQParamArray("include", []) };
|
||||
|
||||
if (/PUT|POST/.test(method)) // Dan is er in de body data meegestuurd
|
||||
{
|
||||
if (filter.mode == "attachment")
|
||||
switch (format)
|
||||
{
|
||||
// Body bevat application/octet-stream, dat lezen we later wel uit
|
||||
case "json":
|
||||
{
|
||||
var parsed = RequestJSON();
|
||||
if (parsed.error)
|
||||
api2.error(500, "Error parsing input JSON: " + parsed.error);
|
||||
jsondata = api2_rest.plugin.transform_incoming(requestparams, parsed.json);
|
||||
if (!jsondata)
|
||||
api2.error(500, "Error parsing input JSON: Empty");
|
||||
break;
|
||||
}
|
||||
case "xml":
|
||||
{
|
||||
var parsed = RequestXML();
|
||||
if (parsed.error)
|
||||
api2.error(500, "Error parsing input XML: " + parsed.error);
|
||||
jsondata = api2_rest.xml2json(parsed.xml);
|
||||
if (!jsondata)
|
||||
api2.error(500, "Error parsing input XML: Empty");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
UNKNOWN_FORMAT_TYPE;
|
||||
}
|
||||
else
|
||||
if (!jsondata || !(model.record_name in jsondata || (model.multi_update && model.records_name in jsondata)))
|
||||
{
|
||||
if (inputformat == "auto")
|
||||
{
|
||||
var contenttype = String(Request.ServerVariables("HTTP_CONTENT_TYPE")).split(",")[0]; // Altijd alleen eerste bekijken
|
||||
switch (contenttype.toLowerCase())
|
||||
{
|
||||
case "application/xml":
|
||||
inputformat = "xml";
|
||||
break;
|
||||
case "application/json":
|
||||
inputformat = "json";
|
||||
break;
|
||||
case "application/x-www-form-urlencoded":
|
||||
inputformat = "form";
|
||||
break;
|
||||
default:
|
||||
inputformat = outputformat;
|
||||
}
|
||||
}
|
||||
|
||||
switch (inputformat)
|
||||
{
|
||||
case "json":
|
||||
{
|
||||
var parsed = RequestJSON();
|
||||
if (parsed.error)
|
||||
api2.error(400, "Error parsing input JSON: " + parsed.error);
|
||||
jsondata = api2_rest.plugin.transform_incoming(requestparams, parsed.json);
|
||||
if (!jsondata)
|
||||
api2.error(400, "Error parsing input JSON: Empty");
|
||||
break;
|
||||
}
|
||||
case "xml":
|
||||
{
|
||||
var parsed = RequestXML();
|
||||
if (parsed.error)
|
||||
api2.error(400, "Error parsing input XML: " + parsed.error);
|
||||
jsondata = api2_rest.xml2json(parsed.xml);
|
||||
if (!jsondata)
|
||||
api2.error(400, "Error parsing input XML: Empty");
|
||||
break;
|
||||
}
|
||||
//case "form":
|
||||
//{
|
||||
// jsondata = { };
|
||||
// jsondata[model.recordname] = shared.form2json(model); // of api2.form2JSONdata inzetten?
|
||||
//}
|
||||
default:
|
||||
UNKNOWN_CONTENT_TYPE;
|
||||
}
|
||||
if (!jsondata || !(model.record_name in jsondata || (model.multi_update && model.records_name in jsondata)))
|
||||
{
|
||||
api2.error(400, "No '{0}' found in input".format(model.record_name));
|
||||
}
|
||||
api2.error(500, "No '{0}' found in input".format(model.record_name));
|
||||
}
|
||||
}
|
||||
|
||||
var key = getQParamInt("id", -1); // Voor POST/PUT/DELETE
|
||||
var isSingle = /PUT|POST|DELETE/.test(method) || (key > 0); // PUT, POST en DELETE altijd single
|
||||
|
||||
if (outputformat == "doc")
|
||||
if (format == "doc")
|
||||
{
|
||||
// Dan hoeven we verder bijna niets te doen
|
||||
if ("autfunction" in model)
|
||||
model.autfunctionname = L("lcl_" + model.autfunction);
|
||||
// TODO: velden strippen waar je niets mee te maken hebt?
|
||||
// Dan hoeven we verder niets te doen
|
||||
}
|
||||
else if (outputformat == "api" && getQParamInt("swagger", 0) == 0)
|
||||
else if (format == "api")
|
||||
{
|
||||
// TODO: Onderstaande in een of ander standaardformaat opleveren?
|
||||
var result = { id: model.records_name,
|
||||
"name": model.record_title,
|
||||
"names": model.records_title,
|
||||
"records_name": model.records_name,
|
||||
"record_name": model.record_name,
|
||||
"authorization": model.autfunction,
|
||||
methods: [],
|
||||
includes: [],
|
||||
fields: []
|
||||
};
|
||||
for (var i in model.includes)
|
||||
result.includes.push(i);
|
||||
if (model["REST_GET"])
|
||||
if ("REST_GET" in model)
|
||||
result.methods.push("GET");
|
||||
if (model["REST_PUT"])
|
||||
if ("REST_PUT" in model)
|
||||
result.methods.push("PUT");
|
||||
if (model["REST_POST"])
|
||||
if ("REST_POST" in model)
|
||||
result.methods.push("POST");
|
||||
if (model["REST_DELETE"])
|
||||
if ("REST_DELETE" in model)
|
||||
result.methods.push("DELETE");
|
||||
|
||||
for (var fld in model.fields)
|
||||
@@ -293,27 +230,18 @@ api2_rest = {
|
||||
result.fields.push({ id: fld,
|
||||
filter: model.fields[fld].filter,
|
||||
type: model.fields[fld].typ,
|
||||
label: model.fields[fld].label,
|
||||
required: model.fields[fld].required,
|
||||
valuelist: model.fields[fld].LOV && api2.splitLOV(model.fields[fld].LOV)
|
||||
label: model.fields[fld].label
|
||||
});
|
||||
}
|
||||
}
|
||||
else if (outputformat == "api" && getQParamInt("swagger", 0) == 1)
|
||||
{
|
||||
result = swaggermodel(model);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (method == "DELETE")
|
||||
{
|
||||
if (!(key > 0))
|
||||
api2.error(400, "Missing id");
|
||||
var result = model["REST_" + method]( requestparams, key );
|
||||
}
|
||||
else if (filter.mode == "attachment")
|
||||
{ // GET/PUT/POST https://xxxx.facilitor.nl/api2/visitors/99685/attachments/1040/testfile.jpg" bestaande folder
|
||||
// POST https://xxxx.facilitor.nl/api2/issues/0/attachments/1040/testfile.jpg" nieuw object, maakt TEMP aan
|
||||
else if (method == "GET" && filter.mode == "attachment" && "custom_fields" in model.includes)
|
||||
{
|
||||
if (wasCodePage != 65001)
|
||||
{
|
||||
// Door de IIS rewriter is de filenaam in de url utf-8 encoded
|
||||
@@ -331,67 +259,12 @@ api2_rest = {
|
||||
|
||||
requestparams.filter.id = key; // Die kan er maar beter wel zijn!
|
||||
requestparams.include = ["custom_fields"];
|
||||
var jsondata = { "custom_fields": [
|
||||
{
|
||||
"propertyid": parseInt(filter.subfolder, 10),
|
||||
"value": filter.filename, // Gaat de database in bij "F"
|
||||
"attachments": [
|
||||
{
|
||||
"name": filter.filename // Zo gaat hij heten op het filesysteem
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
if (method == "PUT" || method == "POST")
|
||||
{
|
||||
var bytes = Request.TotalBytes;
|
||||
if (bytes == 0)
|
||||
api2.error(400, "Empty file");
|
||||
|
||||
var fileStream = Server.CreateObject("ADODB.Stream");
|
||||
fileStream.Type = 1; // adTypeBinary eerst nog
|
||||
fileStream.Open();
|
||||
try
|
||||
{
|
||||
fileStream.Write(Request.BinaryRead(bytes));
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
var msg = L("lcl_shared_upload_error_start") + e.description + L("lcl_shared_upload_error_end");
|
||||
api2.error(400, msg);
|
||||
}
|
||||
jsondata["custom_fields"][0]["attachments"][0].datastream = fileStream;
|
||||
if (key == 0) // new record
|
||||
{
|
||||
var token = model.includes["custom_fields"].model.REST_POST(requestparams, jsondata.custom_fields[0], -1);
|
||||
var record = { xflexparentkey: -1, propertyid: jsondata.custom_fields[0].propertyid};
|
||||
var fileparams = { getFiles: true, api2name: null, tmpfolder: token };
|
||||
}
|
||||
else
|
||||
{
|
||||
requestparams.custom_fields_only = true; // Voorkom bij nieuwe bijlage onnodige update vam hele issue
|
||||
model["REST_" + method](requestparams, jsondata, key); // via het hoofdmodel met authorisatie controle en alles
|
||||
var record = { xflexparentkey: key, propertyid: jsondata.custom_fields[0].propertyid};
|
||||
var fileparams = { getFiles: true, api2name: model.records_name };
|
||||
}
|
||||
var data = model.includes["custom_fields"].model.get_file_info(requestparams, record, fileparams );
|
||||
|
||||
api2_rest.deliver(data, /* dummy model */ { record_name: "attachment" }, outputformat, true);
|
||||
return;
|
||||
}
|
||||
// Geen atachment dus door met de reguliere code
|
||||
var data = model["REST_" + method](requestparams, jsondata, key);
|
||||
if (method == "GET")
|
||||
{
|
||||
if (!data.length) // mogelijk not authorized op hele record
|
||||
Response.Status = "404 Not Found";
|
||||
else
|
||||
model.includes["custom_fields"].model.streamattachment(filter, data[0].custom_fields);
|
||||
Response.End;
|
||||
}
|
||||
var data = model.REST_GET(requestparams);
|
||||
if (!data.length) // mogelijk not authorized op hele record
|
||||
Response.Status = "404 Not Found";
|
||||
else
|
||||
result = data;
|
||||
model.includes["custom_fields"].model.streamattachment(filter, data[0].custom_fields);
|
||||
Response.End;
|
||||
}
|
||||
else if (method == "GET")
|
||||
{
|
||||
@@ -399,11 +272,8 @@ api2_rest = {
|
||||
}
|
||||
else if (model.record_name in jsondata) // een enkel record
|
||||
{
|
||||
if (method == "PUT" && !(key > 0))
|
||||
api2.error(400, "Missing id");
|
||||
if (jsondata[model.record_name] instanceof Array)
|
||||
api2.error(400, "{0} should be single record only.".format(method))
|
||||
|
||||
abort_with_warning("API2 error: {0} should be single record only.".format(method));
|
||||
var result = model["REST_" + method]( requestparams, jsondata[model.record_name], key );
|
||||
}
|
||||
else
|
||||
@@ -433,9 +303,9 @@ api2_rest = {
|
||||
case "POST":
|
||||
{
|
||||
var key = result.key;
|
||||
if (key > 0 && !Session("isWriteonlyApi2User"))
|
||||
if (key > 0)
|
||||
{
|
||||
// var params = { filter: shared.qs2json(model), include: getQParamArray("include", []) }, jsondata, key
|
||||
var params = { filter: shared.qs2json(model), include: getQParamArray("include", []) }, jsondata, key
|
||||
// requestparams.include is mogelijk uitgebreid met wat er in de body stond
|
||||
data = model.REST_GET({ filter: { id: key }, include: requestparams.include }); // resulterende data weer terug
|
||||
__Log(data);
|
||||
@@ -448,7 +318,7 @@ api2_rest = {
|
||||
}
|
||||
}
|
||||
|
||||
api2_rest.deliver(data, model, outputformat, isSingle);
|
||||
api2_rest.deliver(data, model, format, isSingle);
|
||||
|
||||
},
|
||||
// Data is een array met 'records'
|
||||
@@ -460,18 +330,16 @@ api2_rest = {
|
||||
Response.End;
|
||||
}
|
||||
|
||||
if (format == "html" || format == "json" || format == "table")
|
||||
if (format == "html" || format == "json")
|
||||
{
|
||||
var result = { };
|
||||
if (model.formatted_get)
|
||||
result = data;
|
||||
else if (single)
|
||||
if (single)
|
||||
result[model.record_name] = data[0];
|
||||
else
|
||||
{
|
||||
result.total_count = model.total_count;
|
||||
result.limit = model.limit;
|
||||
result.offset = model.offset;
|
||||
result.offset = 0;
|
||||
result[model.records_name] = data;
|
||||
}
|
||||
|
||||
@@ -494,41 +362,22 @@ api2_rest = {
|
||||
var lcl2fld = {};
|
||||
for (var fld in model.fields)
|
||||
{
|
||||
if (fld.substring(0,1) == "_")
|
||||
{
|
||||
delete model.fields[fld];
|
||||
continue;
|
||||
}
|
||||
|
||||
for (var prop in model.fields[fld])
|
||||
{
|
||||
if (typeof model.fields[fld][prop] == "function") // Bijvoorbeeld model_issues.filter
|
||||
model.fields[fld][prop] = "<<function>>";
|
||||
}
|
||||
|
||||
if (model.fields[fld].LOV)
|
||||
model.fields[fld].valuelist = api2.splitLOV(model.fields[fld].LOV, "lov_");
|
||||
|
||||
var lclname = "{0}.{1}.hint".format(model.records_name, fld);
|
||||
lcl2fld[lclname] = fld;
|
||||
safefieldnames.push(safe.quoted_sql(lclname));
|
||||
}
|
||||
if (safefieldnames.length)
|
||||
//model.fields[fld].hint = "Hallo";
|
||||
var sql = "SELECT fac_locale_xsl_label, "
|
||||
+ " COALESCE(fac_locale_xsl_cust, fac_locale_xsl_tekst) fac_locale_xsl_tekst"
|
||||
+ " FROM fac_locale_xsl xsl"
|
||||
+ " WHERE fac_locale_xsl_lang = " + safe.quoted_sql(user_lang)
|
||||
+ " AND fac_locale_xsl_module = 'ASP'"
|
||||
+ " AND fac_locale_xsl_label IN (" + safefieldnames.join(", ") + ")";
|
||||
var oRs = Oracle.Execute(sql);
|
||||
while (!oRs.Eof)
|
||||
{
|
||||
//model.fields[fld].hint = "Hallo";
|
||||
var sql = "SELECT fac_locale_xsl_label, "
|
||||
+ " COALESCE(fac_locale_xsl_cust, fac_locale_xsl_tekst) fac_locale_xsl_tekst"
|
||||
+ " FROM fac_locale_xsl xsl"
|
||||
+ " WHERE fac_locale_xsl_lang = " + safe.quoted_sql(user_lang)
|
||||
+ " AND fac_locale_xsl_module = 'ASP'"
|
||||
+ " AND fac_locale_xsl_label IN (" + safefieldnames.join(", ") + ")";
|
||||
var oRs = Oracle.Execute(sql);
|
||||
while (!oRs.Eof)
|
||||
{
|
||||
model.fields(lcl2fld[oRs("fac_locale_xsl_label").Value]) = oRs("fac_locale_xsl_tekst").value;
|
||||
oRs.MoveNext();
|
||||
}
|
||||
oRs.Close();
|
||||
model.fields(lcl2fld[oRs("fac_locale_xsl_label").Value]) = oRs("fac_locale_xsl_tekst").value;
|
||||
oRs.MoveNext();
|
||||
}
|
||||
}
|
||||
Response.ContentType = "text/html";
|
||||
@@ -542,8 +391,7 @@ api2_rest = {
|
||||
|
||||
var style = new ActiveXObject("MSXML2.DOMDocument.6.0");
|
||||
style.async = false;
|
||||
style.resolveExternals = true; // XSL kan includes hebben
|
||||
style.validateOnParse = true; // en moet correct zijn
|
||||
style.resolveExternals = false;
|
||||
if (Request.QueryString("debug").Count == 0)
|
||||
{
|
||||
var xslname = model.xslname || "reference.xsl";
|
||||
@@ -552,8 +400,6 @@ api2_rest = {
|
||||
}
|
||||
else
|
||||
{
|
||||
// Het kan zijn dat de stylesheet bepaalde informatie verbergt.
|
||||
// Daarom niet zo maar aanbieden
|
||||
if (Application("otap_environment") != "O")
|
||||
ONLY_ON_OTAP_O;
|
||||
|
||||
@@ -580,32 +426,10 @@ api2_rest = {
|
||||
case "html":
|
||||
Response.ContentType = "text/html";
|
||||
var antwoord = JSON.stringify(resultdata, null, 2);
|
||||
var str_antwoord = "<!DOCTYPE html><html><head>"
|
||||
+ "<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>"
|
||||
+ "<meta name='viewport' content='width=device-width, initial-scale=1.0, user-scalable=yes'>"
|
||||
+ "<title>{0}</title>".format(single?model.record_name:model.records_name)
|
||||
+ "</head>"
|
||||
+ "<body><pre>"
|
||||
var str_antwoord = "<!DOCTYPE html><html><head></head><body><pre>"
|
||||
+ Server.HTMLEncode(antwoord)
|
||||
+ "</pre></body></html>";
|
||||
break;
|
||||
case "table":
|
||||
Response.ContentType = "text/html";
|
||||
if (single)
|
||||
var antwoord = api2_rest.json2htmltable([resultdata[model.record_name]], model, single);
|
||||
else
|
||||
var antwoord = api2_rest.json2htmltable(resultdata[model.records_name], model, single);
|
||||
var str_antwoord = "<!DOCTYPE html>"
|
||||
+ "<html>"
|
||||
+ "<head>"
|
||||
+ " <title>{0}</title>".format(single?model.record_name:model.records_name)
|
||||
+ " <link rel=stylesheet type='text/css' href='" + rooturl + "/appl/api2/table.css'>"
|
||||
+ "</head>"
|
||||
+ "<body>"
|
||||
+ antwoord
|
||||
+ "</body>"
|
||||
+ "</html>";
|
||||
break;
|
||||
case "xml":
|
||||
Response.ContentType = "text/xml";
|
||||
var xml_antwoord = api2_rest.json2xml(data, model, single);
|
||||
@@ -644,12 +468,8 @@ api2_rest = {
|
||||
|
||||
// str_antwoord heeft nu het te versturen antwoord
|
||||
// Bepaal eTag
|
||||
var eTag = api2_rest.plugin.get_eTag({}, resultdata);
|
||||
if (!eTag)
|
||||
{
|
||||
var oCrypto = new ActiveXObject("SLNKDWF.Crypto");
|
||||
var eTag = '"' + oCrypto.hex_sha1(String(S("cache_changecounter")) + "_" + str_antwoord).toLowerCase() + '"';
|
||||
}
|
||||
var oCrypto = new ActiveXObject("SLNKDWF.Crypto");
|
||||
var eTag = '"' + oCrypto.hex_sha1(String(S("cache_changecounter")) + "_" + str_antwoord).toLowerCase() + '"';
|
||||
Response.AddHeader("ETag", eTag);
|
||||
if (Request.ServerVariables("HTTP_IF_NONE_MATCH") == eTag)
|
||||
{ // We hebben een match! Effectief besparen wel alleen op dataverkeer, de queries zijn al geweest
|
||||
@@ -661,63 +481,6 @@ api2_rest = {
|
||||
Response.write(str_antwoord);
|
||||
},
|
||||
|
||||
json2htmltable: function _json2htmltable(data, model, single)
|
||||
{
|
||||
var trs = [];
|
||||
if (data.length) // Header maken
|
||||
{
|
||||
var tds = [];
|
||||
for (var fld in data[0])
|
||||
{
|
||||
var lbl = fld;
|
||||
if (fld in model.fields)
|
||||
lbl = model.fields[fld].label;
|
||||
else
|
||||
{
|
||||
var val = data[0][fld];
|
||||
if (val && typeof val == "object")
|
||||
{
|
||||
if (model.includes && fld in model.includes)
|
||||
var lbl = model.includes[fld].model.records_title;
|
||||
else
|
||||
lbl = fld; // Attachments/flexfiles
|
||||
}
|
||||
}
|
||||
tds.push("<th title='{0}'>{1}</th>".format(safe.htmlattr(lbl), fld));
|
||||
}
|
||||
trs.push(tds.join(""));
|
||||
}
|
||||
for (var i = 0; i < data.length; i++)
|
||||
{
|
||||
var rec = data[i];
|
||||
var tds = [];
|
||||
for (var fld in rec)
|
||||
{
|
||||
var val = rec[fld];
|
||||
var safeval = Server.HTMLEncode(String(val));
|
||||
if (val === null)
|
||||
safeval = ' ';
|
||||
else if (typeof val == 'object' && val instanceof Date)
|
||||
safeval = toISODateTimeString(val);
|
||||
else if (val && typeof val == "object" && "id" in val)
|
||||
{
|
||||
var naam = val.name||"???";
|
||||
if (typeof naam == 'object' && naam instanceof Date) // Bij appointment
|
||||
naam = toISODateTimeString(naam);
|
||||
safeval = val.id + " (" + Server.HTMLEncode(naam) + ")";
|
||||
}
|
||||
else if (val && typeof val == "object" && model.includes && fld in model.includes)
|
||||
safeval = api2_rest.json2htmltable(val, model.includes[fld].model, single); // dereference
|
||||
else if (val instanceof Array) // attachments array
|
||||
safeval = api2_rest.json2htmltable(val, model, single);
|
||||
|
||||
tds.push(safeval);
|
||||
}
|
||||
trs.push("<td>" + tds.join("</td><td>") + "</td>");
|
||||
}
|
||||
return "\n<table border='1'>\n<tr>" + trs.join("</tr>\n<tr>") + "</tr></table>";
|
||||
},
|
||||
|
||||
// TODO: Wanneer attributes gebruiken en wanneer (sub)-elements?
|
||||
// Streven: data == xml2json(json2xml(data))
|
||||
json2xml: function _json2xml(data, model, single)
|
||||
@@ -782,10 +545,6 @@ api2_rest = {
|
||||
else
|
||||
{
|
||||
var arrayElement = xmlDoc.createElement(rootname);
|
||||
arrayElement.setAttribute("total_count", model.total_count);
|
||||
arrayElement.setAttribute("limit", model.limit);
|
||||
arrayElement.setAttribute("offset", model.offset);
|
||||
|
||||
for (var i = 0; i < data.length; i++)
|
||||
arrayElement.appendChild(record2json(data[i], record_name));
|
||||
xmlDoc.appendChild(arrayElement);
|
||||
@@ -892,16 +651,6 @@ api2_rest = {
|
||||
hook = null;
|
||||
return outdata;
|
||||
},
|
||||
error_handler: function(code, msg, orgHandler)
|
||||
{
|
||||
var hook = api2_rest.find_plugin();
|
||||
if ("error_handler" in hook)
|
||||
outdata = hook.error_handler(code, msg, orgHandler);
|
||||
else
|
||||
outdata = orgHandler(code, msg);
|
||||
hook = null;
|
||||
return outdata;
|
||||
},
|
||||
transform_incoming: function(params, data)
|
||||
{
|
||||
var outdata = data;
|
||||
@@ -921,15 +670,6 @@ api2_rest = {
|
||||
outdata = hook.transform_outgoing(params, data);
|
||||
hook = null;
|
||||
return outdata;
|
||||
},
|
||||
get_eTag: function(params, data)
|
||||
{
|
||||
var outdata = null;
|
||||
var hook = api2_rest.find_plugin();
|
||||
if ("get_eTag" in hook)
|
||||
outdata = hook.get_eTag(params, data);
|
||||
hook = null;
|
||||
return outdata;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -944,16 +684,15 @@ function RequestJSON()
|
||||
var lngBytesCount = Request.TotalBytes;
|
||||
jvraag = BytesToStr(Request.BinaryRead(lngBytesCount));
|
||||
}
|
||||
__Log("Request body: " + jvraag);
|
||||
__Log("Vraag: " + jvraag);
|
||||
try
|
||||
{
|
||||
var vraag = myJSON.parse(jvraag);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
result = { error: e.description || (e.message + ": " + e.name) };
|
||||
__DoLog("JSON eval faalt met: '{0}'\n{1}".format(result.error, jvraag), "ffff00");
|
||||
return result ;
|
||||
__DoLog("JSON eval faalt met: '{0}'\n{1}".format(e.description||e.message, jvraag), "ffff00");
|
||||
return { error: e.description };
|
||||
}
|
||||
return { json: vraag };
|
||||
}
|
||||
@@ -986,13 +725,7 @@ function BytesToStr(bytes)
|
||||
stream.type = 2; // Text
|
||||
stream.charset = "utf-8";
|
||||
|
||||
// Als onverhoopt toch windows-1252 is gestuurd met diacrieten gaf
|
||||
// stream.readtext() een 'The parameter is incorrect'
|
||||
// Vreemd genoeg lijkt het expliciet meegeven van een lengte dat te voorkomen.
|
||||
// Die mag zelfs gewoon veel 'te lang' zijn.
|
||||
// Merk op dat we windows-1252 niet ondersteunen, je moet echt utf-8 sturen
|
||||
// (we hadden waarschijnlijk ook 99999999 kunnen kiezen)
|
||||
var sOut = stream.readtext(stream.Size * 2);
|
||||
var sOut = stream.readtext();
|
||||
stream.close;
|
||||
return sOut;
|
||||
}
|
||||
@@ -1038,8 +771,6 @@ var simple_json2xml = (function (undefined) {
|
||||
if (obj.hasOwnProperty(i)) {
|
||||
var value = obj[i],
|
||||
type = typeof value;
|
||||
if (value === obj) // bij merged_model zouden we hier oneindige recursie krijgen
|
||||
continue;
|
||||
if (value instanceof Array && type == 'object') {
|
||||
for (var sub in value) {
|
||||
xml += simple_json2xml(value[sub]);
|
||||
|
||||
@@ -1,363 +0,0 @@
|
||||
<% /*
|
||||
$Revision$
|
||||
$Id$
|
||||
|
||||
File: api2_swagger.inc
|
||||
Description: Genereer OpenAPI compatible documentatie
|
||||
zodat swagger ui die kan lezen
|
||||
Notes:
|
||||
Status:
|
||||
|
||||
*/
|
||||
%>
|
||||
<%
|
||||
function swaggerschema(model)
|
||||
{
|
||||
var schema = {
|
||||
"type":"object",
|
||||
"properties":{},
|
||||
"required": [],
|
||||
"xml":{
|
||||
"name": model.record_name
|
||||
}
|
||||
}
|
||||
for (var fld in model.fields)
|
||||
{
|
||||
if (fld.substring(0,1) == "_")
|
||||
continue;
|
||||
var field = model.fields[fld];
|
||||
if (field.hidden)
|
||||
continue;
|
||||
if (field.required)
|
||||
schema.required.push(fld);
|
||||
switch (field.typ)
|
||||
{
|
||||
case "key":
|
||||
var prop = {
|
||||
"type":"integer",
|
||||
"format":"int64"
|
||||
};
|
||||
if (fld == "id")
|
||||
prop["readOnly"] = true; // Wordt nog genegeerd door Swagger-ui 2.0
|
||||
break;
|
||||
case "float":
|
||||
case "currency":
|
||||
var prop = {
|
||||
"type":"float",
|
||||
"format":"float"
|
||||
};
|
||||
break;
|
||||
case "number":
|
||||
var prop = {
|
||||
"type":"integer",
|
||||
"format":"int64"
|
||||
};
|
||||
break;
|
||||
case "check":
|
||||
case "check0":
|
||||
var prop = {
|
||||
"type":"integer",
|
||||
"format":"int64",
|
||||
"enum":[0, 1]
|
||||
};
|
||||
break;
|
||||
case "varchar":
|
||||
case "memo":
|
||||
var prop = {
|
||||
"type":"string",
|
||||
"format":"string"
|
||||
};
|
||||
break;
|
||||
case "date":
|
||||
var prop = {
|
||||
"type":"date",
|
||||
"format":"date"
|
||||
};
|
||||
break;
|
||||
case "datetime":
|
||||
var prop = {
|
||||
"type":"dateTime",
|
||||
"format":"date-time"
|
||||
};
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
prop.description = field.label;
|
||||
//prop["default"] = field.defaultvalue;
|
||||
if ("LOV" in field)
|
||||
{
|
||||
var spl = api2.splitLOV(field.LOV);
|
||||
var enums = [];
|
||||
for (var l in spl)
|
||||
{
|
||||
enums.push(l);
|
||||
}
|
||||
prop["enum"] = enums;
|
||||
}
|
||||
schema["properties"][fld] = prop;
|
||||
}
|
||||
return schema;
|
||||
};
|
||||
|
||||
function swaggermodel (model)
|
||||
{
|
||||
//if ("autfunction" in model && !user.has(model.autfunction))
|
||||
// return {};
|
||||
var auttext = "";
|
||||
if (model.autfunction)
|
||||
auttext = "Requires authorization `{0}` ({1})".format(model.autfunction, L("lcl_" + model.autfunction));
|
||||
model.records_title = model.records_title || model.records_name;
|
||||
model.record_title = model.record_title || model.record_name;
|
||||
var result = {
|
||||
"schema": { "fields": {} },
|
||||
"get": {
|
||||
"tags":[
|
||||
getQParamSafe("module", "XXX")
|
||||
],
|
||||
"summary": "Get all `{0}`".format(model.records_title),
|
||||
"description": "Returns all `{0}` from the system that the user has access to.".format(model.records_title) + "<br>" + auttext,
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A list of `{0}`".format(model.records_title),
|
||||
"schema": {
|
||||
"$ref": "#/schema/{0}".format(model.records_name)
|
||||
}
|
||||
},
|
||||
"403": {
|
||||
"description": "Forbidden"
|
||||
}
|
||||
},
|
||||
"security":[
|
||||
{
|
||||
"api_key":[
|
||||
]
|
||||
}
|
||||
],
|
||||
"parameters": []
|
||||
}
|
||||
};
|
||||
|
||||
if (model.includes)
|
||||
{
|
||||
var enums = [];
|
||||
for (var i in model.includes)
|
||||
enums.push(i);
|
||||
var inc = model.includes[i];
|
||||
result["get"].parameters.push(
|
||||
{
|
||||
"name": "include",
|
||||
"in": "query",
|
||||
"description": "Include all `{0}`".format("model" in inc?(inc.model.records_title||inc.model.records_name):i),
|
||||
"required": false,
|
||||
"type": "array",
|
||||
"enum": enums
|
||||
});
|
||||
};
|
||||
|
||||
result["schema"]["fields"][model.record_name + "fields"] = swaggerschema(model);
|
||||
result["schema"][model.records_name] =
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"total_count": {
|
||||
"type":"integer",
|
||||
"format":"int64",
|
||||
"example": 10,
|
||||
"xml": {
|
||||
"attribute": true
|
||||
}
|
||||
},
|
||||
"limit": {
|
||||
"type":"integer",
|
||||
"format":"int64",
|
||||
"example": S("qp_maxrows"),
|
||||
"xml": {
|
||||
"attribute": true
|
||||
}
|
||||
},
|
||||
"offset": {
|
||||
"type":"integer",
|
||||
"format":"int64",
|
||||
"example": 0, // Doen we altijd nog
|
||||
"xml": {
|
||||
"attribute": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
result["schema"][model.records_name]["properties"][model.records_name] =
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/schema/fields/" + model.record_name + "fields"
|
||||
}
|
||||
};
|
||||
|
||||
result["schema"][model.record_name] = {
|
||||
"type": "object",
|
||||
"properties": {}
|
||||
};
|
||||
result["schema"][model.record_name ]["properties"][model.record_name] =
|
||||
{
|
||||
"$ref": "#/schema/fields/" + model.record_name + "fields"
|
||||
}
|
||||
|
||||
if (getQParamInt("single", 0) == 1)
|
||||
{
|
||||
result["get"].summary = "Get one `{0}`".format(model.record_title);
|
||||
result["get"].description = "Returns the `{0}`.".format(model.record_title) + "<br>" + auttext,
|
||||
|
||||
result["get"].parameters.push(
|
||||
{
|
||||
"name":"id",
|
||||
"in":"path",
|
||||
"description":"ID of `{0}` to return".format(model.record_title),
|
||||
"required":true,
|
||||
"type":"integer",
|
||||
"format":"int64"
|
||||
}
|
||||
);
|
||||
result["get"]["responses"]["200"] =
|
||||
{
|
||||
"description": "A `{0}`".format(model.record_title),
|
||||
"schema": {
|
||||
"$ref": "#/schema/" + model.record_name
|
||||
}
|
||||
};
|
||||
}
|
||||
if (getQParamInt("single", 0) == 0 && model["REST_POST"])
|
||||
{
|
||||
result["post"] = {
|
||||
"tags":[
|
||||
getQParamSafe("module", "XXX")
|
||||
],
|
||||
"summary":"Add a new `{0}`".format(model.record_title),
|
||||
"description": auttext,
|
||||
"operationId":"add" + model.records_name,
|
||||
"parameters":[
|
||||
{
|
||||
"in":"body",
|
||||
"name":"body",
|
||||
"description":"`{0}` object that needs to be added".format(model.record_title),
|
||||
"required":true,
|
||||
"xxxschema":{
|
||||
"$ref":"#/definitions/Pet"
|
||||
},
|
||||
"schema": {
|
||||
"$ref": "#/schema/" + model.record_name
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses":{
|
||||
"200": {
|
||||
"description": "A `{0}`".format(model.record_title),
|
||||
"schema": {
|
||||
"$ref": "#/schema/" + model.record_name
|
||||
}
|
||||
},
|
||||
"400":{
|
||||
"description":"Bad request"
|
||||
},
|
||||
"403": {
|
||||
"description": "Forbidden"
|
||||
}
|
||||
},
|
||||
"security":[
|
||||
{
|
||||
"api_key":[]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
if (getQParamInt("single", 0) == 1 && model["REST_PUT"])
|
||||
{
|
||||
result["put"] = {
|
||||
"tags":[
|
||||
getQParamSafe("module", "XXX")
|
||||
],
|
||||
"summary":"Update one `{0}`".format(model.record_title),
|
||||
"description": "Update an existing `{0}`".format(model.record_title) + "<br>" + auttext,
|
||||
"operationId":"add" + model.records_name,
|
||||
"parameters":[
|
||||
{
|
||||
"name":"id",
|
||||
"in":"path",
|
||||
"description":"ID of `{0}` to update".format(model.record_title),
|
||||
"required":true,
|
||||
"type":"integer",
|
||||
"format":"int64"
|
||||
},
|
||||
{
|
||||
"in":"body",
|
||||
"name":"body",
|
||||
"description":"`{0}` object that needs to be updated".format(model.record_title),
|
||||
"required":true,
|
||||
"xxxschema":{
|
||||
"$ref":"#/definitions/Pet"
|
||||
},
|
||||
"schema": {
|
||||
"$ref": "#/schema/" + model.record_name
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses":{
|
||||
"200": {
|
||||
"description": "A `{0}`".format(model.record_title),
|
||||
"schema": {
|
||||
"$ref": "#/schema/" + model.record_name
|
||||
}
|
||||
},
|
||||
"403": {
|
||||
"description": "Forbidden"
|
||||
},
|
||||
"400":{
|
||||
"description":"Bad request"
|
||||
}
|
||||
},
|
||||
"security":[
|
||||
{
|
||||
"api_key":[ ]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
if (getQParamInt("single", 0) == 1 && model["REST_DELETE"])
|
||||
{
|
||||
result["delete"] = {
|
||||
"tags":[
|
||||
getQParamSafe("module", "XXX")
|
||||
],
|
||||
"summary":"Delete one `{0}`".format(model.record_title),
|
||||
"description": auttext,
|
||||
"operationId":"add" + model.records_name,
|
||||
"parameters":[
|
||||
{
|
||||
"name":"id",
|
||||
"in":"path",
|
||||
"description":"ID of `{0}` to delete".format(model.record_title),
|
||||
"required":true,
|
||||
"type":"integer",
|
||||
"format":"int64"
|
||||
}
|
||||
],
|
||||
"responses":{
|
||||
"204":{
|
||||
"description":"No content (delete succesfull or record not found)"
|
||||
},
|
||||
"403": {
|
||||
"description": "Forbidden"
|
||||
}
|
||||
},
|
||||
"security":[
|
||||
{
|
||||
"api_key":[ ]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
%>
|
||||
@@ -1,25 +0,0 @@
|
||||
<%@ language = "JavaScript" %>
|
||||
<% /*
|
||||
$Revision$
|
||||
$Id$
|
||||
|
||||
File: api_about.asp
|
||||
|
||||
Description:
|
||||
Parameters:
|
||||
Context:
|
||||
|
||||
Notes:
|
||||
*/
|
||||
DOCTYPE_Disable = true;
|
||||
ANONYMOUS_Allowed = 1; // Eigenlijk niet waar. We regelen echter alles zelf
|
||||
THIS_FILE = "appl/api/api_about.asp";
|
||||
|
||||
%>
|
||||
<!-- #include file="../Shared/common.inc" -->
|
||||
<!-- #include file="./api2_rest.inc" -->
|
||||
<!-- #include file="../Shared/json2.js" -->
|
||||
<!-- #include file="./model_about.inc" -->
|
||||
<%
|
||||
api2_rest.process(model_about);
|
||||
%>
|
||||
@@ -1,26 +0,0 @@
|
||||
<%@ language = "JavaScript" %>
|
||||
<% /*
|
||||
$Revision$
|
||||
$Id$
|
||||
|
||||
File: api_authorizationgroups.asp
|
||||
|
||||
Description: ALG_GEBOUW API
|
||||
Parameters:
|
||||
Context: Door een remote systeem (geen persoon) om info uit FACILITOR te halen aan te roepen
|
||||
|
||||
Notes: Eigen bestand zodat we internal: true kunnen meegeven
|
||||
*/
|
||||
DOCTYPE_Disable = true;
|
||||
ANONYMOUS_Allowed = 1; // Eigenlijk niet waar. We regelen echter alles zelf
|
||||
THIS_FILE = "appl/api/api_authorizationgroups.asp";
|
||||
|
||||
%>
|
||||
<!-- #include file="../Shared/common.inc" -->
|
||||
<!-- #include file="./api2_rest.inc" -->
|
||||
<!-- #include file="../Shared/json2.js" -->
|
||||
<!-- #include file="./model_fac_groep.inc" -->
|
||||
<%
|
||||
var groep = new model_fac_groep(null, { internal: true }); // internal zodat PUT/POST/DELETE ook kunnen
|
||||
api2_rest.process(groep);
|
||||
%>
|
||||
@@ -1,25 +0,0 @@
|
||||
<%@ language = "JavaScript" %>
|
||||
<% /*
|
||||
$Revision$
|
||||
$Id$
|
||||
|
||||
File: api_ins_deelsrtcontrole.asp
|
||||
|
||||
Description: Inspecties model
|
||||
Parameters:
|
||||
Context: Door een remote systeem (geen persoon) om info uit FACILITOR te halen aan te roepen
|
||||
|
||||
Notes:
|
||||
*/
|
||||
DOCTYPE_Disable = true;
|
||||
ANONYMOUS_Allowed = 1; // Eigenlijk niet waar. We regelen echter alles zelf
|
||||
THIS_FILE = "appl/api/api_ins_deelsrtcontrole.asp";
|
||||
|
||||
%>
|
||||
<!-- #include file="../Shared/common.inc" -->
|
||||
<!-- #include file="./api2_rest.inc" -->
|
||||
<!-- #include file="../Shared/json2.js" -->
|
||||
<!-- #include file="./model_ins_deelsrtcontrole.inc" -->
|
||||
<%
|
||||
api2_rest.process(model_ins_deelsrtcontrole);
|
||||
%>
|
||||
@@ -21,5 +21,5 @@
|
||||
<!-- #include file="../Shared/json2.js" -->
|
||||
<!-- #include file="./model_locations.inc" -->
|
||||
<%
|
||||
api2_rest.process(model_alg_locatie);
|
||||
api2_rest.process(model_locations);
|
||||
%>
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
DOCTYPE_Disable = true;
|
||||
ANONYMOUS_Allowed = 1; // Eigenlijk niet waar. We regelen echter alles zelf
|
||||
THIS_FILE = "appl/api2/api_orders.asp";
|
||||
THIS_FILE = "appl/api/api_orders.asp";
|
||||
|
||||
%>
|
||||
<!-- #include file="../Shared/common.inc" -->
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
|
||||
File: api_persons.asp
|
||||
|
||||
Description: ALG_GEBOUW API
|
||||
Description: PRS_PERSLID API
|
||||
Parameters:
|
||||
Context: Door een remote systeem (geen persoon) om info uit FACILITOR te halen aan te roepen
|
||||
|
||||
Notes: Eigen bestand zodat we internal: true kunnen meegeven
|
||||
Notes:
|
||||
*/
|
||||
DOCTYPE_Disable = true;
|
||||
ANONYMOUS_Allowed = 1; // Eigenlijk niet waar. We regelen echter alles zelf
|
||||
@@ -19,8 +19,7 @@
|
||||
<!-- #include file="../Shared/common.inc" -->
|
||||
<!-- #include file="./api2_rest.inc" -->
|
||||
<!-- #include file="../Shared/json2.js" -->
|
||||
<!-- #include file="./model_prs_perslid.inc" -->
|
||||
<!-- #include file="./model_persons.inc" -->
|
||||
<%
|
||||
var perslid = new model_prs_perslid({ internal: true }); // internal zodat PUT/POST/DELETE ook kunnen
|
||||
api2_rest.process(perslid);
|
||||
api2_rest.process(model_persons);
|
||||
%>
|
||||
@@ -1,25 +0,0 @@
|
||||
<%@ language = "JavaScript" %>
|
||||
<% /*
|
||||
$Revision$
|
||||
$Id$
|
||||
|
||||
File: api_swagger.asp
|
||||
|
||||
Description: META API
|
||||
Parameters:
|
||||
Context:
|
||||
|
||||
Notes:
|
||||
*/
|
||||
DOCTYPE_Disable = true;
|
||||
ANONYMOUS_Allowed = 1; // Eigenlijk niet waar. We regelen echter alles zelf
|
||||
THIS_FILE = "appl/api/api_swagger.asp";
|
||||
|
||||
%>
|
||||
<!-- #include file="../Shared/common.inc" -->
|
||||
<!-- #include file="./api2_rest.inc" -->
|
||||
<!-- #include file="../Shared/json2.js" -->
|
||||
<!-- #include file="./model_swagger.inc" -->
|
||||
<%
|
||||
api2_rest.process(model_apis);
|
||||
%>
|
||||
@@ -1,41 +0,0 @@
|
||||
<% /*
|
||||
$Revision$
|
||||
$Id$
|
||||
|
||||
File: model_about.inc
|
||||
|
||||
Description: about model.
|
||||
Parameters:
|
||||
Context: Voor een App kan dit genoeg informatie zijn om:
|
||||
- Te weten of je tegen deze FACILITOR-versie kunt en wilt draaien
|
||||
- Welke naam je voor de applicatie moet gebruiken als je hem op
|
||||
het homescreen plaatst
|
||||
|
||||
Notes: Levert wat algemene informatie over FACILITOR op
|
||||
*/
|
||||
|
||||
%>
|
||||
<%
|
||||
function model_about()
|
||||
{
|
||||
this.table = "about";
|
||||
this.primary = "id";
|
||||
this.records_name = "about";
|
||||
this.record_name = "api";
|
||||
this.fields = { "version" : { typ: "varchar", val: FCLTVersion },
|
||||
"customer" : { typ: "varchar", val: customerId },
|
||||
// moet apart model_session zijn ?"person" : { typ: "key", val: user_key, foreign: "PRS_PERSLID" }, // Waarom werkt de foreign niet?
|
||||
"applicationname": { typ: "varchar", val: L("lcl_facilitor_appl") },
|
||||
"url" : { typ: "varchar", val: HTTP.urlzelf() }
|
||||
};
|
||||
|
||||
this.REST_GET = function _GET(params)
|
||||
{
|
||||
var about_data = {};
|
||||
for (var fld in this.fields)
|
||||
about_data[fld] = this.fields[fld].val;
|
||||
|
||||
return [about_data]; // Array, compatible met alle andere API2-GET functies
|
||||
}
|
||||
}
|
||||
%>
|
||||
@@ -12,39 +12,34 @@
|
||||
*/
|
||||
%>
|
||||
<%
|
||||
function model_alg_kenmerk(niveau, params)
|
||||
|
||||
function model_alg_kenmerk(niveau)
|
||||
{
|
||||
params = params || {};
|
||||
this.records_name = "realestateproperties";
|
||||
this.record_name = "realestateproperty";
|
||||
this.table = "alg_kenmerk";
|
||||
this.primary = "alg_kenmerk_key";
|
||||
this.records_name = "alg_kenmerks";
|
||||
this.record_name = "alg_kenmerk";
|
||||
this.soft_delete = "alg_kenmerk_verwijder";
|
||||
this.autfunction = params.internal?false:"WEB_PRSSYS";
|
||||
this.record_title = L("alg_kenmerk");
|
||||
this.records_title = L("alg_kenmerk_m");
|
||||
this.module = "ALG";
|
||||
|
||||
// overrule titel voor schermen.
|
||||
this.record_title = L("mgt_kenmerk") + " " + get_real_estate_name(niveau);
|
||||
this.records_title = L("mgt_kenmerk_m") + " " + get_real_estate_name(niveau);
|
||||
this.autfunction = "WEB_PRSSYS";
|
||||
this.record_title = L("mgt_kenmerk") + " " + get_onrgoed_naam(niveau);
|
||||
this.records_title = L("mgt_kenmerk_m") + " " + get_onrgoed_naam(niveau);;
|
||||
|
||||
|
||||
this.fields = {
|
||||
"id": {
|
||||
"dbs": "alg_kenmerk_key",
|
||||
"label": L("lcl_key"),
|
||||
"label": "Key",
|
||||
"typ": "key",
|
||||
"required": true,
|
||||
"filter": "exact",
|
||||
"seq": "alg_s_alg_kenmerk_key"
|
||||
},
|
||||
"level": {
|
||||
"alg_kenmerk_niveau": {
|
||||
"dbs": "alg_kenmerk_niveau",
|
||||
"label": L("mgt_kenmerk_niveau"),
|
||||
"typ": "varchar",
|
||||
"hidden_fld": true,
|
||||
"LOV": fill_real_estate_level_LOV(),
|
||||
"LOV": fill_og_niveau_LOV(),
|
||||
"defaultvalue": "L"
|
||||
},
|
||||
"sequence": {
|
||||
@@ -73,7 +68,7 @@ function model_alg_kenmerk(niveau, params)
|
||||
"typ": "varchar",
|
||||
"translate": true
|
||||
},
|
||||
"attributetype": {
|
||||
"property_type": {
|
||||
"dbs": "alg_kenmerk_kenmerktype",
|
||||
"label": L("mgt_srtkenmerk_kenmerktype"),
|
||||
"typ": "varchar",
|
||||
@@ -88,7 +83,7 @@ function model_alg_kenmerk(niveau, params)
|
||||
"LOV": buildVerplichtingList(),
|
||||
"emptyoption": null
|
||||
},
|
||||
"group": {
|
||||
"property_group": {
|
||||
"dbs": "alg_kenmerk_groep",
|
||||
"label": L("mgt_kenmerk_groep"),
|
||||
"typ": "key",
|
||||
@@ -134,7 +129,7 @@ function model_alg_kenmerk(niveau, params)
|
||||
"filter": "exact",
|
||||
"LOVinit": ""
|
||||
},
|
||||
"propertydefault": {
|
||||
"default": {
|
||||
"dbs": "alg_kenmerk_default",
|
||||
"label": L("mgt_kenmerk_default"),
|
||||
"typ": "memo",
|
||||
@@ -161,7 +156,7 @@ function model_alg_kenmerk(niveau, params)
|
||||
this.REST_DELETE = generic_REST_DELETE(this);
|
||||
|
||||
|
||||
function get_real_estate_name(niveau)
|
||||
function get_onrgoed_naam(niveau)
|
||||
{
|
||||
var naam = "";
|
||||
switch (niveau)
|
||||
@@ -176,13 +171,5 @@ function model_alg_kenmerk(niveau, params)
|
||||
return naam;
|
||||
}
|
||||
|
||||
function fill_real_estate_level_LOV()
|
||||
{
|
||||
return "D;"+L("lcl_district")
|
||||
+ ";L;"+L("lcl_location")
|
||||
+ ";G;"+L("lcl_building")
|
||||
+ ";R;"+L("lcl_room"); // Moet hier T en V ook nog bij?
|
||||
}
|
||||
|
||||
}
|
||||
%>
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
File: model_alg_srtgebouw.inc
|
||||
|
||||
Description: Model voor alg_srtgebouw
|
||||
Description: Vanuit CodeCharge gegenereerd model voor alg_srtgebouw
|
||||
|
||||
Context:
|
||||
|
||||
@@ -14,10 +14,11 @@
|
||||
<%
|
||||
function model_alg_srtgebouw()
|
||||
{
|
||||
this.records_name = "buildingfunctions";
|
||||
this.record_name = "buildingfunction";
|
||||
var tab_key = getQParamInt("alg_srtgebouw_key", -1);
|
||||
this.table = "alg_srtgebouw";
|
||||
this.primary = "alg_srtgebouw_key";
|
||||
this.records_name = "alg_srtgebouws";
|
||||
this.record_name = "alg_srtgebouw";
|
||||
this.soft_delete = "alg_srtgebouw_verwijder";
|
||||
this.autfunction = "WEB_ALGMSU";
|
||||
this.record_title = L("alg_srtgebouw");
|
||||
@@ -27,7 +28,7 @@ function model_alg_srtgebouw()
|
||||
this.fields = {
|
||||
"id": {
|
||||
"dbs": "alg_srtgebouw_key",
|
||||
"label": L("lcl_key"),
|
||||
"label": "Key",
|
||||
"typ": "key",
|
||||
"required": true,
|
||||
"filter": "exact",
|
||||
@@ -44,8 +45,7 @@ function model_alg_srtgebouw()
|
||||
"dbs": "alg_srtgebouw_passief",
|
||||
"label": L("alg_srtgebouw_passief"),
|
||||
"typ": "check",
|
||||
"invert": true,
|
||||
"multiedit": true
|
||||
"invert": true
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
File: model_alg_srtterreinsector.inc
|
||||
|
||||
Description: Model voor alg_srtterreinsector
|
||||
Description: Vanuit CodeCharge gegenereerd model voor alg_srtterreinsector
|
||||
|
||||
Context:
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
<%
|
||||
function model_alg_srtterreinsector()
|
||||
{
|
||||
this.records_name = "terrainfunctions";
|
||||
this.record_name = "terrainfunction";
|
||||
this.table = "alg_srtterreinsector";
|
||||
this.primary = "alg_srtterreinsector_key";
|
||||
this.records_name = "alg_srtterreinsectors";
|
||||
this.record_name = "alg_srtterreinsector";
|
||||
this.soft_delete = "alg_srtterreinsector_verwijder";
|
||||
this.autfunction = "WEB_ALGMSU";
|
||||
this.record_title = L("alg_srtterreinsector");
|
||||
@@ -27,7 +27,7 @@ function model_alg_srtterreinsector()
|
||||
this.fields = {
|
||||
"id": {
|
||||
"dbs": "alg_srtterreinsector_key",
|
||||
"label": L("lcl_key"),
|
||||
"label": "Key",
|
||||
"typ": "key",
|
||||
"required": true,
|
||||
"filter": "exact",
|
||||
@@ -40,47 +40,41 @@ function model_alg_srtterreinsector()
|
||||
"translate": true,
|
||||
"required": true
|
||||
},
|
||||
"price1": {
|
||||
"price_1": {
|
||||
"dbs": "alg_srtterreinsector_prijs",
|
||||
"label": L("alg_srtterreinsector_prijs"),
|
||||
"iscurrency": true,
|
||||
"typ": "float",
|
||||
"multiedit": true
|
||||
"typ": "float"
|
||||
},
|
||||
"price2": {
|
||||
"price_2": {
|
||||
"dbs": "alg_srtterreinsector_prijs2",
|
||||
"label": L("alg_srtterreinsector_prijs2"),
|
||||
"iscurrency": true,
|
||||
"typ": "float",
|
||||
"multiedit": true
|
||||
"typ": "float"
|
||||
},
|
||||
"price3": {
|
||||
"price_3": {
|
||||
"dbs": "alg_srtterreinsector_prijs3",
|
||||
"label": L("alg_srtterreinsector_prijs3"),
|
||||
"iscurrency": true,
|
||||
"typ": "float",
|
||||
"multiedit": true
|
||||
"typ": "float"
|
||||
},
|
||||
"price4": {
|
||||
"price_4": {
|
||||
"dbs": "alg_srtterreinsector_prijs4",
|
||||
"label": L("alg_srtterreinsector_prijs4"),
|
||||
"iscurrency": true,
|
||||
"typ": "float",
|
||||
"multiedit": true
|
||||
"typ": "float"
|
||||
},
|
||||
"price5": {
|
||||
"price_5": {
|
||||
"dbs": "alg_srtterreinsector_prijs5",
|
||||
"label": L("alg_srtterreinsector_prijs5"),
|
||||
"iscurrency": true,
|
||||
"typ": "float",
|
||||
"multiedit": true
|
||||
"typ": "float"
|
||||
},
|
||||
"rentable": {
|
||||
"dbs": "prs_verhuurbaar",
|
||||
"label": L("prs_verhuurbaar"),
|
||||
"iscurrency": true,
|
||||
"typ": "check",
|
||||
"multiedit": true
|
||||
"typ": "check"
|
||||
},
|
||||
"code": {
|
||||
"dbs": "alg_srtterreinsector_code",
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
*/
|
||||
|
||||
%>
|
||||
<!--#include file="./api2_dispatch.inc"-->
|
||||
<%
|
||||
model_apis =
|
||||
{
|
||||
@@ -20,78 +19,45 @@ model_apis =
|
||||
primary: "id",
|
||||
records_name: "apis",
|
||||
record_name: "api",
|
||||
fields : { "id" : { typ: "varchar", label: "Api", filter: "exact" },
|
||||
"module" : { typ: "varchar", label: "Module", filter: "exact" },
|
||||
"name" : { typ: "varchar", label: "Api", filter: "exact" }
|
||||
},
|
||||
fields : { "id" : { xxdbs: "fac_usrrap_key", typ: "varchar", label: "Api", filter: "exact" }},
|
||||
|
||||
REST_GET: function _GET(params)
|
||||
{
|
||||
var autfunction = "WEB_APIDOC"; // is dit niet erg streng?
|
||||
params.authparams = user.checkAutorisation(autfunction, null, null, true); // pessimistisch
|
||||
|
||||
var safefieldnames = [];
|
||||
var lcl2fld = {};
|
||||
|
||||
var api2_names = [];
|
||||
for (var dispatch in api2_mapper)
|
||||
|
||||
var fullpath = Server.MapPath("./appl/api2");
|
||||
var objFso = new ActiveXObject("Scripting.FileSystemObject");
|
||||
var objFiles = objFso.GetFolder(fullpath);
|
||||
var allFiles = new Enumerator(objFiles.files);
|
||||
for (; !allFiles.atEnd(); allFiles.moveNext())
|
||||
{
|
||||
if (api2_mapper[dispatch].hidden)
|
||||
continue;
|
||||
var attFile = allFiles.item();
|
||||
|
||||
var filepath = api2_mapper[dispatch].filename;
|
||||
var filename = filepath.split('/').pop();
|
||||
var module = api2_mapper[dispatch].module || filename.substr(0, 3).toUpperCase();
|
||||
var apidata = { id: dispatch,
|
||||
name: "<<" + dispatch + ">>",
|
||||
modulecode: module,
|
||||
module: L("lcl_module_" + module)
|
||||
}
|
||||
if (api2_mapper[dispatch].lcl_name)
|
||||
apidata.name = L(api2_mapper[dispatch].lcl_name);
|
||||
if ("docparam" in api2_mapper[dispatch])
|
||||
apidata.docparam = api2_mapper[dispatch].docparam;
|
||||
if ("nodoc" in api2_mapper[dispatch])
|
||||
apidata.nodoc = api2_mapper[dispatch].nodoc;
|
||||
|
||||
var lclname = "{0}_m".format(filename.split(".")[0]); // alg_ruimte_m
|
||||
lcl2fld[lclname] = apidata;
|
||||
safefieldnames.push(safe.quoted_sql(lclname));
|
||||
|
||||
api2_names.push(apidata);
|
||||
}
|
||||
|
||||
// kijken of er een L() bestaat voor de api2_mapper filenaam
|
||||
if (safefieldnames.length)
|
||||
{
|
||||
//model.fields[fld].hint = "Hallo";
|
||||
var sql = "SELECT fac_locale_xsl_label, "
|
||||
+ " COALESCE(fac_locale_xsl_cust, fac_locale_xsl_tekst) fac_locale_xsl_tekst"
|
||||
+ " FROM fac_locale_xsl xsl"
|
||||
+ " WHERE fac_locale_xsl_lang = " + safe.quoted_sql(user_lang)
|
||||
+ " AND fac_locale_xsl_module = 'ASP'"
|
||||
+ " AND fac_locale_xsl_label IN (" + safefieldnames.join(", ") + ")";
|
||||
var oRs = Oracle.Execute(sql);
|
||||
while (!oRs.Eof)
|
||||
var ext = objFso.GetExtensionName(attFile);
|
||||
if ((attFile.name.indexOf("api_") == 0) && (ext == "asp"))
|
||||
{
|
||||
lcl2fld[oRs("fac_locale_xsl_label").Value].name = oRs("fac_locale_xsl_tekst").value;
|
||||
oRs.MoveNext();
|
||||
var name = attFile.name.substring(4, attFile.name.indexOf(".asp"))
|
||||
api2_names.push({ id: name });
|
||||
}
|
||||
oRs.Close();
|
||||
// Graag zou ik er ook info instoppen over het model zelf.
|
||||
// Dan moet ik echter alle model_xxxx.inc bestanden includen wat ik niet wil.
|
||||
// Daarom moet je zelf maar /api2/xxxx.api aanroepen voor de details
|
||||
}
|
||||
|
||||
api2_names.sort(function (a, b) {
|
||||
if (a.modulecode == b.modulecode)
|
||||
return a.id < b.id ? -1: 1;
|
||||
else
|
||||
return a.modulecode < b.modulecode ? -1: 1;
|
||||
});
|
||||
// Graag zou ik er ook info instoppen over het model zelf.
|
||||
// Dan moet ik echter alle model_xxxx.inc bestanden includen wat ik niet wil.
|
||||
// Daarom moet je zelf maar /api2/xxxx.api aanroepen voor de details
|
||||
|
||||
return api2_names;
|
||||
},
|
||||
PUT: function (params) /* update api */
|
||||
{
|
||||
},
|
||||
POST: function (params) /* new api */
|
||||
{
|
||||
},
|
||||
DELETE: function (params) /* delete api */
|
||||
{
|
||||
},
|
||||
|
||||
search: { autosearch: true },
|
||||
list: { default_url: "api2/{0}.scf" }
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<!-- #include file="../Shared/discxalg3d.inc"-->
|
||||
<!-- #include file="../bez/bez.inc" -->
|
||||
<!-- #include file="./model_visitors.inc" -->
|
||||
<!-- #include file="./model_fac_tracking.inc"-->
|
||||
<!-- #include file="./model_tracking.inc"-->
|
||||
<%
|
||||
function afs_alg_onrgoed_keys(jsondata)
|
||||
{
|
||||
@@ -71,13 +71,13 @@ function model_appointments()
|
||||
|
||||
this.list = { columns: ["id", "from", "to"] },
|
||||
this.includes =
|
||||
{"visitors": { model: new model_visitors(),
|
||||
{"visitors": { model: model_visitors,
|
||||
joinfield: "appointment",
|
||||
enable_update: true
|
||||
},
|
||||
"tracking": {
|
||||
model: new model_tracking(['afspraak']),
|
||||
joinfield: "trackingrefkey"
|
||||
joinfield: "fac_tracking_refkey"
|
||||
}
|
||||
};
|
||||
this.impersonate_auth = "WEB_BEZFOF";
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
<% /*
|
||||
$Revision$
|
||||
$Id$
|
||||
|
||||
File: model_aut_client.inc
|
||||
Description:
|
||||
Notes:
|
||||
*/
|
||||
|
||||
%>
|
||||
<!-- #include file="./model_aut_client_perslid.inc" -->
|
||||
<%
|
||||
function model_aut_client(params)
|
||||
{
|
||||
params = params || {};
|
||||
this.records_name = "autclients";
|
||||
this.record_name = "autclient";
|
||||
this.table = "aut_client";
|
||||
this.primary = "aut_client_key";
|
||||
this.autfunction = params.internal?false:"WEB_FACTAB";
|
||||
this.record_title = L("aut_client");
|
||||
this.records_title = L("aut_client_m");
|
||||
|
||||
this.fields = {
|
||||
"id": {
|
||||
"dbs": "aut_client_key",
|
||||
"label": L("lcl_key"),
|
||||
"typ": "key",
|
||||
"seq": "aut_s_aut_client_key"
|
||||
},
|
||||
"code": {
|
||||
"dbs": "aut_client_id",
|
||||
"label": L("aut_client_code"),
|
||||
"typ": "varchar",
|
||||
"filter": "exact",
|
||||
"caseinsensitive": true
|
||||
},
|
||||
"name": {
|
||||
"dbs": "aut_client_omschrijving",
|
||||
"label": L("aut_client_omschrijving"),
|
||||
"typ": "varchar",
|
||||
"required": true
|
||||
},
|
||||
"type": {
|
||||
"dbs": "aut_client_type",
|
||||
"label": L("aut_client_type"),
|
||||
"typ": "key",
|
||||
"required": true,
|
||||
"LOV": L("aut_client_typeLOV")
|
||||
},
|
||||
"remark": {
|
||||
"dbs": "aut_client_opmerking",
|
||||
"label": L("aut_client_opmerking"),
|
||||
"typ": "memo"
|
||||
},
|
||||
"secret": {
|
||||
"dbs": "aut_client_secret",
|
||||
"label": L("aut_client_secret"),
|
||||
"typ": "varchar",
|
||||
"defaultvalue": shared.random(32),
|
||||
"secret": true
|
||||
},
|
||||
"company": {
|
||||
"dbs": "prs_bedrijf_key",
|
||||
"label": L("prs_bedrijf_key"),
|
||||
"typ": "key",
|
||||
"foreign": "PRS_BEDRIJF"
|
||||
}
|
||||
/* ,
|
||||
"redirect_uri": {
|
||||
"dbs": "aut_client_redirect_uri",
|
||||
"label": L("aut_client_redirect_uri"),
|
||||
"typ": "varchar"
|
||||
}*/
|
||||
}
|
||||
|
||||
this.includes =
|
||||
{ "clientpersons": { model: new model_aut_client_perslid(),
|
||||
joinfield: "autclient"
|
||||
}
|
||||
};
|
||||
|
||||
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);
|
||||
}
|
||||
%>
|
||||
@@ -1,136 +0,0 @@
|
||||
<% /*
|
||||
$Revision$
|
||||
$Id$
|
||||
|
||||
File: model_aut_client_perslid.inc
|
||||
Description: Persoonlijke instellingen per Client/app
|
||||
Notes:
|
||||
*/
|
||||
|
||||
function model_aut_client_perslid(params)
|
||||
{
|
||||
params = params || {};
|
||||
this.records_name = "clientpersons";
|
||||
this.record_name = "clientperson";
|
||||
this.table = "aut_client_perslid";
|
||||
this.primary = "aut_client_perslid_key";
|
||||
this.autSELF = "person";
|
||||
this.autfunction = params.self?false:"WEB_FACFAC";
|
||||
this.record_title = L("aut_client_perslid");
|
||||
this.records_title = L("aut_client_perslid_m");
|
||||
|
||||
this.fields = {
|
||||
"id": {
|
||||
"dbs": "aut_client_perslid_key",
|
||||
"label": L("lcl_key"),
|
||||
"typ": "key",
|
||||
"seq": "aut_s_aut_client_perslid_key"
|
||||
},
|
||||
"autclient": {
|
||||
"dbs": "aut_client_key",
|
||||
"label": L("aut_client"),
|
||||
"typ": "key",
|
||||
"hidden_fld": true,
|
||||
"required": true,
|
||||
"foreign": {
|
||||
"tbl": "aut_client",
|
||||
"key": "aut_client_key",
|
||||
"desc": "aut_client_omschrijving"
|
||||
}
|
||||
},
|
||||
"registrationdate": {
|
||||
"dbs": "aut_client_perslid_aanmaak",
|
||||
"label": L("aut_client_perslid_aanmaak"),
|
||||
"typ": "datetime",
|
||||
"readonly": "true"
|
||||
},
|
||||
"device_id": {
|
||||
"dbs": "aut_client_perslid_device_id",
|
||||
"label": L("aut_client_perslid_device_id"),
|
||||
"typ": "varchar",
|
||||
"filter": "exact"
|
||||
},
|
||||
"device_name": {
|
||||
"dbs": "aut_client_perslid_device_name",
|
||||
"label": L("aut_client_perslid_device_name"),
|
||||
"typ": "varchar"
|
||||
},
|
||||
"scope": {
|
||||
"dbs": "aut_client_perslid_scope",
|
||||
"label": L("aut_client_perslid_scope"),
|
||||
"typ": "varchar"
|
||||
},
|
||||
"pushtoken": {
|
||||
"dbs": "aut_client_perslid_pushtoken",
|
||||
"label": L("aut_client_perslid_pushtoken"),
|
||||
"typ": "varchar",
|
||||
"filter": "exact"
|
||||
},
|
||||
"refreshtoken": {
|
||||
"dbs": "aut_client_perslid_refreshtkn",
|
||||
"label": L("aut_client_perslid_refreshtoken"),
|
||||
"typ": "varchar",
|
||||
"filter": "exact"
|
||||
},
|
||||
"refreshdate": {
|
||||
"dbs": "aut_client_perslid_refreshdate",
|
||||
"label": L("aut_client_perslid_refreshdate"),
|
||||
"typ": "datetime"
|
||||
},
|
||||
"accesstoken": {
|
||||
"dbs": "aut_client_perslid_accesstoken",
|
||||
"label": L("aut_client_perslid_accesstoken"),
|
||||
"typ": "varchar",
|
||||
"filter": "exact"
|
||||
},
|
||||
"accessdate": {
|
||||
"dbs": "aut_client_perslid_accessdate",
|
||||
"label": L("aut_client_perslid_accessdate"),
|
||||
"typ": "datetime"
|
||||
},
|
||||
"login": {
|
||||
"dbs": "aut_client_perslid_login",
|
||||
"label": L("aut_client_perslid_login"),
|
||||
"typ": "datetime"
|
||||
},
|
||||
"person": {
|
||||
"dbs": "prs_perslid_key",
|
||||
"label": L("lcl_user"),
|
||||
"typ": "key",
|
||||
"foreign" : "prs_perslid"
|
||||
}
|
||||
}
|
||||
|
||||
this.edit = {
|
||||
"modal": true
|
||||
};
|
||||
|
||||
this.list = {
|
||||
"columns": ["person", "scope", "device_id", "accessdate", "login"]
|
||||
};
|
||||
|
||||
this.REST_GET = generic_REST_GET(this);
|
||||
if (params.internal) // Dan geloof ik het wel
|
||||
{
|
||||
this.autfunction = false;
|
||||
this.REST_POST = generic_REST_POST(this);
|
||||
this.REST_PUT = generic_REST_PUT(this);
|
||||
this.REST_DELETE = generic_REST_DELETE(this);
|
||||
}
|
||||
/*
|
||||
TODO: je eigen device_name mogen bewerken en registratie mogen verwijderen
|
||||
if (params.self) // Alleen device_name bewerken
|
||||
{
|
||||
for (var fld in this.fields)
|
||||
{
|
||||
if (fld != 'device_name')
|
||||
{
|
||||
this.fields[fld].readonly = true;
|
||||
if (!inArray(fld,["autclient", "autclient","registrationdate", "refreshdate"]))
|
||||
this.fields[fld].hidden_fld = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
%>
|
||||
@@ -1,181 +0,0 @@
|
||||
<% /*
|
||||
$Revision$
|
||||
$Id$
|
||||
|
||||
File: model_aut_idp.inc
|
||||
Description:
|
||||
Notes: Documentatie in de wiki onder Authenticeren
|
||||
*/
|
||||
|
||||
%>
|
||||
<!-- #include file="./model_aut_idp_map.inc" -->
|
||||
<%
|
||||
function model_aut_idp(params)
|
||||
{
|
||||
params = params || {};
|
||||
this.records_name = "identityproviders";
|
||||
this.record_name = "identityprovider";
|
||||
this.table = "aut_idp";
|
||||
this.primary = "aut_idp_key";
|
||||
this.autfunction = params.internal?false:"WEB_FACTAB";
|
||||
this.record_title = L("aut_idp");
|
||||
this.records_title = L("aut_idp_m");
|
||||
|
||||
this.askfirst = "type";
|
||||
|
||||
this.fields = {
|
||||
"id": {
|
||||
"dbs": "aut_idp_key",
|
||||
"label": L("lcl_key"),
|
||||
"typ": "key",
|
||||
"seq": "aut_s_aut_idp_key"
|
||||
},
|
||||
"code": {
|
||||
"dbs": "aut_idp_code",
|
||||
"label": L("aut_idp_code"),
|
||||
"typ": "varchar",
|
||||
"filter": "exact"
|
||||
},
|
||||
"name": {
|
||||
"dbs": "aut_idp_omschrijving",
|
||||
"label": L("aut_idp_omschrijving"),
|
||||
"typ": "varchar",
|
||||
"required": true
|
||||
},
|
||||
"type": {
|
||||
"dbs": "aut_idp_type",
|
||||
"label": L("aut_idp_type"),
|
||||
"typ": "key",
|
||||
"required": true,
|
||||
"insertonly": true,
|
||||
"LOV": L("aut_idp_typeLOV")
|
||||
},
|
||||
"remark": {
|
||||
"dbs": "aut_idp_opmerking",
|
||||
"label": L("aut_idp_opmerking"),
|
||||
"typ": "memo"
|
||||
},
|
||||
"secret": {
|
||||
"dbs": "aut_idp_secret",
|
||||
"label": L("aut_idp_secret"),
|
||||
"typ": "varchar",
|
||||
"defaultvalue": shared.random(32),
|
||||
"secret": true,
|
||||
"clone": false
|
||||
},
|
||||
"audience": {
|
||||
"dbs": "aut_idp_audience",
|
||||
"label": L("aut_idp_audience"),
|
||||
"typ": "varchar",
|
||||
"placeholder": customerId + ".facilitor.nl",
|
||||
"filter": "exact"
|
||||
},
|
||||
"issuer": {
|
||||
"dbs": "aut_idp_issuer",
|
||||
"label": L("aut_idp_issuer"),
|
||||
"typ": "varchar",
|
||||
"filter": "exact"
|
||||
},
|
||||
"algorithm": {
|
||||
"dbs": "aut_idp_algorithm",
|
||||
"label": L("aut_idp_algorithm"),
|
||||
"typ": "varchar"
|
||||
},
|
||||
"clockskew": {
|
||||
"dbs": "aut_idp_clockskew",
|
||||
"label": L("aut_idp_clockskew"),
|
||||
"typ": "number",
|
||||
"defaultvalue": 30
|
||||
},
|
||||
"duration": {
|
||||
"dbs": "aut_idp_duration",
|
||||
"label": L("aut_idp_duration"),
|
||||
"typ": "number"
|
||||
},
|
||||
"remoteloginurl": {
|
||||
"dbs": "aut_idp_remote_loginurl",
|
||||
"label": L("aut_idp_remote_loginurl"),
|
||||
"typ": "varchar"
|
||||
},
|
||||
"samlmetaurl": {
|
||||
"dbs": "aut_idp_saml_metaurl",
|
||||
"label": L("aut_idp_saml_metaurl"),
|
||||
"typ": "varchar"
|
||||
},
|
||||
"remotelogouturl": {
|
||||
"dbs": "aut_idp_remote_logouturl",
|
||||
"label": L("aut_idp_remote_logouturl"),
|
||||
"typ": "varchar"
|
||||
},
|
||||
"ipfilter": {
|
||||
"dbs": "aut_idp_ipfilter",
|
||||
"label": L("aut_idp_ipfilter"),
|
||||
"typ": "varchar"
|
||||
},
|
||||
"_currentIP" : {
|
||||
"dbs": "",
|
||||
"label": "Current IP",
|
||||
"typ": "label",
|
||||
"labelvalue": String(Request.ServerVariables("REMOTE_ADDR"))
|
||||
},
|
||||
"ipauto": {
|
||||
"dbs": "aut_idp_ipauto",
|
||||
"label": L("aut_idp_ipauto"),
|
||||
"typ": "check0"
|
||||
},
|
||||
"autocreate": {
|
||||
"dbs": "aut_idp_autocreate",
|
||||
"label": L("aut_idp_autocreate"),
|
||||
"typ": "key",
|
||||
"required": "true",
|
||||
"LOV": L("aut_idp_autocreateLOV"),
|
||||
"defaultvalue": 0
|
||||
},
|
||||
"company": {
|
||||
"dbs": "prs_bedrijf_key",
|
||||
"typ": "key",
|
||||
"foreign": { tbl: "prs_bedrijf",
|
||||
key: "prs_bedrijf_key",
|
||||
desc: "prs_bedrijf_naam",
|
||||
"where": "prs_bedrijf_intern = 1" },
|
||||
"label": L("lcl_idp_company")
|
||||
},
|
||||
"department": {
|
||||
"dbs": "prs_afdeling_key",
|
||||
"typ": "key",
|
||||
"foreign": "prs_afdeling",
|
||||
"label": L("lcl_idp_department")
|
||||
},
|
||||
/* "authorization": {
|
||||
"dbs": "fac_functie_key",
|
||||
"label": L("aut_idp_functie_key"),
|
||||
"typ": "key",
|
||||
"foreign": "fac_functie"
|
||||
},
|
||||
*/
|
||||
"loglevel": {
|
||||
"dbs": "aut_idp_loglevel",
|
||||
"label": L("aut_idp_loglevel"),
|
||||
"typ": "number",
|
||||
"defaultvalue": 0
|
||||
},
|
||||
"internal": {
|
||||
"dbs": "aut_idp_internal",
|
||||
"label": L("aut_idp_internal"),
|
||||
"typ": "check0",
|
||||
"readonly": true
|
||||
}
|
||||
}
|
||||
this.includes =
|
||||
{"idpmappings": { model: new model_aut_idp_map(),
|
||||
joinfield: "identityprovider",
|
||||
enable_update: true
|
||||
}
|
||||
};
|
||||
|
||||
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);
|
||||
}
|
||||
%>
|
||||
@@ -1,112 +0,0 @@
|
||||
<% /*
|
||||
$Revision$
|
||||
$Id$
|
||||
|
||||
File: model_aut_idp_map.inc
|
||||
Description:
|
||||
Notes:
|
||||
*/
|
||||
|
||||
function model_aut_idp_map(params)
|
||||
{
|
||||
params = params || {};
|
||||
this.records_name = "idpmappings";
|
||||
this.record_name = "idpmapping";
|
||||
this.table = "aut_idp_map";
|
||||
this.primary = "aut_idp_map_key";
|
||||
this.autfunction = params.internal?false:"WEB_FACTAB";
|
||||
this.record_title = L("aut_idp_map");
|
||||
this.records_title = L("aut_idp_map_m");
|
||||
|
||||
this.fields = {
|
||||
"id": {
|
||||
"dbs": "aut_idp_map_key",
|
||||
"label": L("lcl_key"),
|
||||
"typ": "key",
|
||||
"seq": "aut_s_aut_idp_map_key"
|
||||
},
|
||||
"identityprovider": {
|
||||
"dbs": "aut_idp_key",
|
||||
"label": L("aut_idp"),
|
||||
"typ": "key",
|
||||
"hidden_fld": true,
|
||||
"required": true
|
||||
},
|
||||
"identify": {
|
||||
"dbs": "aut_idp_map_identify",
|
||||
"label": L("aut_idp_map_identify"),
|
||||
"typ": "check0"
|
||||
},
|
||||
"name": { // Wel een beetje afwijkend, een name veld die een LOV is....
|
||||
"dbs": "aut_idp_map_to",
|
||||
"label": L("aut_idp_map_to"),
|
||||
"typ": "key",
|
||||
"required": true,
|
||||
"LOV": "1;" + L("lcl_prs_person_login")
|
||||
+ ";2;" + L("lcl_prs_person_achternaam")
|
||||
+ ";3;" + L("lcl_prs_person_name")
|
||||
+ ";4;" + L("lcl_prs_person_tussen")
|
||||
+ ";5;" + L("lcl_prs_person_initials")
|
||||
+ ";6;" + L("lcl_prs_person_geslacht")
|
||||
+ ";7;" + L("lcl_prs_person_phone")
|
||||
+ ";8;" + L("lcl_prs_person_title")
|
||||
+ ";9;" + L("lcl_prs_person_email")
|
||||
+ ";10;" + L("lcl_prs_person_phone")
|
||||
+ ";11;" + L("lcl_prs_person_mobile")
|
||||
+ ";12;" + L("prs_perslid_externid")
|
||||
|
||||
// De foreign's
|
||||
+ ";20;" + L("lcl_prs_person_function")
|
||||
+ ";21;" + L("lcl_prs_organisatie")
|
||||
+ ";22;" + L("lcl_prs_profile")
|
||||
//+ kostenplaats ondersteunen we niet, dat is in FACILITOR een organisatie of mandatering
|
||||
|
||||
// ";99;prs_perslid_key" gereserveerd voor intern gebruik
|
||||
|
||||
// De 1-n
|
||||
+ ";100;*" + L("fac_groep_m")
|
||||
+ ";101;*" + L("lcl_workplace")
|
||||
//+ ";102;*" + L("lcl_workplace") + " " + L("lcl_estate_wp_virt") // gaan via @prefix
|
||||
//+ ";103;*" + L("lcl_prs_mandatering") reserved voor mandatering
|
||||
// 1000 + kenmerk_key komt hier nog achter
|
||||
},
|
||||
"from": {
|
||||
"dbs": "aut_idp_map_from",
|
||||
"label": L("aut_idp_map_from"),
|
||||
"typ": "varchar",
|
||||
"required": true
|
||||
},
|
||||
"default": {
|
||||
"dbs": "aut_idp_map_default",
|
||||
"label": L("aut_idp_map_default"),
|
||||
"typ": "varchar"
|
||||
}
|
||||
}
|
||||
// Flexkenmerken er ook bij
|
||||
var sql = "SELECT *"
|
||||
+ " FROM prs_kenmerk"
|
||||
+ " WHERE prs_kenmerk_niveau = 'P'"
|
||||
+ " AND prs_kenmerk_verwijder IS NULL"
|
||||
+ " ORDER BY prs_kenmerk_volgnr";
|
||||
var oRs = Oracle.Execute(sql);
|
||||
while (!oRs.Eof)
|
||||
{
|
||||
this.fields.name.LOV += ";" + String(1000 + oRs("prs_kenmerk_key").Value + ";" + L("mgt_kenmerk") + " " + safe.html(oRs("prs_kenmerk_omschrijving").Value));
|
||||
oRs.MoveNext();
|
||||
}
|
||||
oRs.Close();
|
||||
|
||||
this.edit = {
|
||||
"modal": true
|
||||
};
|
||||
|
||||
this.list = {
|
||||
"columns": ["identify", "name", "from", "default"]
|
||||
};
|
||||
|
||||
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);
|
||||
}
|
||||
%>
|
||||
@@ -1,116 +0,0 @@
|
||||
<% /*
|
||||
$Revision$
|
||||
$Id$
|
||||
|
||||
File: model_aut_sp.inc
|
||||
Description:
|
||||
Notes:
|
||||
*/
|
||||
|
||||
%>
|
||||
<!-- #include file="./model_aut_sp_map.inc" -->
|
||||
<%
|
||||
function model_aut_sp(params)
|
||||
{
|
||||
params = params || {};
|
||||
this.records_name = "serviceproviders";
|
||||
this.record_name = "serviceprovider";
|
||||
this.table = "aut_sp";
|
||||
this.primary = "aut_sp_key";
|
||||
this.autfunction = params.internal?false:"WEB_FACTAB";
|
||||
this.record_title = L("aut_sp");
|
||||
this.records_title = L("aut_sp_m");
|
||||
|
||||
this.fields = {
|
||||
"id": {
|
||||
"dbs": "aut_sp_key",
|
||||
"label": L("lcl_key"),
|
||||
"typ": "key",
|
||||
"seq": "aut_s_aut_sp_key"
|
||||
},
|
||||
"code": {
|
||||
"dbs": "aut_sp_code",
|
||||
"label": L("aut_sp_code"),
|
||||
"typ": "varchar",
|
||||
"filter": "exact"
|
||||
},
|
||||
"name": {
|
||||
"dbs": "aut_sp_omschrijving",
|
||||
"label": L("aut_sp_omschrijving"),
|
||||
"typ": "varchar",
|
||||
"required": true
|
||||
},
|
||||
"type": {
|
||||
"dbs": "aut_sp_type",
|
||||
"label": L("aut_sp_type"),
|
||||
"typ": "key",
|
||||
"required": true,
|
||||
"LOV": L("aut_sp_typeLOV") // TODO?
|
||||
},
|
||||
"remark": {
|
||||
"dbs": "aut_sp_opmerking",
|
||||
"label": L("aut_sp_opmerking"),
|
||||
"typ": "memo"
|
||||
},
|
||||
"secret": {
|
||||
"dbs": "aut_sp_secret",
|
||||
"label": L("aut_sp_secret"),
|
||||
"typ": "varchar",
|
||||
"defaultvalue": shared.random(32),
|
||||
"secret": true
|
||||
},
|
||||
"audience": {
|
||||
"dbs": "aut_sp_audience",
|
||||
"label": L("aut_sp_audience"),
|
||||
"typ": "varchar",
|
||||
"placeholder": customerId + ".facilitor.nl"
|
||||
},
|
||||
"redirecturi": {
|
||||
"dbs": "aut_sp_redirect_uri",
|
||||
"label": L("aut_sp_redirect_uri"),
|
||||
"typ": "varchar",
|
||||
"placeholder": customerId + ".facilitor.nl"
|
||||
},
|
||||
"issuer": {
|
||||
"dbs": "aut_sp_issuer",
|
||||
"label": L("aut_sp_issuer"),
|
||||
"typ": "varchar"
|
||||
},
|
||||
"algorithm": {
|
||||
"dbs": "aut_sp_algorithm",
|
||||
"label": L("aut_sp_algorithm"),
|
||||
"typ": "varchar"
|
||||
},
|
||||
"authorization": {
|
||||
"dbs": "fac_functie_key",
|
||||
"label": L("aut_sp_functie_key"),
|
||||
"typ": "key",
|
||||
"foreign": "fac_functie"
|
||||
},
|
||||
"loglevel": {
|
||||
"dbs": "aut_sp_loglevel",
|
||||
"label": L("aut_sp_loglevel"),
|
||||
"typ": "number",
|
||||
"defaultvalue": 0
|
||||
},
|
||||
"internal": {
|
||||
"dbs": "aut_sp_internal",
|
||||
"label": L("aut_sp_internal"),
|
||||
"typ": "check0",
|
||||
"readonly": true
|
||||
}
|
||||
}
|
||||
|
||||
this.includes =
|
||||
{ "spmappings": { model: new model_aut_sp_map(),
|
||||
joinfield: "serviceprovider",
|
||||
enable_update: true
|
||||
}
|
||||
};
|
||||
|
||||
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);
|
||||
}
|
||||
%>
|
||||
@@ -1,72 +0,0 @@
|
||||
<% /*
|
||||
$Revision$
|
||||
$Id$
|
||||
|
||||
File: model_aut_sp_map.inc
|
||||
Description: Door sp 'released attributes'
|
||||
Notes:
|
||||
*/
|
||||
|
||||
function model_aut_sp_map(params)
|
||||
{
|
||||
params = params || {};
|
||||
this.records_name = "spmappings";
|
||||
this.record_name = "spmapping";
|
||||
this.table = "aut_sp_map";
|
||||
this.primary = "aut_sp_map_key";
|
||||
this.autfunction = params.internal?false:"WEB_FACTAB";
|
||||
this.record_title = L("aut_sp_map");
|
||||
this.records_title = L("aut_sp_map_m");
|
||||
|
||||
this.fields = {
|
||||
"id": {
|
||||
"dbs": "aut_sp_map_key",
|
||||
"label": L("lcl_key"),
|
||||
"typ": "key",
|
||||
"seq": "fac_s_aut_sp_map_key"
|
||||
},
|
||||
"serviceprovider": {
|
||||
"dbs": "aut_sp_key",
|
||||
"label": L("aut_sp"),
|
||||
"typ": "key",
|
||||
"hidden_fld": true,
|
||||
"required": true
|
||||
},
|
||||
"name": {
|
||||
"dbs": "aut_sp_map_from",
|
||||
"label": L("aut_sp_map_from"),
|
||||
"typ": "key",
|
||||
"required": true,
|
||||
"LOV": "1;" + L("lcl_prs_person_login")
|
||||
+ ";2;" + L("lcl_prs_person_achternaam")
|
||||
+ ";3;" + L("lcl_prs_person_voornaam")
|
||||
+ ";4;" + L("lcl_prs_person_email")
|
||||
+ ";5;" + L("lcl_prs_organisatie")
|
||||
+ ";6;" + L("lcl_account")
|
||||
+ ";7;" + L("lcl_prs_person_function")
|
||||
+ ";8;" + L("lcl_lcl_taal")
|
||||
+ ";100;" + L("lcl_workplace")
|
||||
+ ";101;" + L("fac_groeprechten_m")
|
||||
},
|
||||
"to": {
|
||||
"dbs": "aut_sp_map_to",
|
||||
"label": L("aut_sp_map_to"),
|
||||
"typ": "varchar",
|
||||
"required": true
|
||||
}
|
||||
}
|
||||
|
||||
this.edit = {
|
||||
"modal": true
|
||||
};
|
||||
|
||||
this.list = {
|
||||
"columns": ["name", "to"]
|
||||
};
|
||||
|
||||
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);
|
||||
}
|
||||
%>
|
||||
@@ -14,134 +14,127 @@
|
||||
<%
|
||||
model_bes_disc_params =
|
||||
{
|
||||
"records_name": "orderdisciplineparams",
|
||||
"record_name": "orderdisciplineparam",
|
||||
"table": "bes_disc_params",
|
||||
"primary": "bes_disc_params_key",
|
||||
"records_name": "bes_disc_params",
|
||||
"record_name": "bes_disc_params",
|
||||
"autfunction": "WEB_BESMSU",
|
||||
|
||||
|
||||
"fields": {
|
||||
"id": {
|
||||
"dbs": "bes_disc_params_key",
|
||||
"label": L("lcl_key"),
|
||||
"label": "Key",
|
||||
"typ": "key",
|
||||
"seq": "bes_s_bes_disc_params_key"
|
||||
},
|
||||
"orderdiscipline": {
|
||||
"bes_ins_discipline_key": {
|
||||
"dbs": "bes_ins_discipline_key",
|
||||
"label": "Foreign key",
|
||||
"typ": "key",
|
||||
"hidden_fld": true
|
||||
},
|
||||
"approvalflow": {
|
||||
"dbs": "bes_disc_params_fiatflow",
|
||||
"label": L("bes_discipline_fiatflow"),
|
||||
"typ": "number",
|
||||
"LOV": L("bes_discipline_fiatflowLOV"),
|
||||
"emptyoption": null
|
||||
},
|
||||
"purchaseorderlimit1": {
|
||||
"bestellimiet1": {
|
||||
"dbs": "bes_disc_params_bestellimiet",
|
||||
"label": L("bes_discipline_bestellimiet1"),
|
||||
"iscurrency": true,
|
||||
"typ": "float"
|
||||
},
|
||||
"purchaseorderlimit2": {
|
||||
"bestellimiet2": {
|
||||
"dbs": "bes_disc_params_bestellimiet2",
|
||||
"label": L("bes_discipline_bestellimiet2"),
|
||||
"iscurrency": true,
|
||||
"typ": "float"
|
||||
},
|
||||
"purchaseorderlimit3": {
|
||||
"bestellimiet3": {
|
||||
"dbs": "bes_disc_params_bestellimiet3",
|
||||
"label": L("bes_discipline_bestellimiet3"),
|
||||
"iscurrency": true,
|
||||
"typ": "float"
|
||||
},
|
||||
"purchaseorderlimit4": {
|
||||
"bestellimiet4": {
|
||||
"dbs": "bes_disc_params_bestellimiet4",
|
||||
"label": L("bes_discipline_bestellimiet4"),
|
||||
"iscurrency": true,
|
||||
"typ": "float"
|
||||
},
|
||||
"purchaseorderlimit5": {
|
||||
"bestellimiet5": {
|
||||
"dbs": "bes_disc_params_bestellimiet5",
|
||||
"label": L("bes_discipline_bestellimiet5"),
|
||||
"iscurrency": true,
|
||||
"typ": "float"
|
||||
},
|
||||
"minimalamount": {
|
||||
"min_bedrag": {
|
||||
"dbs": "bes_disc_params_min_bedrag",
|
||||
"label": L("bes_discipline_min_bedrag"),
|
||||
"iscurrency": true,
|
||||
"iscurrency": true,
|
||||
"typ": "float"
|
||||
},
|
||||
"createorder": {
|
||||
"auto_order": {
|
||||
"dbs": "bes_disc_params_auto_order",
|
||||
"label": L("bes_discipline_auto_order"),
|
||||
"typ": "check0"
|
||||
},
|
||||
"acceptrequest": {
|
||||
"autoaccept_rfo": {
|
||||
"dbs": "bes_disc_params_autoacceptrfo",
|
||||
"label": L("bes_discipline_autoacceptrfo"),
|
||||
"typ": "check0"
|
||||
},
|
||||
"mutationallowed": {
|
||||
"herfiat": {
|
||||
"dbs": "bes_disc_params_herfiat",
|
||||
"label": L("bes_discipline_herfiat"),
|
||||
"typ": "number",
|
||||
"LOV": L("bes_discipline_herfiatLOV"),
|
||||
"emptyoption": null
|
||||
},
|
||||
"deviationpercentage": {
|
||||
"herfiatpct": {
|
||||
"dbs": "bes_disc_params_herfiatpct",
|
||||
"label": L("bes_discipline_herfiatpct"),
|
||||
"typ": "number"
|
||||
},
|
||||
"deviationamount": {
|
||||
"herfiatmarge": {
|
||||
"dbs": "bes_disc_params_herfiatmarge",
|
||||
"label": L("bes_discipline_herfiatmarge"),
|
||||
"iscurrency": true,
|
||||
"typ": "float"
|
||||
},
|
||||
"invoicepercentage": {
|
||||
"factuurpct": {
|
||||
"dbs": "bes_disc_params_factuurpct",
|
||||
"label": L("bes_discipline_factuurpct"),
|
||||
"typ": "number"
|
||||
},
|
||||
"invoiceamount": {
|
||||
"factuurmarge": {
|
||||
"dbs": "bes_disc_params_factuurmarge",
|
||||
"label": L("bes_discipline_factuurmarge"),
|
||||
"iscurrency": true,
|
||||
"typ": "float"
|
||||
},
|
||||
"invoicematching": {
|
||||
"factmatchmode": {
|
||||
"dbs": "bes_disc_params_factmatchmode",
|
||||
"label": L("bes_discipline_factmatchmode"),
|
||||
"typ": "number",
|
||||
"LOV": L("bes_discipline_factmatchmodeLOV"),
|
||||
"emptyoption": null
|
||||
},
|
||||
"approveinvoice": {
|
||||
"factuurappr": {
|
||||
"dbs": "bes_disc_params_factuurappr",
|
||||
"label": L("bes_discipline_factuurappr"),
|
||||
"typ": "check0"
|
||||
},
|
||||
"invoicelimit": {
|
||||
"factuurgrens": {
|
||||
"dbs": "bes_disc_params_factuurgrens",
|
||||
"label": L("bes_discipline_factuurgrens"),
|
||||
"typ": "number"
|
||||
},
|
||||
"chargebudget": {
|
||||
"pgb": {
|
||||
"dbs": "bes_disc_params_pgb",
|
||||
"label": L("bes_discipline_pgb"),
|
||||
"typ": "number",
|
||||
"LOV": L("bes_discipline_pgbLOV"),
|
||||
"emptyoption": null
|
||||
},
|
||||
"deliverytime": {
|
||||
"leverdagen": {
|
||||
"dbs": "bes_disc_params_leverdagen",
|
||||
"label": L("bes_discipline_leverdagen"),
|
||||
"typ": "number"
|
||||
@@ -151,26 +144,19 @@ model_bes_disc_params =
|
||||
"label": L("bes_discipline_remoteconfirm"),
|
||||
"typ": "check0"
|
||||
},
|
||||
"ordermode": {
|
||||
"dbs": "bes_disc_params_bestelmode",
|
||||
"label": L("bes_discipline_bestelmode"),
|
||||
"freeartikel": {
|
||||
"dbs": "bes_disc_params_freeartikel",
|
||||
"label": L("bes_discipline_freeartikel"),
|
||||
"typ": "number",
|
||||
"LOV": L("bes_discipline_bestelmodeLOV"),
|
||||
"LOV": L("bes_discipline_freeartikelLOV"),
|
||||
"emptyoption": null
|
||||
},
|
||||
"photomode": {
|
||||
"dbs": "bes_disc_params_fotomode",
|
||||
"label": L("bes_discipline_fotomode"),
|
||||
"typ": "number",
|
||||
"LOV": L("bes_discipline_fotomodeLOV"),
|
||||
"emptyoption": null
|
||||
},
|
||||
"punchouturl": {
|
||||
"punchout_url": {
|
||||
"dbs": "bes_disc_params_punchouturl",
|
||||
"label": L("bes_discipline_punchouturl"),
|
||||
"typ": "varchar"
|
||||
},
|
||||
"company": {
|
||||
"punch_bedr_key": {
|
||||
"dbs": "bes_disc_params_punch_bedr_key",
|
||||
"label": L("bes_discipline_punch_bedr_key"),
|
||||
"typ": "key",
|
||||
@@ -180,42 +166,42 @@ model_bes_disc_params =
|
||||
"desc": "prs_bedrijf_naam"
|
||||
}
|
||||
},
|
||||
"logourl": {
|
||||
"logo_url": {
|
||||
"dbs": "bes_disc_params_logo_url",
|
||||
"label": L("bes_discipline_logo_url"),
|
||||
"typ": "varchar"
|
||||
},
|
||||
"reminderdays": {
|
||||
"noti_dagen": {
|
||||
"dbs": "bes_disc_params_noti_dagen",
|
||||
"label": L("bes_discipline_noti_dagen"),
|
||||
"typ": "number"
|
||||
},
|
||||
"notifypurchaser": {
|
||||
"noti_opdr": {
|
||||
"dbs": "bes_disc_params_noti_opdr",
|
||||
"label": L("bes_discipline_noti_opdr"),
|
||||
"typ": "check0"
|
||||
},
|
||||
"notifybackoffice": {
|
||||
"bonotify": {
|
||||
"dbs": "bes_disc_params_bonotify",
|
||||
"label": L("bes_discipline_bonotify"),
|
||||
"typ": "check0"
|
||||
},
|
||||
"returnallowd": {
|
||||
"retour": {
|
||||
"dbs": "bes_disc_params_retour",
|
||||
"label": L("bes_discipline_retour"),
|
||||
"typ": "check0"
|
||||
},
|
||||
"returnurl": {
|
||||
"retour_url": {
|
||||
"dbs": "bes_disc_params_retour_url",
|
||||
"label": L("bes_discipline_retour_url"),
|
||||
"typ": "varchar"
|
||||
},
|
||||
"remarkurl": {
|
||||
"levopm_url": {
|
||||
"dbs": "bes_disc_params_levopm_url",
|
||||
"label": L("bes_discipline_levopm_url"),
|
||||
"typ": "varchar"
|
||||
},
|
||||
"orderdisciplines": {
|
||||
"inkoop_key": {
|
||||
"dbs": "bes_ins_discipline_key_inkoop",
|
||||
"label": L("bes_discipline_key_inkoop"),
|
||||
"typ": "key",
|
||||
@@ -225,27 +211,27 @@ model_bes_disc_params =
|
||||
"desc": "ins_discipline_omschrijving"
|
||||
}
|
||||
},
|
||||
"singlegroup": {
|
||||
"singlegroep": {
|
||||
"dbs": "bes_disc_params_singlegroep",
|
||||
"label": L("bes_discipline_singlegroep"),
|
||||
"typ": "check0"
|
||||
},
|
||||
"ordermandate": {
|
||||
"kpautorisatie": {
|
||||
"dbs": "bes_disc_params_kpautorisatie",
|
||||
"label": L("bes_discipline_kpautorisatie"),
|
||||
"typ": "check0"
|
||||
},
|
||||
"maximumarticles": {
|
||||
"maxartikel": {
|
||||
"dbs": "bes_disc_params_maxartikel",
|
||||
"label": L("bes_discipline_maxartikel"),
|
||||
"typ": "number"
|
||||
},
|
||||
"subscription": {
|
||||
"contract": {
|
||||
"dbs": "bes_disc_params_contract",
|
||||
"label": L("bes_discipline_contract"),
|
||||
"typ": "check0"
|
||||
},
|
||||
"contractdisciplines": {
|
||||
"cnt_disckey": {
|
||||
"dbs": "bes_disc_params_cnt_disckey",
|
||||
"label": L("bes_discipline_cnt_disckey"),
|
||||
"typ": "key",
|
||||
@@ -255,7 +241,7 @@ model_bes_disc_params =
|
||||
"desc": "ins_discipline_omschrijving"
|
||||
}
|
||||
},
|
||||
"contractperiod": {
|
||||
"cnt_termijn": {
|
||||
"dbs": "bes_disc_params_cnt_termijn",
|
||||
"label": L("bes_discipline_cnt_termijn"),
|
||||
"typ": "key",
|
||||
@@ -268,7 +254,7 @@ model_bes_disc_params =
|
||||
"desc": "cnt_termijn_omschrijving"
|
||||
}
|
||||
},
|
||||
"noticeperiod": {
|
||||
"cnt_opzegterm": {
|
||||
"dbs": "bes_disc_params_cnt_opzegterm",
|
||||
"label": L("bes_discipline_cnt_opzegterm"),
|
||||
"typ": "key",
|
||||
@@ -281,22 +267,10 @@ model_bes_disc_params =
|
||||
"desc": "cnt_termijn_omschrijving"
|
||||
}
|
||||
},
|
||||
"forothers": {
|
||||
"for_others": {
|
||||
"dbs": "bes_disc_params_for_others",
|
||||
"label": L("bes_discipline_for_others"),
|
||||
"typ": "check0"
|
||||
},
|
||||
"objectmode": {
|
||||
"dbs": "bes_disc_params_ins_mode",
|
||||
"label": L("lcl_ins_mode"),
|
||||
"typ": "number",
|
||||
"LOV": L("bes_discipline_ins_modeLOV"),
|
||||
"emptyoption": null
|
||||
},
|
||||
"feconfirm": {
|
||||
"dbs": "bes_disc_params_fe_confirm",
|
||||
"label": L("bes_discipline_fe_confirm"),
|
||||
"typ": "check0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,11 +35,10 @@ function model_bes_discipline(disc_key, params)
|
||||
|
||||
_model_bes_discipline = // Internal only
|
||||
{
|
||||
"records_name": "orderdisciplines",
|
||||
"record_name": "orderdiscipline",
|
||||
"table": "ins_tab_discipline",
|
||||
"audit": { "childtable": "bes_disc_params" }, // Parameters voor fac_audit.
|
||||
"primary": "ins_discipline_key",
|
||||
"records_name": "bes_disciplines",
|
||||
"record_name": "bes_discipline",
|
||||
"soft_delete": "ins_discipline_verwijder",
|
||||
"autfunction": "WEB_BESMSU",
|
||||
"record_title": L("bes_discipline"),
|
||||
@@ -49,13 +48,13 @@ _model_bes_discipline = // Internal only
|
||||
"fields": {
|
||||
"id": {
|
||||
"dbs": "ins_discipline_key",
|
||||
"label": L("lcl_key"),
|
||||
"label": "Key",
|
||||
"typ": "key",
|
||||
"required": true,
|
||||
"filter": "exact",
|
||||
"seq": "ins_s_ins_discipline_key"
|
||||
},
|
||||
"module": {
|
||||
"ins_discipline_module": {
|
||||
"dbs": "ins_discipline_module",
|
||||
"label": L("ins_discipline_module"),
|
||||
"typ": "varchar",
|
||||
@@ -77,23 +76,23 @@ _model_bes_discipline = // Internal only
|
||||
"foreign": "prs_kostensoort",
|
||||
"LOVinit": ""
|
||||
},
|
||||
"costcentremandatory": {
|
||||
"ins_discipline_kpnverplicht": {
|
||||
"dbs": "ins_discipline_kpnverplicht",
|
||||
"label": L("ins_discipline_kpnverplicht"),
|
||||
"typ": "check"
|
||||
},
|
||||
"remark": {
|
||||
"ins_discipline_opmerking": {
|
||||
"dbs": "ins_discipline_opmerking",
|
||||
"label": L("ins_discipline_opmerking"),
|
||||
"typ": "memo",
|
||||
"translate": true
|
||||
},
|
||||
"satisfactionpercentage": {
|
||||
"ins_discipline_ktopercentage": {
|
||||
"dbs": "ins_discipline_ktopercentage",
|
||||
"label": L("ins_discipline_ktopercentage"),
|
||||
"typ": "number"
|
||||
},
|
||||
"satisfactionthreshold": {
|
||||
"ins_discipline_ktodrempel": {
|
||||
"dbs": "ins_discipline_ktodrempel",
|
||||
"label": L("ins_discipline_ktodrempel"),
|
||||
"typ": "number"
|
||||
@@ -102,7 +101,7 @@ _model_bes_discipline = // Internal only
|
||||
},
|
||||
"disc_params": {
|
||||
model: model_bes_disc_params,
|
||||
joinfield: "orderdiscipline"
|
||||
joinfield: "bes_ins_discipline_key"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
|
||||
function model_bes_disciplineprod()
|
||||
{
|
||||
this.records_name = "ordercatalogues";
|
||||
this.record_name = "ordercatalogue";
|
||||
this.table = "ins_tab_discipline";
|
||||
this.primary = "ins_discipline_key";
|
||||
this.records_name = "ins_tab_disciplines";
|
||||
this.record_name = "ins_tab_discipline";
|
||||
this.autfunction = "WEB_PRDMSU";
|
||||
this.record_title = L("ins_tab_discipline");
|
||||
this.records_title = L("ins_tab_discipline_m");
|
||||
@@ -27,7 +27,7 @@ function model_bes_disciplineprod()
|
||||
this.fields = {
|
||||
"id": {
|
||||
"dbs": "ins_discipline_key",
|
||||
"label": L("lcl_key"),
|
||||
"label": "Key",
|
||||
"typ": "key",
|
||||
"required": true,
|
||||
"filter": "exact",
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
|
||||
function model_bes_grootheid()
|
||||
{
|
||||
this.records_name = "orderunits";
|
||||
this.record_name = "orderunit";
|
||||
this.table = "bes_grootheid";
|
||||
this.primary = "bes_grootheid_key";
|
||||
this.records_name = "bes_grootheids";
|
||||
this.record_name = "bes_grootheid";
|
||||
this.soft_delete = "bes_grootheid_verwijder";
|
||||
this.autfunction = "WEB_PRDMSU";
|
||||
this.record_title = L("bes_grootheid");
|
||||
@@ -28,7 +28,7 @@ function model_bes_grootheid()
|
||||
this.fields = {
|
||||
"id": {
|
||||
"dbs": "bes_grootheid_key",
|
||||
"label": L("lcl_key"),
|
||||
"label": "Key",
|
||||
"typ": "key",
|
||||
"required": true,
|
||||
"filter": "exact",
|
||||
|
||||
@@ -4,42 +4,40 @@
|
||||
|
||||
File: model_bes_kenmerk.inc
|
||||
|
||||
Description: Model voor bes_kenmerk
|
||||
Description: Vanuit CodeCharge gegenereerd model voor bes_kenmerk
|
||||
|
||||
Context:
|
||||
|
||||
Notes:
|
||||
*/
|
||||
%>
|
||||
<!-- #include file="model_bes_srtkenmerk.inc"-->
|
||||
<%
|
||||
|
||||
function model_bes_kenmerk(params)
|
||||
function model_bes_kenmerk()
|
||||
{
|
||||
params = params || {};
|
||||
this.records_name = "orderlineproperties";
|
||||
this.record_name = "orderlineproperty";
|
||||
this.table = "bes_kenmerk";
|
||||
this.primary = "bes_kenmerk_key";
|
||||
this.records_name = "bes_kenmerks";
|
||||
this.record_name = "bes_kenmerk";
|
||||
this.soft_delete = "bes_kenmerk_verwijder";
|
||||
this.autfunction = params.internal?false:"WEB_BESMGT";
|
||||
this.autfunction = "WEB_BESMGT";
|
||||
this.record_title = L("bes_kenmerk");
|
||||
this.records_title = L("bes_kenmerk_m");
|
||||
this.module = "BES";
|
||||
|
||||
|
||||
this.fields = {
|
||||
"id": {
|
||||
"dbs": "bes_kenmerk_key",
|
||||
"label": L("lcl_key"),
|
||||
"label": "Key",
|
||||
"typ": "key",
|
||||
"required": true,
|
||||
"filter": "exact",
|
||||
"seq": "bes_s_bes_kenmerk_key",
|
||||
"defaultvalue": null
|
||||
},
|
||||
"orderdisciplinehide": {
|
||||
"catalogue_key": {
|
||||
"dbs": "bes_srtinstallatie_key",
|
||||
"label": L("bes_ins_discipline_key"),
|
||||
"label": "bes_srtinstallatie_key",
|
||||
"typ": "key",
|
||||
"hidden_fld": true,
|
||||
"foreign": {
|
||||
@@ -49,7 +47,7 @@ function model_bes_kenmerk(params)
|
||||
},
|
||||
"filter": "exact"
|
||||
},
|
||||
"orderpropertytype": {
|
||||
"property_key": {
|
||||
"dbs": "bes_srtkenmerk_key",
|
||||
"label": L("mgt_srtkenmerk_key"),
|
||||
"typ": "key",
|
||||
@@ -69,7 +67,7 @@ function model_bes_kenmerk(params)
|
||||
"LOVinit": "",
|
||||
"friendlyname": true
|
||||
},
|
||||
"orderdiscipline": {
|
||||
"article_catalogue": {
|
||||
"dbs": "bes_kenmerkbestelregel.ins_discipline_key",
|
||||
"label": L("bes_ins_discipline_key"),
|
||||
"typ": "key",
|
||||
@@ -81,7 +79,7 @@ function model_bes_kenmerk(params)
|
||||
"desc": "ins_discipline_omschrijving"
|
||||
}
|
||||
},
|
||||
"orderarticlegroup": {
|
||||
"article_group": {
|
||||
"dbs": "bes_kenmerkbestelregel.bes_srtgroep_key",
|
||||
"label": L("bes_srtgroep"),
|
||||
"typ": "key",
|
||||
@@ -92,7 +90,7 @@ function model_bes_kenmerk(params)
|
||||
"desc": "bes_srtgroep_omschrijving"
|
||||
}
|
||||
},
|
||||
"orderarticle": {
|
||||
"article": {
|
||||
"dbs": "bes_kenmerkbestelregel.bes_srtdeel_key",
|
||||
"label": L("bes_srtdeel"),
|
||||
"typ": "key",
|
||||
@@ -112,7 +110,7 @@ function model_bes_kenmerk(params)
|
||||
"emptyoption": null,
|
||||
"defaultvalue": "D"
|
||||
},
|
||||
"attributetype": {
|
||||
"order_type": {
|
||||
"dbs": "bes_kenmerk_type",
|
||||
"label": L("bes_kenmerk_type"),
|
||||
"typ": "varchar",
|
||||
@@ -125,14 +123,14 @@ function model_bes_kenmerk(params)
|
||||
"typ": "number",
|
||||
"required": true
|
||||
},
|
||||
"required": {
|
||||
"property_required": {
|
||||
"dbs": "bes_kenmerk_verplicht",
|
||||
"label": L("mgt_kenmerk_verplicht"),
|
||||
"typ": "key",
|
||||
"LOV": buildVerplichtingList(),
|
||||
"emptyoption": null
|
||||
},
|
||||
"group": {
|
||||
"property_group": {
|
||||
"dbs": "bes_kenmerk_groep",
|
||||
"label": L("mgt_kenmerk_groep"),
|
||||
"typ": "key",
|
||||
@@ -140,18 +138,18 @@ function model_bes_kenmerk(params)
|
||||
"LOV": buildGroepsverplichtingList(),
|
||||
"emptyoption": null
|
||||
},
|
||||
"readonly": {
|
||||
"property_readonly": {
|
||||
"dbs": "bes_kenmerk_toonbaar",
|
||||
"label": L("mgt_kenmerk_toonbaar"),
|
||||
"typ": "check"
|
||||
},
|
||||
"propertydefault": {
|
||||
"property_default": {
|
||||
"dbs": "bes_kenmerk_default",
|
||||
"label": L("mgt_kenmerk_default"),
|
||||
"typ": "memo",
|
||||
"translate": true
|
||||
},
|
||||
"hint": {
|
||||
"property_hint": {
|
||||
"dbs": "bes_kenmerk_hint",
|
||||
"label": L("mgt_kenmerk_hint"),
|
||||
"typ": "varchar",
|
||||
@@ -159,55 +157,13 @@ function model_bes_kenmerk(params)
|
||||
"filter": "like",
|
||||
"defaultvalue": null
|
||||
},
|
||||
"regexp": {
|
||||
"property_regexp": {
|
||||
"dbs": "bes_kenmerk_regexp",
|
||||
"label": L("mgt_kenmerk_regexp"),
|
||||
"typ": "varchar"
|
||||
}
|
||||
};
|
||||
|
||||
this.getPropertyType = function (kenmerkdata)
|
||||
{
|
||||
var typedata = api2.GET(new model_bes_srtkenmerk({internal: params.internal}), kenmerkdata.orderpropertytype.id);
|
||||
return typedata;
|
||||
}
|
||||
|
||||
function buildBESKenmerkNiveauList()
|
||||
{
|
||||
return "D;"+L("bes_ins_discipline_key")
|
||||
+ ";G;"+L("bes_srtgroep")
|
||||
+ ";S;"+L("bes_srtdeel");
|
||||
}
|
||||
|
||||
|
||||
this.hook_pre_edit = function (obj, fld)
|
||||
{
|
||||
if (obj.id == -1)
|
||||
{
|
||||
fld.orderarticlegroup.foreign.where = "bes_srtgroep_key IS NULL";
|
||||
fld.orderarticle.foreign.where = "bes_srtdeel_key IS NULL"; // Geen artikelen ophalen: zijn er veel te veel.
|
||||
}
|
||||
%>
|
||||
<script type="text/javascript">
|
||||
var module = "BES";
|
||||
</script>
|
||||
<%
|
||||
}
|
||||
|
||||
this.hook_pre_post = function (params, jsondata)
|
||||
{
|
||||
var checkdata = { module: "bes",
|
||||
srtkenmerk: true,
|
||||
key: jsondata.orderpropertytype,
|
||||
value: jsondata.propertydefault
|
||||
};
|
||||
checkSrtkenmerkValue(checkdata);
|
||||
if (checkdata.err != "")
|
||||
abort_with_warning(checkdata.err);
|
||||
|
||||
jsondata.propertydefault = checkdata.value;
|
||||
}
|
||||
|
||||
|
||||
var ext_sql = "(SELECT DISTINCT"
|
||||
+ " B.bes_kenmerk_key"
|
||||
@@ -242,6 +198,6 @@ function model_bes_kenmerk(params)
|
||||
|
||||
this.REST_POST = generic_REST_POST(this);
|
||||
this.REST_PUT = generic_REST_PUT(this);
|
||||
this.REST_DELETE = generic_REST_DELETE(this);
|
||||
this.REST_DELETE = generic_REST_DELETE(this, {});
|
||||
}
|
||||
%>
|
||||
@@ -15,10 +15,10 @@
|
||||
|
||||
function model_bes_kenmerkbestel()
|
||||
{
|
||||
this.records_name = "orderproperties";
|
||||
this.record_name = "orderproperty";
|
||||
this.table = "bes_kenmerk";
|
||||
this.primary = "bes_kenmerk_key";
|
||||
this.records_name = "bes_kenmerks";
|
||||
this.record_name = "bes_kenmerk";
|
||||
this.soft_delete = "bes_kenmerk_verwijder";
|
||||
this.autfunction = "WEB_BESMGT";
|
||||
this.record_title = L("bes_kenmerkbestel");
|
||||
@@ -28,14 +28,14 @@ function model_bes_kenmerkbestel()
|
||||
this.fields = {
|
||||
"id": {
|
||||
"dbs": "bes_kenmerk_key",
|
||||
"label": L("lcl_key"),
|
||||
"label": "Key",
|
||||
"typ": "key",
|
||||
"required": true,
|
||||
"filter": "exact",
|
||||
"seq": "bes_s_bes_kenmerk_key",
|
||||
"defaultvalue": null
|
||||
},
|
||||
"orderdiscipline": {
|
||||
"catalogue": {
|
||||
"dbs": "bes_srtinstallatie_key",
|
||||
"label": L("bes_ins_discipline_key"),
|
||||
"typ": "key",
|
||||
@@ -49,7 +49,7 @@ function model_bes_kenmerkbestel()
|
||||
"LOVinit": "",
|
||||
"defaultvalue": null
|
||||
},
|
||||
"orderpropertytype": {
|
||||
"property_key": {
|
||||
"dbs": "bes_srtkenmerk_key",
|
||||
"label": L("mgt_srtkenmerk_key"),
|
||||
"typ": "key",
|
||||
@@ -76,7 +76,7 @@ function model_bes_kenmerkbestel()
|
||||
"hidden_fld": true,
|
||||
"defaultvalue": "D"
|
||||
},
|
||||
"attributetype": {
|
||||
"order_type": {
|
||||
"dbs": "bes_kenmerk_type",
|
||||
"label": L("bes_kenmerk_type"),
|
||||
"typ": "varchar",
|
||||
@@ -89,14 +89,14 @@ function model_bes_kenmerkbestel()
|
||||
"typ": "number",
|
||||
"required": true
|
||||
},
|
||||
"required": {
|
||||
"property_required": {
|
||||
"dbs": "bes_kenmerk_verplicht",
|
||||
"label": L("mgt_kenmerk_verplicht"),
|
||||
"typ": "key",
|
||||
"LOV": buildVerplichtingList(),
|
||||
"emptyoption": null
|
||||
},
|
||||
"group": {
|
||||
"property_group": {
|
||||
"dbs": "bes_kenmerk_groep",
|
||||
"label": L("mgt_kenmerk_groep"),
|
||||
"typ": "key",
|
||||
@@ -104,24 +104,24 @@ function model_bes_kenmerkbestel()
|
||||
"LOV": buildGroepsverplichtingList(),
|
||||
"emptyoption": null
|
||||
},
|
||||
"readonly": {
|
||||
"property_readonly": {
|
||||
"dbs": "bes_kenmerk_toonbaar",
|
||||
"label": L("mgt_kenmerk_toonbaar"),
|
||||
"typ": "check"
|
||||
},
|
||||
"propertydefault": {
|
||||
"property_default": {
|
||||
"dbs": "bes_kenmerk_default",
|
||||
"label": L("mgt_kenmerk_default"),
|
||||
"typ": "memo",
|
||||
"translate": true
|
||||
},
|
||||
"hint": {
|
||||
"property_hint": {
|
||||
"dbs": "bes_kenmerk_hint",
|
||||
"label": L("mgt_kenmerk_hint"),
|
||||
"typ": "memo",
|
||||
"translate": true
|
||||
},
|
||||
"regexp": {
|
||||
"property_regexp": {
|
||||
"dbs": "bes_kenmerk_regexp",
|
||||
"label": L("mgt_kenmerk_regexp"),
|
||||
"typ": "varchar"
|
||||
@@ -129,30 +129,6 @@ function model_bes_kenmerkbestel()
|
||||
};
|
||||
|
||||
|
||||
this.hook_pre_edit = function (obj, fld)
|
||||
{
|
||||
%>
|
||||
<script type="text/javascript">
|
||||
var module = "BES";
|
||||
</script>
|
||||
<%
|
||||
}
|
||||
|
||||
this.hook_pre_post = function (params, jsondata)
|
||||
{
|
||||
var checkdata = { module: "bes",
|
||||
srtkenmerk: true,
|
||||
key: jsondata.orderpropertytype,
|
||||
value: jsondata.propertydefault
|
||||
};
|
||||
checkSrtkenmerkValue(checkdata);
|
||||
if (checkdata.err != "")
|
||||
abort_with_warning(checkdata.err);
|
||||
|
||||
jsondata.propertydefault = checkdata.value;
|
||||
}
|
||||
|
||||
|
||||
this.REST_GET = generic_REST_GET(this, {
|
||||
"GET": {
|
||||
"tables": [
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
|
||||
function model_bes_srtgroep()
|
||||
{
|
||||
this.records_name = "orderarticlegroups";
|
||||
this.record_name = "orderarticlegroup";
|
||||
this.table = "bes_srtgroep";
|
||||
this.primary = "bes_srtgroep_key";
|
||||
this.records_name = "bes_srtgroeps";
|
||||
this.record_name = "bes_srtgroep";
|
||||
this.soft_delete = "bes_srtgroep_verwijder";
|
||||
this.autfunction = "WEB_BESMSU";
|
||||
this.record_title = L("bes_srtgroep");
|
||||
@@ -28,14 +28,14 @@ function model_bes_srtgroep()
|
||||
this.fields = {
|
||||
"id": {
|
||||
"dbs": "bes_srtgroep_key",
|
||||
"label": L("lcl_key"),
|
||||
"label": "Key",
|
||||
"typ": "key",
|
||||
"required": true,
|
||||
"filter": "exact",
|
||||
"seq": "bes_s_bes_srtgroep_key",
|
||||
"defaultvalue": null
|
||||
},
|
||||
"orderdisciplines": {
|
||||
"catalogue": {
|
||||
"dbs": "ins_discipline_key",
|
||||
"label": L("bes_ins_discipline_key"),
|
||||
"typ": "key",
|
||||
@@ -61,14 +61,14 @@ function model_bes_srtgroep()
|
||||
"label": L("bes_srtgroep_volgnr"),
|
||||
"typ": "number"
|
||||
},
|
||||
"costtype": {
|
||||
"cost_category": {
|
||||
"dbs": "prs_kostensoort_key",
|
||||
"label": L("prs_kostensoort_key"),
|
||||
"typ": "key",
|
||||
"foreign": {
|
||||
"tbl": "prs_kostensoort",
|
||||
"key": "prs_kostensoort_key",
|
||||
"desc": "prs_kostensoort_oms"
|
||||
"tbl": "PRS_KOSTENSOORT",
|
||||
"key": "PRS_KOSTENSOORT_KEY",
|
||||
"desc": "PRS_KOSTENSOORT_OMS"
|
||||
},
|
||||
"LOVinit": ""
|
||||
}
|
||||
|
||||
@@ -13,23 +13,22 @@
|
||||
%>
|
||||
<%
|
||||
|
||||
function model_bes_srtkenmerk(params)
|
||||
function model_bes_srtkenmerk()
|
||||
{
|
||||
params = params || {};
|
||||
this.records_name = "orderpropertytypes";
|
||||
this.record_name = "orderpropertytype";
|
||||
this.table = "bes_srtkenmerk";
|
||||
this.primary = "bes_srtkenmerk_key";
|
||||
this.records_name = "bes_srtkenmerks";
|
||||
this.record_name = "bes_srtkenmerk";
|
||||
this.soft_delete = "bes_srtkenmerk_verwijder";
|
||||
this.autfunction = params.internal?false:"WEB_BESMGT";
|
||||
this.record_title = L("bes_srtkenmerk");
|
||||
this.records_title = L("bes_srtkenmerk_m");
|
||||
this.autfunction = "WEB_BESMGT";
|
||||
this.record_title = L("mgt_srtkenmerk");
|
||||
this.records_title = L("mgt_srtkenmerk_m");
|
||||
|
||||
|
||||
this.fields = {
|
||||
"id": {
|
||||
"dbs": "bes_srtkenmerk_key",
|
||||
"label": L("lcl_key"),
|
||||
"label": "Key",
|
||||
"typ": "key",
|
||||
"required": true,
|
||||
"filter": "exact",
|
||||
@@ -43,7 +42,7 @@ function model_bes_srtkenmerk(params)
|
||||
"translate": true,
|
||||
"filter": "like"
|
||||
},
|
||||
"attributetype": {
|
||||
"property_type": {
|
||||
"dbs": "bes_srtkenmerk_kenmerktype",
|
||||
"label": L("mgt_srtkenmerk_kenmerktype"),
|
||||
"typ": "varchar",
|
||||
@@ -87,22 +86,9 @@ function model_bes_srtkenmerk(params)
|
||||
};
|
||||
|
||||
|
||||
this.hook_pre_edit = function (obj, fld)
|
||||
{
|
||||
var kenmerktype = (obj.attributetype ? obj.attributetype.id : "");
|
||||
fld.attributetype.LOV = buildKenmerktypeLOV(kenmerktype);
|
||||
%>
|
||||
<script type="text/javascript">
|
||||
var module = "BES";
|
||||
var property_type = "<%=safe.jsstring(kenmerktype)%>";
|
||||
</script>
|
||||
<%
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
this.REST_DELETE = generic_REST_DELETE(this, {});
|
||||
}
|
||||
%>
|
||||
@@ -15,10 +15,10 @@
|
||||
|
||||
function model_bes_srtprodgroep()
|
||||
{
|
||||
this.records_name = "orderproductgroeps";
|
||||
this.record_name = "orderproductgroep";
|
||||
this.table = "bes_srtgroep";
|
||||
this.primary = "bes_srtgroep_key";
|
||||
this.records_name = "bes_srtgroeps";
|
||||
this.record_name = "bes_srtgroep";
|
||||
this.autfunction = "WEB_PRDMSU";
|
||||
this.record_title = L("bes_srtgroep");
|
||||
this.records_title = L("bes_srtgroep_m");
|
||||
@@ -27,14 +27,14 @@ function model_bes_srtprodgroep()
|
||||
this.fields = {
|
||||
"id": {
|
||||
"dbs": "bes_srtgroep_key",
|
||||
"label": L("lcl_key"),
|
||||
"label": "Key",
|
||||
"typ": "key",
|
||||
"required": true,
|
||||
"filter": "exact",
|
||||
"seq": "bes_s_bes_srtgroep_key",
|
||||
"defaultvalue": null
|
||||
},
|
||||
"orderdisciplines": {
|
||||
"catalogue": {
|
||||
"dbs": "ins_discipline_key",
|
||||
"label": L("bes_ins_discipline_key"),
|
||||
"typ": "key",
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
|
||||
function model_bes_staffel()
|
||||
{
|
||||
this.records_name = "orderpacelists";
|
||||
this.record_name = "orderpacelist";
|
||||
this.table = "bes_staffel";
|
||||
this.primary = "bes_staffel_key";
|
||||
this.records_name = "bes_staffels";
|
||||
this.record_name = "bes_staffel";
|
||||
this.autfunction = "WEB_BESMGT";
|
||||
this.record_title = L("bes_staffel");
|
||||
this.records_title = L("bes_staffel_m");
|
||||
@@ -27,14 +27,14 @@ function model_bes_staffel()
|
||||
this.fields = {
|
||||
"id": {
|
||||
"dbs": "bes_staffel_key",
|
||||
"label": L("lcl_key"),
|
||||
"label": "Key",
|
||||
"typ": "key",
|
||||
"required": true,
|
||||
"filter": "exact",
|
||||
"seq": "bes_s_bes_staffel_key",
|
||||
"defaultvalue": null
|
||||
},
|
||||
"orderpacelisttable": {
|
||||
"bes_staffeltabel_key": {
|
||||
"dbs": "bes_staffeltabel_key",
|
||||
"label": L("bes_staffeltabel"),
|
||||
"typ": "key",
|
||||
@@ -44,12 +44,12 @@ function model_bes_staffel()
|
||||
"desc": "bes_staffeltabel_naam"
|
||||
}
|
||||
},
|
||||
"orderpacelimit": { // "limit" is een reserved naam in API2
|
||||
"bes_staffel_grenswaarde": {
|
||||
"dbs": "bes_staffel_grenswaarde",
|
||||
"label": L("bes_staffel_grens"),
|
||||
"typ": "number"
|
||||
},
|
||||
"discount": {
|
||||
"bes_staffel_korting": {
|
||||
"dbs": "bes_staffel_korting",
|
||||
"label": L("bes_staffel_korting"),
|
||||
"typ": "number"
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
|
||||
function model_bes_staffeltabel()
|
||||
{
|
||||
this.records_name = "orderpacelisttables";
|
||||
this.record_name = "orderpacelisttable";
|
||||
this.table = "bes_staffeltabel";
|
||||
this.primary = "bes_staffeltabel_key";
|
||||
this.records_name = "bes_staffeltabels";
|
||||
this.record_name = "bes_staffeltabel";
|
||||
this.autfunction = "WEB_BESMGT";
|
||||
this.record_title = L("bes_staffeltabel");
|
||||
this.records_title = L("bes_staffeltabel_m");
|
||||
@@ -28,20 +28,20 @@ function model_bes_staffeltabel()
|
||||
this.fields = {
|
||||
"id": {
|
||||
"dbs": "bes_staffeltabel_key",
|
||||
"label": L("lcl_key"),
|
||||
"label": "Key",
|
||||
"typ": "key",
|
||||
"required": true,
|
||||
"filter": "exact",
|
||||
"seq": "bes_s_bes_staffeltabel_key",
|
||||
"defaultvalue": null
|
||||
},
|
||||
"name": {
|
||||
"bes_staffeltabel_naam": {
|
||||
"dbs": "bes_staffeltabel_naam",
|
||||
"label": L("bes_staffeltabel_naam"),
|
||||
"typ": "varchar",
|
||||
"required": true
|
||||
},
|
||||
"pacelisttype": {
|
||||
"fac_typestaffel_key": {
|
||||
"dbs": "fac_typestaffel_key",
|
||||
"label": L("bes_staffeltabel_type"),
|
||||
"typ": "key",
|
||||
@@ -54,16 +54,16 @@ function model_bes_staffeltabel()
|
||||
"emptyoption": null,
|
||||
"filter": "exact"
|
||||
},
|
||||
"group": {
|
||||
"bes_staffeltabel_groep": {
|
||||
"dbs": "bes_staffeltabel_groep",
|
||||
"label": L("bes_staffeltabel_groep"),
|
||||
"typ": "check0"
|
||||
}
|
||||
};
|
||||
this.includes = {
|
||||
"orderpacelists": {
|
||||
"bes_staffels": {
|
||||
"model": new model_bes_staffel(),
|
||||
"joinfield": "orderpacelisttable",
|
||||
"joinfield": "bes_staffeltabel_key",
|
||||
"enable_update": true
|
||||
}
|
||||
};
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
|
||||
function model_bez_actie()
|
||||
{
|
||||
this.records_name = "visitoractions";
|
||||
this.record_name = "visitoraction";
|
||||
this.table = "bez_actie";
|
||||
this.primary = "bez_actie_key";
|
||||
this.records_name = "bez_acties";
|
||||
this.record_name = "bez_actie";
|
||||
this.soft_delete = "bez_actie_verwijder";
|
||||
this.autfunction = "WEB_BEZMGT";
|
||||
this.record_title = L("bez_actie");
|
||||
@@ -28,7 +28,7 @@ function model_bez_actie()
|
||||
this.fields = {
|
||||
"id": {
|
||||
"dbs": "bez_actie_key",
|
||||
"label": L("lcl_key"),
|
||||
"label": "Key",
|
||||
"typ": "key",
|
||||
"required": true,
|
||||
"filter": "exact",
|
||||
|
||||
@@ -13,23 +13,22 @@
|
||||
%>
|
||||
<%
|
||||
|
||||
function model_bez_kenmerk(params)
|
||||
function model_bez_kenmerk()
|
||||
{
|
||||
params = params || {};
|
||||
this.records_name = "visitorproperties";
|
||||
this.record_name = "visitorproperty";
|
||||
this.table = "bez_kenmerk";
|
||||
this.primary = "bez_kenmerk_key";
|
||||
this.records_name = "bez_kenmerks";
|
||||
this.record_name = "bez_kenmerk";
|
||||
this.soft_delete = "bez_kenmerk_verwijder";
|
||||
this.autfunction = params.internal?false:"WEB_PRSSYS";
|
||||
this.record_title = L("bez_kenmerk");
|
||||
this.records_title = L("bez_kenmerk_m");
|
||||
this.module = "BEZ";
|
||||
this.autfunction = "WEB_PRSSYS";
|
||||
this.record_title = L("mgt_kenmerk");
|
||||
this.records_title = L("mgt_kenmerk_m");
|
||||
|
||||
|
||||
this.fields = {
|
||||
"id": {
|
||||
"dbs": "bez_kenmerk_key",
|
||||
"label": L("lcl_key"),
|
||||
"label": "Key",
|
||||
"typ": "key",
|
||||
"required": true,
|
||||
"filter": "exact",
|
||||
@@ -60,7 +59,7 @@ function model_bez_kenmerk(params)
|
||||
"typ": "varchar",
|
||||
"translate": true
|
||||
},
|
||||
"attributetype": {
|
||||
"property_type": {
|
||||
"dbs": "bez_kenmerk_kenmerktype",
|
||||
"label": L("mgt_srtkenmerk_kenmerktype"),
|
||||
"typ": "varchar",
|
||||
@@ -75,7 +74,7 @@ function model_bez_kenmerk(params)
|
||||
"LOV": buildVerplichtingList(),
|
||||
"emptyoption": null
|
||||
},
|
||||
"group": {
|
||||
"property_group": {
|
||||
"dbs": "bez_kenmerk_groep",
|
||||
"label": L("mgt_kenmerk_groep"),
|
||||
"typ": "key",
|
||||
@@ -90,11 +89,8 @@ function model_bez_kenmerk(params)
|
||||
},
|
||||
"system": {
|
||||
"dbs": "bez_kenmerk_systeem",
|
||||
"label": L("mgt_srtkenmerk_systeem_adv"),
|
||||
"typ": "number",
|
||||
"LOV": L("mgt_kenmerk_systeemLOV"),
|
||||
"defaultvalue": 0,
|
||||
"required": true
|
||||
"label": L("mgt_srtkenmerk_systeem"),
|
||||
"typ": "check"
|
||||
},
|
||||
"length": {
|
||||
"dbs": "bez_kenmerk_lengte",
|
||||
@@ -124,7 +120,7 @@ function model_bez_kenmerk(params)
|
||||
"filter": "exact",
|
||||
"LOVinit": ""
|
||||
},
|
||||
"propertydefault": {
|
||||
"default": {
|
||||
"dbs": "bez_kenmerk_default",
|
||||
"label": L("mgt_kenmerk_default"),
|
||||
"typ": "memo",
|
||||
@@ -138,22 +134,9 @@ function model_bez_kenmerk(params)
|
||||
};
|
||||
|
||||
|
||||
this.hook_pre_edit = function (obj, fld)
|
||||
{
|
||||
var kenmerktype = (obj.property_type ? obj.attributetype.id : "");
|
||||
fld.attributetype.LOV = buildKenmerktypeLOV(kenmerktype);
|
||||
%>
|
||||
<script type="text/javascript">
|
||||
var module = "BEZ";
|
||||
var property_type = "<%=safe.jsstring(kenmerktype)%>";
|
||||
</script>
|
||||
<%
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
this.REST_DELETE = generic_REST_DELETE(this, {});
|
||||
}
|
||||
%>
|
||||
@@ -1,317 +0,0 @@
|
||||
<% /*
|
||||
$Revision$
|
||||
$Id$
|
||||
|
||||
File: model_bgt_budget.inc
|
||||
|
||||
Description: Model voor bgt_budget
|
||||
|
||||
Context:
|
||||
|
||||
Notes:
|
||||
*/
|
||||
%>
|
||||
<!-- #include file="../bgt/bgt_tools.inc" -->
|
||||
<!-- #include file="../api2/model_bgt_budgetmutatie.inc" -->
|
||||
<%
|
||||
var v_checkauth = getQParamInt("id", 0) > 0;
|
||||
|
||||
function model_bgt_budget()
|
||||
{
|
||||
this.records_name = "budgets";
|
||||
this.record_name = "budget";
|
||||
this.table = "bgt_budget";
|
||||
this.primary = "bgt_budget_key";
|
||||
this.autfunction = "WEB_BGTUSE";
|
||||
this.record_title = L("bgt_budget");
|
||||
this.records_title = L("bgt_budget_m");
|
||||
|
||||
this.fields = {
|
||||
"id": {
|
||||
"dbs": "bgt_budget_key",
|
||||
"label": L("lcl_key"),
|
||||
"typ": "key",
|
||||
"hidden_fld": true,
|
||||
"required": true,
|
||||
"filter": "exact",
|
||||
"seq": "bgt_s_bgt_budget_key"
|
||||
},
|
||||
"budgetdiscipline": {
|
||||
"dbs": "ins_discipline_key",
|
||||
"label": L("bgt_discipline_omschrijving"),
|
||||
"typ": "key",
|
||||
"required": true,
|
||||
"insertonly": true,
|
||||
"foreign": bgt_budgetdiscipline_foreign(v_checkauth),
|
||||
"showtransit": true
|
||||
},
|
||||
"budgetproject": {
|
||||
"dbs": "bgt_project_key",
|
||||
"label": L("bgt_project_omschrijving"),
|
||||
"typ": "key",
|
||||
"required": true,
|
||||
"insertonly": true,
|
||||
"foreign": bgt_budgetproject_foreign(),
|
||||
"showtransit": true
|
||||
},
|
||||
"budgetcostcategory": {
|
||||
"dbs": "bgt_kostenrubriek_key",
|
||||
"label": L("bgt_kostenrubriek_oms"),
|
||||
"typ": "key",
|
||||
"required": true,
|
||||
"insertonly": true,
|
||||
"foreign": bgt_budgetcostcategory_foreign(),
|
||||
"showtransit": true
|
||||
},
|
||||
"costtypegroup": {
|
||||
"dbs": "prs_kostensoortgrp_key",
|
||||
"label": L("prs_kostensoortgrp_key"),
|
||||
"typ": "key",
|
||||
"required": false,
|
||||
"insertonly": true,
|
||||
"foreign": bgt_costtypegroup_foreign(),
|
||||
"showtransit": true,
|
||||
"LOVinit": "",
|
||||
"filter": "exact"
|
||||
},
|
||||
"costtype": {
|
||||
"dbs": "prs_kostensoort_key",
|
||||
"label": L("prs_kostensoort_key"),
|
||||
"typ": "key",
|
||||
"required": false,
|
||||
"insertonly": true,
|
||||
"foreign": bgt_costtype_foreign(),
|
||||
"showtransit": true
|
||||
},
|
||||
"amountoriginal": {
|
||||
"dbs": "bgt_budget_bedrag_origineel",
|
||||
"sql": "(BGT.getBudgetOpDatum(bgt_budget.bgt_budget_key, 0, NULL))",
|
||||
"label": L("bgt_budget_origineel"),
|
||||
"typ": "float",
|
||||
"iscurrency": true,
|
||||
"total": true
|
||||
},
|
||||
"vatoriginal": {
|
||||
"dbs": "bgt_budget_btwbedrag_origineel",
|
||||
"sql": "(BGT.getBudgetOpDatum(bgt_budget.bgt_budget_key, 1, NULL))",
|
||||
"label": L("bgt_budget_origineel")+" "+L("lcl_fin_btwtabelwaarde_oms"),
|
||||
"typ": "float",
|
||||
"iscurrency": true,
|
||||
"total": true
|
||||
},
|
||||
"amountmutation": {
|
||||
"dbs": "bgt_budget_bedrag_mutatie",
|
||||
"sql": "(BGT.getBudgetSoortMutatie(NULL, NULL, bgt_budget.prs_kostensoort_key, 0, 'EM', NULL))",
|
||||
"label": L("bgt_budget_mutaties"),
|
||||
"typ": "float",
|
||||
"iscurrency": true,
|
||||
"total": true
|
||||
},
|
||||
"amountreservation": {
|
||||
"dbs": "bgt_budget_bedrag_reserve",
|
||||
"sql": "(BGT.getBudgetSoortMutatie(NULL, NULL, bgt_budget.prs_kostensoort_key, 0, 'AR', NULL))",
|
||||
"label": L("bgt_budget_vnreserve"),
|
||||
"typ": "float",
|
||||
"iscurrency": true,
|
||||
"total": true
|
||||
},
|
||||
"amount": {
|
||||
"dbs": "bgt_budget_bedrag",
|
||||
"label": L("bgt_budget_bedrag"),
|
||||
"typ": "float",
|
||||
"iscurrency": true,
|
||||
"total": true,
|
||||
"defaultvalue": 0
|
||||
},
|
||||
"vat": {
|
||||
"dbs": "bgt_budget_btwbedrag",
|
||||
"label": L("bgt_budget_btwbedrag"),
|
||||
"typ": "float",
|
||||
"iscurrency": true,
|
||||
"total": true,
|
||||
"defaultvalue": 0
|
||||
},
|
||||
"amountincl": {
|
||||
"dbs": "bgt_budget_bedrag_incl",
|
||||
"sql": "bgt_budget_bedrag + bgt_budget_btwbedrag",
|
||||
"label": L("lcl_fin_total_sum"),
|
||||
"typ": "float",
|
||||
"readonly": true,
|
||||
"sqlshow": true,
|
||||
"iscurrency": true,
|
||||
"total": true,
|
||||
"defaultvalue": "0",
|
||||
"clone": false
|
||||
},
|
||||
"contingency": {
|
||||
"dbs": "bgt_budget_isreserve",
|
||||
"label": L("bgt_budget_isreserve"),
|
||||
"typ": "check0",
|
||||
"defaultvalue": 0
|
||||
},
|
||||
"account": {
|
||||
"dbs": "prs_kostenplaats_key",
|
||||
"label": L("bgt_budget_account"),
|
||||
"typ": "key",
|
||||
"foreign": bgt_account_foreign()
|
||||
},
|
||||
"begin": {
|
||||
"dbs": "bgt_budget_begin",
|
||||
"label": L("bgt_budget_begin"),
|
||||
"typ": "date",
|
||||
"required": false
|
||||
},
|
||||
"end": {
|
||||
"dbs": "bgt_budget_eind",
|
||||
"label": L("bgt_budget_eind"),
|
||||
"typ": "date",
|
||||
"required": false
|
||||
},
|
||||
"costgroup": {
|
||||
"dbs": "prs_kostenplaatsgrp_key",
|
||||
"label": L("bgt_budget_accountgrp"),
|
||||
"typ": "key",
|
||||
"foreign": {
|
||||
"tbl": "prs_kostenplaatsgrp",
|
||||
"key": "prs_kostenplaatsgrp_key",
|
||||
"desc": "prs_kostenplaatsgrp_oms"
|
||||
},
|
||||
"hidden_fld": true
|
||||
}
|
||||
};
|
||||
|
||||
this.edit = {
|
||||
// "modal": true
|
||||
};
|
||||
|
||||
this.list = {
|
||||
"columns": [
|
||||
"budgetcostcategory",
|
||||
"costtypegroup",
|
||||
"costtype",
|
||||
"amount",
|
||||
"vat"
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
this.hook_pre_edit = function (obj, fld)
|
||||
{
|
||||
var btw_data = {};
|
||||
if (obj.id > -1)
|
||||
{
|
||||
fld.amount.readonly = true;
|
||||
fld.vat.readonly = true;
|
||||
|
||||
var sql = "SELECT s.prs_kostensoort_btw"
|
||||
+ " , f.fin_btwtabelwaarde_perc"
|
||||
+ " FROM bgt_budget b"
|
||||
+ " , prs_kostensoort s"
|
||||
+ " , fin_btwtabelwaarde f"
|
||||
+ " WHERE s.fin_btwtabelwaarde_key = f.fin_btwtabelwaarde_key"
|
||||
+ " AND b.prs_kostensoort_key = s.prs_kostensoort_key"
|
||||
+ " AND b.bgt_budget_key = " + obj.id;
|
||||
var oRs = Oracle.Execute(sql);
|
||||
if (!oRs.eof)
|
||||
{
|
||||
btw_data.btw_inc = oRs("prs_kostensoort_btw").Value;
|
||||
btw_data.btw_val = oRs("fin_btwtabelwaarde_perc").Value;
|
||||
}
|
||||
oRs.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Een nieuw budget heeft nog geen origineel- en mutatie-bedrag.
|
||||
delete fld.amountoriginal;
|
||||
delete fld.amountmutation;
|
||||
}
|
||||
%>
|
||||
<script type="text/javascript">
|
||||
var cur_mode = "budget_edit"; // Laat alleen de kostensoorten zien waaraan nog geen budget gekoppeld is.
|
||||
var btw_data = <%=JSON.stringify(btw_data)%>;
|
||||
<% if (obj.budgetdiscipline) { %> var budgetdiscipline = "<%=obj.budgetdiscipline.id%>"; <% } %>
|
||||
<% if (obj.budgetproject) { %> var budgetproject = "<%=obj.budgetproject.id%>"; <% } %>
|
||||
</script>
|
||||
<%
|
||||
}
|
||||
|
||||
this.hook_pre_post = function(params, obj)
|
||||
{
|
||||
// Wordt alleen gebruikt bij toevoegen.
|
||||
}
|
||||
|
||||
|
||||
this.hook_pre_put = function(params, obj, key)
|
||||
{ // Zoek bij wijzigen van kostenplaats de kostenplaatsgrp_key op
|
||||
}
|
||||
|
||||
this.hook_pre_delete = function(params, key)
|
||||
{
|
||||
var key_arr = getFParamIntArray("id");
|
||||
|
||||
var sql_c = "SELECT COUNT(*) aantal"
|
||||
+ " FROM mld_opdr"
|
||||
+ " WHERE prs_kostensoort_key IN"
|
||||
+ " (SELECT prs_kostensoort_key"
|
||||
+ " FROM bgt_budget"
|
||||
+ " WHERE bgt_budget_key IN (" + key_arr.join(",") + ")"
|
||||
+ " )";
|
||||
var oRs_c = Oracle.Execute(sql_c);
|
||||
var nr_mld_opdr = oRs_c("aantal").Value;
|
||||
oRs_c.Close();
|
||||
if (nr_mld_opdr > 0)
|
||||
{
|
||||
// abort_with_warning(L("bgt_budget_delete_val1").format(L("lcl_fin_contracten"))); // De geselecteerde budgetten hebben contracten. Verwijder deze eerst.
|
||||
abort_with_warning("De geselecteerde budgetten hebben contracten. Verwijder deze eerst.");
|
||||
}
|
||||
|
||||
var sql_m = "SELECT COUNT(*) aantal"
|
||||
+ " FROM bgt_budgetmutatie"
|
||||
+ " WHERE bgt_budget_key_naar IN (" + key_arr.join(",") + ")"
|
||||
+ " OR bgt_budget_key_van IN (" + key_arr.join(",") + ")";
|
||||
var oRs_m = Oracle.Execute(sql_m);
|
||||
var nr_mutatie = oRs_m("aantal").Value;
|
||||
oRs_m.Close();
|
||||
if (nr_mutatie > 0)
|
||||
{
|
||||
// abort_with_warning(L("bgt_budget_delete_val1").format(L("bgt_budget_mutaties"))); // De geselecteerde budgetten hebben mutaties. Verwijder deze eerst.
|
||||
abort_with_warning("De geselecteerde budgetten hebben mutaties. Verwijder deze eerst.");
|
||||
}
|
||||
// Er zijn geen contracten of budgetmutaties bij de geselecteerde budget(ten) bekend.
|
||||
// Verwijderen is geen probleem meer.
|
||||
}
|
||||
|
||||
var v_budgetdiscipline = getQParamInt("budgetdiscipline", -1);
|
||||
if (v_budgetdiscipline == -1)
|
||||
{
|
||||
gparams = {
|
||||
GET: {wheres: [
|
||||
"bgt_budget.ins_discipline_key IN"
|
||||
+ " (SELECT w.ins_discipline_key"
|
||||
+ " FROM fac_v_webgebruiker w"
|
||||
+ " , ins_tab_discipline d"
|
||||
+ " WHERE w.ins_discipline_key = d.ins_discipline_key"
|
||||
+ " AND w.prs_perslid_key = " + user_key
|
||||
+ " AND (w.fac_gebruiker_prs_level_read<9 OR w.fac_gebruiker_alg_level_read<9)"
|
||||
+ " AND d.ins_discipline_module = 'BGT'"
|
||||
+ " AND d.ins_discipline_verwijder IS NULL"
|
||||
+ " )"
|
||||
]
|
||||
}
|
||||
}
|
||||
this.REST_GET = generic_REST_GET(this, gparams);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.REST_GET = generic_REST_GET(this);
|
||||
}
|
||||
this.REST_PUT = generic_REST_PUT(this);
|
||||
var autparams = user.checkAutorisation(this.autfunction);
|
||||
var canWrite = (autparams.PRSwritelevel < 9 && autparams.ALGwritelevel < 9);
|
||||
if (canWrite)
|
||||
{
|
||||
this.REST_POST = generic_REST_POST(this);
|
||||
this.REST_DELETE = generic_REST_DELETE(this);
|
||||
}
|
||||
}
|
||||
%>
|
||||
@@ -1,550 +0,0 @@
|
||||
<% /*
|
||||
$Revision$
|
||||
$Id$
|
||||
|
||||
File: model_bgt_budgetmutatie.inc
|
||||
|
||||
Description: Model voor bgt_budgetmutatie
|
||||
|
||||
Context:
|
||||
|
||||
Notes:
|
||||
*/
|
||||
%>
|
||||
<!-- #include file="../bgt/bgt_tools.inc" -->
|
||||
<%
|
||||
|
||||
function model_bgt_budgetmutatie()
|
||||
{
|
||||
this.records_name = "budgetmutations";
|
||||
this.record_name = "budgetmutation";
|
||||
this.table = "bgt_budgetmutatie";
|
||||
this.primary = "bgt_budgetmutatie_key";
|
||||
this.autfunction = "WEB_BGTUSE";
|
||||
this.record_title = L("bgt_budgetmutatie");
|
||||
this.records_title = L("bgt_budgetmutatie_m");
|
||||
|
||||
|
||||
var p_budget_key = getQParamInt("budgetcommon", -1);
|
||||
var p_mutatie_key = getQParamInt("id", -1);
|
||||
var budgetnaam_sql = "SELECT b.bgt_budget_key"
|
||||
+ " , CASE WHEN b.prs_kostensoort_key IS NOT NULL"
|
||||
+ " THEN s.prs_kostensoort_oms"
|
||||
+ " ELSE CASE WHEN b.prs_kostensoortgrp_key IS NOT NULL"
|
||||
+ " THEN g.prs_kostensoortgrp_oms"
|
||||
+ " ELSE CASE WHEN b.bgt_kostenrubriek_key IS NOT NULL"
|
||||
+ " THEN r.bgt_kostenrubriek_oms"
|
||||
+ " ELSE " + safe.quoted_sql(L("bgt_budgetmutatie_reserve"))
|
||||
+ " END"
|
||||
+ " END"
|
||||
+ " END bgt_budget_naam"
|
||||
+ " , f.fin_btwtabelwaarde_perc"
|
||||
+ " FROM bgt_budget b"
|
||||
+ " , bgt_kostenrubriek r"
|
||||
+ " , prs_kostensoortgrp g"
|
||||
+ " , prs_kostensoort s"
|
||||
+ " , fin_btwtabelwaarde f"
|
||||
+ " WHERE b.bgt_kostenrubriek_key = r.bgt_kostenrubriek_key(+)"
|
||||
+ " AND b.prs_kostensoortgrp_key = g.prs_kostensoortgrp_key(+)"
|
||||
+ " AND b.prs_kostensoort_key = s.prs_kostensoort_key(+)"
|
||||
+ " AND s.fin_btwtabelwaarde_key = f.fin_btwtabelwaarde_key(+)"
|
||||
+ ( p_budget_key > -1
|
||||
? " AND b.bgt_project_key = "
|
||||
+ "(SELECT p.bgt_project_key"
|
||||
+ " FROM bgt_budget p"
|
||||
+ " WHERE bgt_budget_key = " + p_budget_key
|
||||
+ ")"
|
||||
: ""
|
||||
);
|
||||
|
||||
this.fields = {
|
||||
"id": {
|
||||
"dbs": "bgt_budgetmutatie_key",
|
||||
"label": L("lcl_key"),
|
||||
"typ": "key",
|
||||
"hidden_fld": true,
|
||||
"required": true,
|
||||
"filter": "exact",
|
||||
"seq": "bgt_s_bgt_budgetmutatie_key"
|
||||
},
|
||||
"mutationdate": {
|
||||
"dbs": "bgt_budgetmutatie_datum",
|
||||
"label": L("bgt_budgetmutatie_datum"),
|
||||
"typ": "date",
|
||||
"required": true,
|
||||
"defaultvalue": new Date()
|
||||
},
|
||||
"name": {
|
||||
"dbs": "bgt_budgetmutatie_omschrijving",
|
||||
"label": L("bgt_budgetmutatie_oms"),
|
||||
"typ": "varchar",
|
||||
"required": true
|
||||
},
|
||||
"code": {
|
||||
"dbs": "bgt_budgetmutatie_code",
|
||||
"label": L("bgt_budgetmutatie_code"),
|
||||
"typ": "varchar",
|
||||
"LOV": budgetmutatie_code_LOV(),
|
||||
"emptyoption": null
|
||||
},
|
||||
"sequence": {
|
||||
"dbs": "bgt_budgetmutatie_volgnr",
|
||||
"label": L("bgt_budgetmutatie_volgnr"),
|
||||
"typ": "number"
|
||||
},
|
||||
"ident": {
|
||||
"dbs": "bgt_budgetmutatie_identity",
|
||||
"sql": "COALESCE(bgt_budgetmutatie_code || TO_CHAR(bgt_budgetmutatie_volgnr), TO_CHAR(bgt_budgetmutatie_key))",
|
||||
"label": "Volgnr",
|
||||
"typ": "varchar"
|
||||
},
|
||||
"adjustedby": {
|
||||
"dbs": "prs_perslid_key",
|
||||
"label": L("bgt_budgetmutatie_door"),
|
||||
"typ": "key",
|
||||
"foreign": "PRS_PERSLID",
|
||||
"required": true,
|
||||
"defaultvalue": user_key
|
||||
},
|
||||
"budgetfrom": {
|
||||
"dbs": "bgt_budget_key_van",
|
||||
"label": L("bgt_budgetmutatie_van"),
|
||||
"typ": "key",
|
||||
"foreign": {
|
||||
"tbl": "(" + budgetnaam_sql + ")",
|
||||
"key": "bgt_budget_key",
|
||||
"desc": "bgt_budget_naam"
|
||||
}
|
||||
},
|
||||
"budgetto": {
|
||||
"dbs": "bgt_budget_key_naar",
|
||||
"label": L("bgt_budgetmutatie_naar"),
|
||||
"typ": "key",
|
||||
"foreign": {
|
||||
"tbl": "(" + budgetnaam_sql + ")",
|
||||
"key": "bgt_budget_key",
|
||||
"desc": "bgt_budget_naam"
|
||||
}
|
||||
},
|
||||
"amountfrom": {
|
||||
"dbs": "bgt_budget_bedrag_van",
|
||||
"label": L("bgt_budgetmutatie_bedrag"),
|
||||
"typ": "float",
|
||||
"iscurrency": true,
|
||||
"hidden": true,
|
||||
"hidden_fld": true
|
||||
},
|
||||
"vatfrom": {
|
||||
"dbs": "bgt_budget_btwbedrag_van",
|
||||
"label": L("bgt_budgetmutatie_btwbedrag"),
|
||||
"typ": "float",
|
||||
"iscurrency": true,
|
||||
"hidden": true,
|
||||
"hidden_fld": true
|
||||
},
|
||||
"amountto": {
|
||||
"dbs": "bgt_budget_bedrag_naar",
|
||||
"label": L("bgt_budgetmutatie_bedrag"),
|
||||
"typ": "float",
|
||||
"iscurrency": true
|
||||
},
|
||||
"vatto": {
|
||||
"dbs": "bgt_budget_btwbedrag_naar",
|
||||
"label": L("bgt_budgetmutatie_btwbedrag"),
|
||||
"typ": "float",
|
||||
"iscurrency": true
|
||||
},
|
||||
"amounttoincl": {
|
||||
"dbs": "bgt_budget_bedrag_naar_incl",
|
||||
"sql": "COALESCE(bgt_budget_bedrag_naar, 0) + COALESCE(bgt_budget_btwbedrag_naar, 0)",
|
||||
"label": L("lcl_fin_total_sum"),
|
||||
"typ": "float",
|
||||
"readonly": true,
|
||||
"sqlshow": true,
|
||||
"iscurrency": true,
|
||||
"defaultvalue": "0"
|
||||
},
|
||||
"amountexc": {
|
||||
"dbs": "bgt_budget_bedrag_naar_exc",
|
||||
"sql": "CASE WHEN bgt_budget_key_naar IS NULL THEN bgt_budget_bedrag_van ELSE bgt_budget_bedrag_naar END",
|
||||
"label": L("bgt_budgetmutatie_bedrag"),
|
||||
"typ": "float",
|
||||
"iscurrency": true,
|
||||
"total": true
|
||||
},
|
||||
"amountvat": {
|
||||
"dbs": "bgt_budget_bedrag_naar_btw",
|
||||
"sql": "CASE WHEN bgt_budget_key_naar IS NULL THEN bgt_budget_btwbedrag_van ELSE bgt_budget_btwbedrag_naar END",
|
||||
"label": L("bgt_budgetmutatie_btwbedrag"),
|
||||
"typ": "float",
|
||||
"iscurrency": true,
|
||||
"total": true
|
||||
},
|
||||
"mutbudgetexc": {
|
||||
"dbs": "bgt_budget_mutatie_exc",
|
||||
"sql": "BGT.getMutatieOpBudget("+p_budget_key+", bgt_budgetmutatie_key, 0)",
|
||||
"label": L("bgt_budgetmutatie_bedrag"),
|
||||
"typ": "float",
|
||||
"readonly": true,
|
||||
"iscurrency": true,
|
||||
"total": true
|
||||
},
|
||||
"mutbudgetvat": {
|
||||
"dbs": "bgt_budget_mutatie_btw",
|
||||
"sql": "BGT.getMutatieOpBudget("+p_budget_key+", bgt_budgetmutatie_key, 1)",
|
||||
"label": L("bgt_budgetmutatie_btwbedrag"),
|
||||
"typ": "float",
|
||||
"readonly": true,
|
||||
"iscurrency": true,
|
||||
"total": true
|
||||
},
|
||||
"amountdifference": {
|
||||
"dbs": "bgt_budget_bedrag_verschil",
|
||||
"sql": "BGT.getSoortMutatie(bgt_budgetmutatie_key)",
|
||||
"label": L("bgt_budgetmutatie"),
|
||||
"typ": "float",
|
||||
"readonly": true,
|
||||
"iscurrency": true
|
||||
},
|
||||
"budgetdiscipline": {
|
||||
"dbs": "bgt_budget.ins_discipline_key",
|
||||
"label": L("bgt_discipline_omschrijving"),
|
||||
"typ": "key",
|
||||
"foreign": bgt_budgetdiscipline_foreign(),
|
||||
"hidden_fld": true
|
||||
},
|
||||
"budgetproject": {
|
||||
"dbs": "bgt_budget.bgt_project_key",
|
||||
"label": L("bgt_project_omschrijving"),
|
||||
"typ": "key",
|
||||
"foreign": bgt_budgetproject_foreign(),
|
||||
"hidden_fld": true
|
||||
},
|
||||
"budgetcostcategory": {
|
||||
"dbs": "bgt_budget.bgt_kostenrubriek_key",
|
||||
"label": L("bgt_kostenrubriek_oms"),
|
||||
"typ": "key",
|
||||
"foreign": bgt_budgetcostcategory_foreign(),
|
||||
"hidden_fld": true
|
||||
}
|
||||
};
|
||||
|
||||
this.edit = {
|
||||
"modal": true
|
||||
};
|
||||
|
||||
this.list = {
|
||||
"columns": [
|
||||
"mutationdate",
|
||||
"ident",
|
||||
"name",
|
||||
"budgetfrom",
|
||||
"budgetto",
|
||||
"amountto",
|
||||
"vatto",
|
||||
"amountexc",
|
||||
"amountvat",
|
||||
"amountdifference"
|
||||
]
|
||||
};
|
||||
|
||||
function budgetmutatie_code_LOV()
|
||||
{
|
||||
var mutatie_code = ";;"
|
||||
+ "A;A - automatische overboeking;"
|
||||
+ "E;E - extra;"
|
||||
+ "M;M - mutatie;"
|
||||
+ "R;R - reserve";
|
||||
return mutatie_code;
|
||||
}
|
||||
|
||||
this.hook_pre_edit = function (obj, fld)
|
||||
{
|
||||
var btw_data = {};
|
||||
fld.amountto.label = L("bgt_budgetmutatie_bedrag");
|
||||
if (!obj.id) // nieuwe mutatie: wanneer en door wie wordt op de achtergrond gevuld
|
||||
{
|
||||
fld.adjustedby.hidden_fld = true;
|
||||
}
|
||||
else // bestaande mutatie: alleen de omschrijving en bedrag is aan te passen
|
||||
{
|
||||
fld.adjustedby.readonly = true;
|
||||
fld.budgetfrom.readonly = true;
|
||||
fld.budgetto.readonly = true;
|
||||
|
||||
var sql = "SELECT s.prs_kostensoort_btw"
|
||||
+ " , f.fin_btwtabelwaarde_perc"
|
||||
+ " FROM bgt_budgetmutatie m"
|
||||
+ " , bgt_budget b"
|
||||
+ " , prs_kostensoort s"
|
||||
+ " , fin_btwtabelwaarde f"
|
||||
+ " WHERE s.fin_btwtabelwaarde_key = f.fin_btwtabelwaarde_key"
|
||||
+ " AND b.prs_kostensoort_key = s.prs_kostensoort_key"
|
||||
+ " AND m.bgt_budget_key_naar = b.bgt_budget_key"
|
||||
+ " AND m.bgt_budgetmutatie_key = " + obj.id;
|
||||
var oRs = Oracle.Execute(sql);
|
||||
if (!oRs.eof)
|
||||
{
|
||||
btw_data.btw_inc = oRs("prs_kostensoort_btw").Value;
|
||||
btw_data.btw_val = oRs("fin_btwtabelwaarde_perc").Value;
|
||||
}
|
||||
oRs.Close();
|
||||
}
|
||||
|
||||
%>
|
||||
<script type="text/javascript">
|
||||
// Deze variabelen zijn nodig in bgt_budgetmutatie.js
|
||||
var budget_key = <%=p_budget_key%>;
|
||||
var mutatie_key = <%=p_mutatie_key%>;
|
||||
var btw_data = <%=JSON.stringify(btw_data)%>;
|
||||
</script>
|
||||
<%
|
||||
}
|
||||
|
||||
this.hook_pre_post = function (params, jsondata)
|
||||
{
|
||||
if (jsondata.budgetfrom == jsondata.budgetto)
|
||||
abort_with_warning(L("bgt_budgetmutatie_err1").format(L("bgt_budgetmutatie_van"), L("bgt_budgetmutatie_naar")));
|
||||
|
||||
if ((!jsondata.amountto || jsondata.amountto == 0) && (!jsondata.vatto || jsondata.vatto == 0))
|
||||
abort_with_warning(L("bgt_budgetmutatie_err2").format(L("bgt_budgetmutatie_bedrag"), L("bgt_budgetmutatie_btwbedrag")));
|
||||
jsondata.amountfrom = -1 * jsondata.amountto;
|
||||
jsondata.vatfrom = -1 * jsondata.vatto;
|
||||
}
|
||||
|
||||
this.hook_post_post = function (params, jsondata, key)
|
||||
{
|
||||
// Haal de budget-keys voor correctie uit het mutatierecord.
|
||||
var sql = "SELECT bgt_budget_key_van"
|
||||
+ " , bgt_budget_key_naar"
|
||||
+ " FROM bgt_budgetmutatie"
|
||||
+ " WHERE bgt_budgetmutatie_key = " + key;
|
||||
var oRs = Oracle.Execute(sql);
|
||||
if (!oRs.eof)
|
||||
{
|
||||
mutatie_correctie(oRs("bgt_budget_key_van").Value);
|
||||
mutatie_correctie(oRs("bgt_budget_key_naar").Value);
|
||||
}
|
||||
oRs.Close();
|
||||
}
|
||||
|
||||
this.hook_pre_put = function (params, jsondata, key)
|
||||
{
|
||||
if ((!jsondata.amountto || jsondata.amountto == 0) && (!jsondata.vatto || jsondata.vatto == 0))
|
||||
abort_with_warning(L("bgt_budgetmutatie_err2").format(L("bgt_budgetmutatie_bedrag"), L("bgt_budgetmutatie_btwbedrag")));
|
||||
jsondata.amountfrom = -1 * jsondata.amountto;
|
||||
jsondata.vatfrom = -1 * jsondata.vatto;
|
||||
}
|
||||
|
||||
this.hook_post_put = function(params, jsondata, key)
|
||||
{
|
||||
// Haal de budget-keys voor correctie uit het mutatierecord.
|
||||
var sql = "SELECT bgt_budget_key_van"
|
||||
+ " , bgt_budget_key_naar"
|
||||
+ " FROM bgt_budgetmutatie"
|
||||
+ " WHERE bgt_budgetmutatie_key = " + key;
|
||||
var oRs = Oracle.Execute(sql);
|
||||
if (!oRs.eof)
|
||||
{
|
||||
mutatie_correctie(oRs("bgt_budget_key_van").Value);
|
||||
mutatie_correctie(oRs("bgt_budget_key_naar").Value);
|
||||
}
|
||||
oRs.Close();
|
||||
}
|
||||
|
||||
function contract_waarde(p_budget_key)
|
||||
{
|
||||
var v_contract = { bedrag_exc: 0
|
||||
, bedrag_btw: 0
|
||||
};
|
||||
var sql = "SELECT SUM(COALESCE(o.mld_opdr_kosten, 0)) contract_exc"
|
||||
+ " , SUM(COALESCE(o.mld_opdr_kosten_btw, 0)) contract_btw"
|
||||
+ " FROM bgt_budget b"
|
||||
+ " , mld_opdr o"
|
||||
+ " WHERE b.prs_kostensoort_key = o.prs_kostensoort_key(+)"
|
||||
+ " AND b.bgt_budget_key = " + p_budget_key;
|
||||
var oRs = Oracle.Execute(sql);
|
||||
if (!oRs.eof)
|
||||
{
|
||||
v_contract.bedrag_exc = oRs("contract_exc").Value;
|
||||
v_contract.bedrag_btw = oRs("contract_btw").Value;
|
||||
}
|
||||
oRs.Close();
|
||||
return v_contract;
|
||||
}
|
||||
|
||||
function budget_waarde(p_budget_key)
|
||||
{
|
||||
var v_budget = { bedrag_exc: 0
|
||||
, bedrag_btw: 0
|
||||
, isreserve: 1
|
||||
, reserve_key: -1
|
||||
};
|
||||
var sql = "SELECT b.bgt_budget_isreserve"
|
||||
+ " , COALESCE(b.bgt_budget_bedrag, 0) bgt_budget_exc"
|
||||
+ " , COALESCE(b.bgt_budget_btwbedrag, 0) bgt_budget_btw"
|
||||
+ " , r.bgt_budget_key"
|
||||
+ " FROM bgt_budget r"
|
||||
+ " , bgt_budget b"
|
||||
+ " WHERE r.bgt_project_key = b.bgt_project_key"
|
||||
+ " AND r.prs_kostensoort_key IS NULL"
|
||||
+ " AND r.prs_kostensoortgrp_key IS NULL"
|
||||
+ " AND b.bgt_budget_key = " + p_budget_key;
|
||||
var oRs = Oracle.Execute(sql);
|
||||
if (!oRs.eof)
|
||||
{
|
||||
v_budget.bedrag_exc = oRs("bgt_budget_exc").Value;
|
||||
v_budget.bedrag_btw = oRs("bgt_budget_btw").Value;
|
||||
v_budget.isreserve = oRs("bgt_budget_isreserve").Value == 1;
|
||||
v_budget.reserve_key = oRs("bgt_budget_key").Value;
|
||||
}
|
||||
oRs.Close();
|
||||
return v_budget;
|
||||
}
|
||||
|
||||
function mutatie_waarde(p_budget_key, p_reserve)
|
||||
{
|
||||
var van_reserve = { bedrag_exc: 0
|
||||
, bedrag_btw: 0
|
||||
};
|
||||
switch (p_reserve)
|
||||
{
|
||||
case "A": sql_res = " AND m.bgt_budgetmutatie_reserve = 1"; break; // alleen automatische overboekingen
|
||||
case "M": sql_res = " AND m.bgt_budgetmutatie_reserve = 0"; break; // alleen mutaties
|
||||
case "T": sql_res = ""; break; // totaal alle mutaties
|
||||
default: "";
|
||||
}
|
||||
var sql = "SELECT SUM(COALESCE(bedrag_exc, 0)) bedrag_exc"
|
||||
+ " , SUM(COALESCE(bedrag_btw, 0)) bedrag_btw"
|
||||
+ " FROM (SELECT SUM(COALESCE(m.bgt_budget_bedrag_van, 0)) bedrag_exc"
|
||||
+ " , SUM(COALESCE(m.bgt_budget_btwbedrag_van, 0)) bedrag_btw"
|
||||
+ " FROM bgt_budgetmutatie m"
|
||||
+ " WHERE bgt_budget_key_van = " + p_budget_key
|
||||
+ sql_res
|
||||
+ " UNION"
|
||||
+ " SELECT SUM(COALESCE(m.bgt_budget_bedrag_naar, 0)) bedrag_exc"
|
||||
+ " , SUM(COALESCE(m.bgt_budget_btwbedrag_naar, 0)) bedrag_btw"
|
||||
+ " FROM bgt_budgetmutatie m"
|
||||
+ " WHERE bgt_budget_key_naar = " + p_budget_key
|
||||
+ sql_res
|
||||
+ ")";
|
||||
var oRs = Oracle.Execute(sql);
|
||||
if (!oRs.eof)
|
||||
{
|
||||
van_reserve.bedrag_exc = oRs("bedrag_exc").Value;
|
||||
van_reserve.bedrag_btw = oRs("bedrag_btw").Value;
|
||||
}
|
||||
oRs.Close();
|
||||
return van_reserve;
|
||||
}
|
||||
|
||||
function mutatie_correctie(p_budget_key)
|
||||
{
|
||||
function een_correctie(p_budget_key, p_budget_bedrag, p_uitreserve_bedrag, p_contract_bedrag)
|
||||
{
|
||||
// Als een deel van het budgetbedrag uit automatische overboeking bestaat kan het budgetbedrag nooit groter zijn dan het contractbedrag.
|
||||
var te_contracteren = p_budget_bedrag - p_contract_bedrag;
|
||||
var naar_reserve = ( (te_contracteren > p_uitreserve_bedrag) ? p_uitreserve_bedrag : te_contracteren);
|
||||
return naar_reserve;
|
||||
}
|
||||
|
||||
var v_budget = budget_waarde(p_budget_key);
|
||||
var v_uitreserve = mutatie_waarde(p_budget_key, "A");
|
||||
var v_contracten = contract_waarde(p_budget_key);
|
||||
|
||||
if (!v_budget.isreserve)
|
||||
{ // Correctie is alleen voor budgetten op kostensoort, niet het reserve.
|
||||
var v_correctie_bedrag_exc = een_correctie(p_budget_key, v_budget.bedrag_exc, v_uitreserve.bedrag_exc, v_contracten.bedrag_exc);
|
||||
var v_correctie_bedrag_btw = een_correctie(p_budget_key, v_budget.bedrag_btw, v_uitreserve.bedrag_btw, v_contracten.bedrag_btw);
|
||||
|
||||
var data_correctie = { budget_res_key: v_budget.reserve_key
|
||||
, budget_srt_key: p_budget_key
|
||||
, bedrag_exc: v_correctie_bedrag_exc
|
||||
, bedrag_btw: v_correctie_bedrag_btw
|
||||
};
|
||||
insertMutatie(data_correctie, "AO");
|
||||
}
|
||||
}
|
||||
|
||||
function insertMutatie(data_mutatie, mutatie_code)
|
||||
{
|
||||
if (data_mutatie.bedrag_exc != 0 || data_mutatie.bedrag_btw != 0)
|
||||
{
|
||||
var sql = "SELECT prs_kostensoort_altcode"
|
||||
+ " FROM prs_kostensoort"
|
||||
+ " WHERE prs_kostensoort_key = "
|
||||
+ " (SELECT MIN(prs_kostensoort_key)"
|
||||
+ " FROM bgt_budget"
|
||||
+ " WHERE bgt_budget_key = " + data_mutatie.budget_srt_key
|
||||
+ " )";
|
||||
var oRs = Oracle.Execute(sql);
|
||||
var v_costtype_code = oRs("prs_kostensoort_altcode").Value;
|
||||
oRs.Close();
|
||||
|
||||
var mutatie_omschr = "";
|
||||
switch (mutatie_code)
|
||||
{
|
||||
case "AO": mutatie_omschr = "AO Automatische overboeking correctie"; break;
|
||||
case "MW": mutatie_omschr = "MW Meer-, minderwerk van " + v_costtype_code; break;
|
||||
}
|
||||
|
||||
var sql_m = "INSERT INTO bgt_budgetmutatie"
|
||||
+ "( bgt_budgetmutatie_datum"
|
||||
+ ", bgt_budgetmutatie_omschrijving"
|
||||
+ ", prs_perslid_key" // not null!
|
||||
+ ", bgt_budget_key_van"
|
||||
+ ", bgt_budget_bedrag_van"
|
||||
+ ", bgt_budget_btwbedrag_van"
|
||||
+ ", bgt_budget_key_naar"
|
||||
+ ", bgt_budget_bedrag_naar"
|
||||
+ ", bgt_budget_btwbedrag_naar"
|
||||
+ ", bgt_budgetmutatie_reserve"
|
||||
+ ") VALUES"
|
||||
+ "( SYSDATE"
|
||||
+ ", " + safe.quoted_sql(mutatie_omschr)
|
||||
+ ", " + user_key
|
||||
+ ", " + data_mutatie.budget_res_key
|
||||
+ ", " + data_mutatie.bedrag_exc
|
||||
+ ", " + data_mutatie.bedrag_btw
|
||||
+ ", " + data_mutatie.budget_srt_key
|
||||
+ ", " + (-1 * data_mutatie.bedrag_exc)
|
||||
+ ", " + (-1 * data_mutatie.bedrag_btw)
|
||||
+ ", 1"
|
||||
+ ")";
|
||||
Oracle.Execute(sql_m);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
var budget_key = getQParamInt("budgetcommon", -1);
|
||||
var mutatie_key = getQParamInt("id", -1);
|
||||
|
||||
var gparams = {
|
||||
GET: {
|
||||
tables: ["bgt_budget"],
|
||||
wheres: ["(bgt_budget.bgt_budget_key = bgt_budgetmutatie.bgt_budget_key_van OR bgt_budget.bgt_budget_key = bgt_budgetmutatie.bgt_budget_key_naar)"]
|
||||
}
|
||||
};
|
||||
|
||||
if (budget_key > -1)
|
||||
{
|
||||
var v_where = ( mutatie_key > -1
|
||||
? "bgt_budgetmutatie_key = {0}".format(mutatie_key)
|
||||
: "(bgt_budget.bgt_budget_key = {0})".format(budget_key)
|
||||
);
|
||||
gparams.GET.wheres.push(v_where);
|
||||
}
|
||||
|
||||
var autparams = user.checkAutorisation(this.autfunction);
|
||||
var canWrite = (autparams.PRSwritelevel < 9 && autparams.ALGwritelevel < 9);
|
||||
this.REST_GET = generic_REST_GET(this, gparams);
|
||||
if (p_budget_key > -1 || canWrite)
|
||||
this.REST_POST = generic_REST_POST(this);
|
||||
if (canWrite)
|
||||
{
|
||||
this.REST_PUT = generic_REST_PUT(this);
|
||||
this.REST_DELETE = generic_REST_DELETE(this);
|
||||
}
|
||||
}
|
||||
%>
|
||||
@@ -1,57 +0,0 @@
|
||||
<% /*
|
||||
$Revision$
|
||||
$Id$
|
||||
|
||||
File: model_bgt_disc_params.inc
|
||||
|
||||
Description: Vanuit CodeCharge gegenereerd model voor bgt_discipline
|
||||
|
||||
Context:
|
||||
|
||||
Notes: *uitsluitend* gebruikt als include van model_bgt_discipline
|
||||
*/
|
||||
%>
|
||||
<%
|
||||
model_bgt_disc_params =
|
||||
{
|
||||
"records_name": "budgetdisciplineparams",
|
||||
"record_name": "budgetdisciplineparam",
|
||||
"table": "bgt_disc_params",
|
||||
"primary": "bgt_disc_params_key",
|
||||
"autfunction": "WEB_BGTMGT",
|
||||
|
||||
|
||||
"fields": {
|
||||
"id": {
|
||||
"dbs": "bgt_disc_params_key",
|
||||
"label": L("lcl_key"),
|
||||
"typ": "key",
|
||||
"seq": "bgt_s_bgt_disc_params_key"
|
||||
},
|
||||
"budgetdiscipline": {
|
||||
"dbs": "bgt_ins_discipline_key",
|
||||
"label": L("bgt_discipline"),
|
||||
"typ": "key",
|
||||
"hidden_fld": true
|
||||
},
|
||||
"code": {
|
||||
"dbs": "bgt_disc_params_code",
|
||||
"label": L("bgt_discipline_code"),
|
||||
"typ": "varchar"
|
||||
},
|
||||
"customer": {
|
||||
"dbs": "bgt_disc_params_opdrachtgever",
|
||||
"label": L("bgt_discipline_opdrachtgever"),
|
||||
"typ": "varchar"
|
||||
},
|
||||
"startdate": {
|
||||
"dbs": "bgt_disc_params_startdatum",
|
||||
"label": L("bgt_discipline_startdatum"),
|
||||
"typ": "date",
|
||||
"autosize": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
api2.generic_REST(model_bgt_disc_params);
|
||||
%>
|
||||
@@ -1,95 +0,0 @@
|
||||
<% /*
|
||||
$Revision$
|
||||
$Id$
|
||||
|
||||
File: model_bgt_discipline.inc
|
||||
|
||||
Description: Model voor budget disciplines
|
||||
|
||||
Context:
|
||||
|
||||
Notes: intern hebben we een apart model voor bgt_disc_params
|
||||
Naar de buitenwereld presenteren we het als <20><>n model
|
||||
*/
|
||||
%>
|
||||
<!-- #include file="model_bgt_disc_params.inc" -->
|
||||
<%
|
||||
|
||||
function model_bgt_discipline(disc_key, params)
|
||||
{
|
||||
// E<>n model voor de buitenwereld
|
||||
var disc = new _model_bgt_discipline();
|
||||
api2.merge_disc_params_model(this, disc);
|
||||
|
||||
this.REST_GET = generic_REST_GET(disc, // Let op: de originele _model
|
||||
{ "GET": {
|
||||
wheres: [ "ins_tab_discipline.ins_discipline_module = 'BGT'"
|
||||
]
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
this.REST_POST = generic_REST_POST(disc);
|
||||
this.REST_PUT = generic_REST_PUT(disc);
|
||||
this.REST_DELETE = generic_REST_DELETE(this, {});
|
||||
}
|
||||
|
||||
function _model_bgt_discipline()
|
||||
{
|
||||
this.records_name = "budgetdisciplines";
|
||||
this.record_name = "budgetdiscipline";
|
||||
this.table = "ins_tab_discipline";
|
||||
this.audit = { "childtable": "bgt_disc_params" }, // Parameters voor fac_audit.
|
||||
this.primary = "ins_discipline_key";
|
||||
this.soft_delete = "ins_discipline_verwijder"; // ik wil er eigenlijk liever niet standaard op kunnen filteren
|
||||
this.autfunction = "WEB_BGTMGT";
|
||||
this.record_title = L("bgt_discipline");
|
||||
this.records_title = L("bgt_discipline_m");
|
||||
|
||||
this.fields = {
|
||||
"id": {
|
||||
"dbs": "ins_discipline_key",
|
||||
"label": L("lcl_key"),
|
||||
"typ": "key",
|
||||
"hidden_fld": true,
|
||||
"required": true,
|
||||
"filter": "exact",
|
||||
"seq": "ins_s_ins_discipline_key"
|
||||
},
|
||||
"module": {
|
||||
"dbs": "ins_discipline_module",
|
||||
"label": L("bgt_discipline_module"),
|
||||
"typ": "varchar",
|
||||
"hidden_fld": true,
|
||||
"defaultvalue": "BGT"
|
||||
},
|
||||
"name": {
|
||||
"dbs": "ins_discipline_omschrijving",
|
||||
"label": L("bgt_discipline_omschrijving"),
|
||||
"typ": "varchar",
|
||||
"translate": true,
|
||||
"required": true
|
||||
},
|
||||
"sequence": {
|
||||
"dbs": "ins_discipline_volgnr",
|
||||
"label": L("bgt_discipline_volgnr"),
|
||||
"typ": "number"
|
||||
},
|
||||
"vat": {
|
||||
"dbs": "ins_discipline_btw",
|
||||
"label": L("bgt_discipline_btw"),
|
||||
"typ": "check",
|
||||
"default": "false",
|
||||
"hidden_fld": true
|
||||
}
|
||||
};
|
||||
|
||||
// this.print = { xmlnode: "budget", where: "discipline"};
|
||||
|
||||
/* Velden van BGT_DISC_PARAMS komen er dynamisch bij */
|
||||
this.disc_params = {
|
||||
model: model_bgt_disc_params,
|
||||
joinfield: "budgetdiscipline"
|
||||
};
|
||||
}
|
||||
%>
|
||||
@@ -1,72 +0,0 @@
|
||||
<% /*
|
||||
$Revision$
|
||||
$Id$
|
||||
|
||||
File: model_bgt_kostenrubriek.inc
|
||||
|
||||
Description: Model voor bgt_kostenrubriek
|
||||
|
||||
Context:
|
||||
|
||||
Notes:
|
||||
*/
|
||||
%>
|
||||
<!-- #include file="model_prs_kostensoortgrp.inc" -->
|
||||
<%
|
||||
|
||||
function model_bgt_kostenrubriek()
|
||||
{
|
||||
this.records_name = "budgetcostcategories";
|
||||
this.record_name = "budgetcostcategory";
|
||||
this.table = "bgt_kostenrubriek";
|
||||
this.primary = "bgt_kostenrubriek_key";
|
||||
this.autfunction = "WEB_BGTMAN";
|
||||
this.record_title = L("bgt_kostenrubriek");
|
||||
this.records_title = L("bgt_kostenrubriek_m");
|
||||
|
||||
this.fields = {
|
||||
"id": {
|
||||
"dbs": "bgt_kostenrubriek_key",
|
||||
"label": L("lcl_key"),
|
||||
"typ": "key",
|
||||
"hidden_fld": true,
|
||||
"required": true,
|
||||
"filter": "exact",
|
||||
"seq": "bgt_s_bgt_kostenrubriek_key"
|
||||
},
|
||||
"budgetproject": {
|
||||
"dbs" : "bgt_project_key",
|
||||
"label": L("bgt_project_omschrijving"),
|
||||
"typ": "key",
|
||||
"required": true,
|
||||
"insertonly": true,
|
||||
"foreign": {
|
||||
"tbl": "bgt_project",
|
||||
"key": "bgt_project_key",
|
||||
"desc": "bgt_project_omschrijving",
|
||||
"where": "bgt_project_verwijder IS NULL"
|
||||
},
|
||||
"showtransit": true
|
||||
},
|
||||
"name": {
|
||||
"dbs": "bgt_kostenrubriek_oms",
|
||||
"label": L("bgt_kostenrubriek_oms"),
|
||||
"typ": "varchar",
|
||||
"required": true,
|
||||
"translate": true
|
||||
},
|
||||
"code": { /* vermoeden: gaat nog volgnr worden en/of kan vervallen */
|
||||
"dbs": "bgt_kostenrubriek_code",
|
||||
"label": L("bgt_kostenrubriek_code"),
|
||||
"typ": "varchar"
|
||||
}
|
||||
};
|
||||
|
||||
this.print = { xmlnode: "budget", where: "kostenrubriek"};
|
||||
|
||||
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);
|
||||
}
|
||||
%>
|
||||
@@ -1,202 +0,0 @@
|
||||
<% /*
|
||||
$Revision$
|
||||
$Id$
|
||||
|
||||
File: model_bgt_project.inc
|
||||
|
||||
Description: Model voor bgt_project
|
||||
|
||||
Context:
|
||||
|
||||
Notes:
|
||||
*/
|
||||
%>
|
||||
<!-- #include file="../api2/model_bgt_kostenrubriek.inc" -->
|
||||
<!-- #include file="../bgt/bgt_tools.inc" -->
|
||||
<%
|
||||
|
||||
function model_bgt_project()
|
||||
{
|
||||
this.records_name = "budgetprojects";
|
||||
this.record_name = "budgetproject";
|
||||
this.table = "bgt_project";
|
||||
this.primary = "bgt_project_key";
|
||||
this.soft_delete = "bgt_project_verwijder";
|
||||
this.autfunction = "WEB_BGTMGT";
|
||||
this.record_title = L("bgt_project");
|
||||
this.records_title = L("bgt_project_m");
|
||||
|
||||
|
||||
this.fields = {
|
||||
"id": {
|
||||
"dbs": "bgt_project_key",
|
||||
"label": L("lcl_key"),
|
||||
"typ": "key",
|
||||
"required": true,
|
||||
"hidden_fld": true,
|
||||
"filter": "exact",
|
||||
"seq": "bgt_s_bgt_project_key",
|
||||
"defaultvalue": null
|
||||
},
|
||||
"budgetdiscipline": { /* TODO linkt nu naar algemene discpline, moet bgt-variant in scf zijn? */
|
||||
"dbs": "ins_discipline_key",
|
||||
"label": L("bgt_discipline_omschrijving"),
|
||||
"typ": "key",
|
||||
"required": true,
|
||||
"insertonly": true,
|
||||
"foreign": {
|
||||
"tbl": "ins_tab_discipline",
|
||||
"key": "ins_discipline_key",
|
||||
"desc": "ins_discipline_omschrijving",
|
||||
"where": "ins_discipline_module = 'BGT' AND ins_discipline_verwijder IS NULL"
|
||||
},
|
||||
"showtransit": true
|
||||
},
|
||||
"name": {
|
||||
"dbs": "bgt_project_omschrijving",
|
||||
"label": L("bgt_project_omschrijving"),
|
||||
"typ": "varchar",
|
||||
"required": true,
|
||||
"translate": true
|
||||
},
|
||||
"code": {
|
||||
"dbs": "bgt_project_code",
|
||||
"label": L("bgt_project_code"),
|
||||
"typ": "varchar",
|
||||
"required": true
|
||||
},
|
||||
"sequence": {
|
||||
"dbs": "bgt_project_volgnr",
|
||||
"label": L("bgt_project_volgnr"),
|
||||
"typ": "number"
|
||||
},
|
||||
"account": {
|
||||
"dbs": "prs_kostenplaats_key",
|
||||
"label": L("bgt_budget_account"),
|
||||
"typ": "key",
|
||||
"foreign": bgt_account_foreign()
|
||||
},
|
||||
"pricedate": {
|
||||
"dbs": "bgt_project_prijspeildatum",
|
||||
"label": L("bgt_project_prijspeildatum"),
|
||||
"typ": "date"
|
||||
},
|
||||
"info": {
|
||||
"dbs": "bgt_project_info",
|
||||
"label": L("bgt_project_info"),
|
||||
"typ": "memo"
|
||||
},
|
||||
"notes": {
|
||||
"dbs": "bgt_project_notes",
|
||||
"label": L("bgt_project_notes"),
|
||||
"typ": "memo"
|
||||
}
|
||||
};
|
||||
|
||||
//this.print = { xmlnode: "budget", where: "project"};
|
||||
|
||||
this.hook_pre_edit = function (obj, fld)
|
||||
{
|
||||
if (mode != "save")
|
||||
{
|
||||
var sql = "SELECT count(*)"
|
||||
+ " FROM bgt_kostenrubriek"
|
||||
+ " WHERE bgt_project_key = " + obj.id;
|
||||
var oRs = Oracle.Execute(sql);
|
||||
if (oRs(0) == 0) // Een nieuw project, of een project waaraan nog geen rubrieken zijn gekoppeld.
|
||||
{ // Voeg de selectie voor het standaardproject toe.
|
||||
fld["import"] = {
|
||||
"dbs": "fac_usrtab.fac_usrtab_key",
|
||||
"label": "Standaard projectdata",
|
||||
"typ": "key",
|
||||
"foreign": {
|
||||
"tbl": "(SELECT d.fac_usrdata_key"
|
||||
+ " , d.fac_usrdata_code"
|
||||
+ " FROM fac_usrtab t"
|
||||
+ " , fac_usrdata d"
|
||||
+ " WHERE d.fac_usrtab_key = t.fac_usrtab_key"
|
||||
+ " AND t.fac_usrtab_naam = 'project_import')",
|
||||
"key": "fac_usrdata_key",
|
||||
"desc": "fac_usrdata_code"
|
||||
}
|
||||
};
|
||||
}
|
||||
oRs.Close();
|
||||
|
||||
if (obj.id > 0)
|
||||
{
|
||||
fld["account"].foreign.tbl = bgt_account_foreign_tbl(obj.id);
|
||||
}
|
||||
else
|
||||
{
|
||||
fld["account"].hidden_fld = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.hook_pre_post = function(params, obj)
|
||||
{
|
||||
// Controle op, en wijzigingen aan data voordat het record wordt toegevoegd.
|
||||
}
|
||||
|
||||
this.hook_post_post = function(params, obj, key)
|
||||
{
|
||||
// Nadat het project-record is toegevoegd is de key hiervan bekend.
|
||||
create_default_kostenplaatsgrp(key);
|
||||
var data_key = getFParamInt("import", -1);
|
||||
create_default_projectdata(key, data_key);
|
||||
}
|
||||
|
||||
this.hook_pre_put = function(params, obj, key)
|
||||
{
|
||||
// Wordt alleen gebruikt bij wijzigen.
|
||||
create_default_kostenplaatsgrp(key);
|
||||
var data_key = getFParamInt("import", -1);
|
||||
create_default_projectdata(key, data_key);
|
||||
}
|
||||
|
||||
|
||||
// if (!S("bgt_enabled"))
|
||||
// {
|
||||
// this.fields.budgetdiscipline.hidden_fld = true
|
||||
// this.fields.budgetdiscipline.default_value = 1
|
||||
// }
|
||||
|
||||
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);
|
||||
|
||||
|
||||
function create_default_kostenplaatsgrp(key)
|
||||
{
|
||||
var sql_u = "SELECT count(*) aantal"
|
||||
+ " FROM prs_kostenplaatsgrp"
|
||||
+ " WHERE bgt_project_key = " + key;
|
||||
var oRs_u = Oracle.Execute(sql_u);
|
||||
if (oRs_u("aantal").Value == 0)
|
||||
{
|
||||
var sql = "SELECT d.bgt_disc_params_code"
|
||||
+ " , p.bgt_project_code"
|
||||
+ " FROM bgt_disc_params d"
|
||||
+ " , bgt_project p"
|
||||
+ " WHERE d.bgt_ins_discipline_key = p.ins_discipline_key"
|
||||
+ " AND p.bgt_project_key = " + key;
|
||||
var oRs = Oracle.Execute(sql);
|
||||
if (!oRs.eof)
|
||||
{
|
||||
var sql_i = "INSERT INTO prs_kostenplaatsgrp"
|
||||
+ " (prs_kostenplaatsgrp_nr, prs_kostenplaatsgrp_oms, bgt_project_key)"
|
||||
+ " VALUES"
|
||||
+ " (" + safe.quoted_sql(oRs("bgt_disc_params_code").Value)
|
||||
+ " ," + safe.quoted_sql(oRs("bgt_project_code").Value)
|
||||
+ " ," + key
|
||||
+ " )";
|
||||
Oracle.Execute(sql_i);
|
||||
}
|
||||
oRs.Close();
|
||||
}
|
||||
oRs_u.Close();
|
||||
}
|
||||
}
|
||||
%>
|
||||
@@ -13,56 +13,33 @@
|
||||
|
||||
%>
|
||||
<!-- #include file="../Shared/discxalg3d.inc"-->
|
||||
<!-- #include file="./model_custom_fields.inc"-->
|
||||
<!-- #include file="./model_alg_kenmerk.inc"-->
|
||||
<%
|
||||
function model_buildings()
|
||||
model_buildings =
|
||||
{
|
||||
this.table = "alg_gebouw";
|
||||
this.primary = "alg_gebouw_key";
|
||||
this.records_name = "buildings";
|
||||
this.record_name = "building";
|
||||
this.fields = {"id" : { dbs: "alg_gebouw_key", typ: "key", filter: "exact" },
|
||||
"code" : { dbs: "alg_gebouw_code", typ: "varchar", filter: "like" },
|
||||
"name" : { dbs: "alg_gebouw_naam", typ: "varchar", filter: "like" },
|
||||
// is afgeleid gegeven { name: "description", dbs: "alg_gebouw_omschrijving", typ: "varchar"},
|
||||
"visitable" : { dbs: "alg_gebouw_bez", typ: "check", filter: "exact"},
|
||||
"location" : { dbs: "alg_locatie_key", typ: "key", foreign: "alg_locatie", filter: "exact"},
|
||||
"buildingfunction": { dbs: "alg_srtgebouw_key",
|
||||
typ: "key",
|
||||
foreign: { tbl: "alg_srtgebouw",
|
||||
key: "alg_srtgebouw_key",
|
||||
desc: "alg_srtgebouw_omschrijving"
|
||||
}
|
||||
},
|
||||
"remark" : { dbs: "alg_gebouw_opmerking", typ: "varchar" },
|
||||
"openfrom" : { dbs: "alg_gebouw_beginuur", typ: "float", track: true, label: L("lcl_estate_gebouw_beginuur") },
|
||||
"opento" : { dbs: "alg_gebouw_einduur", typ: "float", track: true, label: L("lcl_estate_gebouw_einduur") },
|
||||
"workdays" : { dbs: "alg_gebouw_werkdagen", typ: "number" },
|
||||
"email" : { dbs: "alg_gebouw_email", typ: "varchar" },
|
||||
"coordinate_x": { dbs: "alg_gebouw_x", typ: "number"},
|
||||
"coordinate_y": { dbs: "alg_gebouw_y", typ: "number"},
|
||||
"deleted" : { dbs: "alg_gebouw_verwijder", typ: "datetime" }
|
||||
},
|
||||
this.includes = {
|
||||
"custom_fields" : {
|
||||
"model": new model_custom_fields(this, new model_alg_kenmerk("G", { internal: true }), { readman: true, readuse: true }),
|
||||
"joinfield": "flexparentkey",
|
||||
"enable_update": true
|
||||
}
|
||||
}
|
||||
|
||||
this.REST_GET = function _GET(params)
|
||||
table: "alg_gebouw",
|
||||
primary: "alg_gebouw_key",
|
||||
records_name: "buildings",
|
||||
record_name: "building",
|
||||
fields: {"id" : { dbs: "alg_gebouw_key", typ: "key", filter: "exact" },
|
||||
"code" : { dbs: "alg_gebouw_code", typ: "varchar", filter: "like" },
|
||||
"name" : { dbs: "alg_gebouw_naam", typ: "varchar", filter: "like" },
|
||||
// is afgeleid gegeven { name: "description", dbs: "alg_gebouw_omschrijving", typ: "varchar"},
|
||||
"visitable" : { dbs: "alg_gebouw_bez", typ: "check", filter: "exact"},
|
||||
"location" : { dbs: "alg_locatie_key", typ: "key", foreign: "alg_locatie", filter: "exact"},
|
||||
"coordinate_x": { dbs: "alg_gebouw_x", typ: "number"},
|
||||
"coordinate_y": { dbs: "alg_gebouw_y", typ: "number"}
|
||||
},
|
||||
REST_GET: function _GET(params)
|
||||
{
|
||||
var urole = "fe"; // TODO: Moet echt niet ter zake doen
|
||||
var autfunction = urole == "fe"? "WEB_ALGUSE" : "WEB_ALGMAN";
|
||||
params.authparams = user.checkAutorisation(autfunction, null, null, true); // pessimistisch
|
||||
|
||||
// TODO: Add authorization
|
||||
var query = api2.sqlfields(params, this);
|
||||
var query = api2.sqlfields(params, model_buildings);
|
||||
query.wheres.push("alg_gebouw_verwijder IS NULL");
|
||||
|
||||
var wheres = api2.sqlfilter(params, this)
|
||||
var wheres = api2.sqlfilter(params, model_buildings)
|
||||
query.wheres = query.wheres.concat(wheres);
|
||||
|
||||
var sql = "SELECT " + query.selects.join(", ")
|
||||
@@ -70,9 +47,18 @@ function model_buildings()
|
||||
+ " WHERE " + query.wheres.join(" AND " )
|
||||
+ " ORDER BY alg_gebouw_code";
|
||||
|
||||
var json = api2.sql2json (params, sql, this);
|
||||
var json = api2.sql2json (params, sql, model_buildings);
|
||||
|
||||
return json;
|
||||
}
|
||||
},
|
||||
PUT: function (params) /* update building */
|
||||
{
|
||||
},
|
||||
POST: function (params) /* new building */
|
||||
{
|
||||
},
|
||||
DELETE: function (params) /* delete building */
|
||||
{
|
||||
}
|
||||
}
|
||||
%>
|
||||
@@ -15,10 +15,10 @@
|
||||
|
||||
function model_cad_label()
|
||||
{
|
||||
this.records_name = "graphiclabels";
|
||||
this.record_name = "graphiclabel";
|
||||
this.table = "cad_label";
|
||||
this.primary = "cad_label_key";
|
||||
this.records_name = "cad_labels";
|
||||
this.record_name = "cad_label";
|
||||
this.autfunction = "WEB_CADMGT";
|
||||
this.record_title = L("cad_label");
|
||||
this.records_title = L("cad_label_m");
|
||||
@@ -27,7 +27,7 @@ function model_cad_label()
|
||||
this.fields = {
|
||||
"id": {
|
||||
"dbs": "cad_label_key",
|
||||
"label": L("lcl_key"),
|
||||
"label": "Key",
|
||||
"typ": "key",
|
||||
"required": true,
|
||||
"filter": "exact",
|
||||
@@ -39,7 +39,7 @@ function model_cad_label()
|
||||
"typ": "varchar",
|
||||
"translate": true
|
||||
},
|
||||
"viewname": {
|
||||
"view_name": {
|
||||
"dbs": "cad_label_view",
|
||||
"label": L("cad_label_view"),
|
||||
"typ": "varchar",
|
||||
@@ -49,41 +49,38 @@ function model_cad_label()
|
||||
"dbs": "cad_label_size",
|
||||
"label": L("cad_label_size"),
|
||||
"typ": "number",
|
||||
"defaultvalue": "800",
|
||||
"multiedit": true
|
||||
"defaultvalue": "800"
|
||||
},
|
||||
"visible": {
|
||||
"dbs": "cad_label_visible",
|
||||
"label": L("cad_label_visible"),
|
||||
"typ": "check0",
|
||||
"defaultvalue": 1,
|
||||
"multiedit": true
|
||||
"defaultvalue": 1
|
||||
},
|
||||
"authorization": {
|
||||
"dbs": "fac_functie_key",
|
||||
"label": L("fac_functie_key"),
|
||||
"typ": "key",
|
||||
"foreign": "fac_functie",
|
||||
"LOVinit": "",
|
||||
"multiedit": true
|
||||
"LOVinit": ""
|
||||
},
|
||||
"position": {
|
||||
"type_place": {
|
||||
"dbs": "plaats.waar",
|
||||
"label": L("cad_label_type_waar"),
|
||||
"typ": "varchar",
|
||||
"hidden_fld": true,
|
||||
"LOV": buildCadPositionLOV(),
|
||||
"LOV": type_place_LOV(),
|
||||
"filter": "exact"
|
||||
},
|
||||
"situation": {
|
||||
"type_situation": {
|
||||
"dbs": "plaats.situatie",
|
||||
"label": L("cad_label_type_situatie"),
|
||||
"typ": "varchar",
|
||||
"hidden_fld": true,
|
||||
"LOV": buildCadSituationLOV(),
|
||||
"LOV": type_situation_LOV(),
|
||||
"filter": "exact"
|
||||
},
|
||||
"labeltype": {
|
||||
"label_type": {
|
||||
"dbs": "cad_label_type",
|
||||
"label": L("cad_label_type"),
|
||||
"typ": "number",
|
||||
@@ -138,19 +135,6 @@ function model_cad_label()
|
||||
};
|
||||
|
||||
|
||||
this.hook_pre_edit = function (obj, fld)
|
||||
{
|
||||
var labeltype = obj.labeltype;
|
||||
var situatie = (labeltype & 4 ? "scenario" : "actueel");
|
||||
|
||||
%>
|
||||
<script type="text/javascript">
|
||||
var module = "CAD";
|
||||
</script>
|
||||
<%
|
||||
}
|
||||
|
||||
|
||||
var ext_sql = "(SELECT BITAND(cad_label_type, 27) waar"
|
||||
+ " , BITAND(cad_label_type, 4) situatie"
|
||||
+ " , cad_label_key"
|
||||
@@ -166,5 +150,20 @@ function model_cad_label()
|
||||
this.REST_POST = generic_REST_POST(this);
|
||||
this.REST_PUT = generic_REST_PUT(this);
|
||||
this.REST_DELETE = generic_REST_DELETE(this);
|
||||
|
||||
|
||||
function type_place_LOV()
|
||||
{
|
||||
return "1;" + L("cad_label_type_bi_rui")
|
||||
+ ";9;" + L("cad_label_type_bi_wp")
|
||||
+ ";17;" + L("cad_label_type_bi_obj")
|
||||
+ ";2;" + L("cad_label_type_bu_ts")
|
||||
+ ";18;" + L("cad_label_type_bu_obj");
|
||||
}
|
||||
function type_situation_LOV()
|
||||
{
|
||||
return "0;" + L("cad_label_type_si_act")
|
||||
+ ";4;" + L("cad_label_type_si_sce");
|
||||
}
|
||||
}
|
||||
%>
|
||||
@@ -16,10 +16,10 @@
|
||||
|
||||
function model_cad_legenda()
|
||||
{
|
||||
this.records_name = "graphiclegends";
|
||||
this.record_name = "graphiclegend";
|
||||
this.table = "cad_legenda";
|
||||
this.primary = "cad_legenda_key";
|
||||
this.records_name = "cad_legendas";
|
||||
this.record_name = "cad_legenda";
|
||||
this.autfunction = "WEB_CADMGT";
|
||||
this.record_title = L("cad_legenda");
|
||||
this.records_title = L("cad_legenda_m");
|
||||
@@ -28,7 +28,7 @@ function model_cad_legenda()
|
||||
this.fields = {
|
||||
"id": {
|
||||
"dbs": "cad_legenda_key",
|
||||
"label": L("lcl_key"),
|
||||
"label": "Key",
|
||||
"typ": "key",
|
||||
"required": true,
|
||||
"filter": "exact",
|
||||
@@ -50,13 +50,13 @@ function model_cad_legenda()
|
||||
};
|
||||
|
||||
this.includes = {
|
||||
"legendvalues": {
|
||||
"cad_values": {
|
||||
"model": new model_cad_legendawaarde(),
|
||||
"joinfield": "graphiclegenda",
|
||||
"enable_update": true
|
||||
"joinfield": "legendas"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
this.REST_GET = generic_REST_GET(this);
|
||||
this.REST_POST = generic_REST_POST(this);
|
||||
this.REST_PUT = generic_REST_PUT(this);
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
|
||||
function model_cad_legendawaarde()
|
||||
{
|
||||
this.records_name = "graphiclegendvalues";
|
||||
this.record_name = "graphiclegendvalue";
|
||||
this.table = "cad_legendawaarde";
|
||||
this.primary = "cad_legendawaarde_key";
|
||||
this.records_name = "cad_legendawaardes";
|
||||
this.record_name = "cad_legendawaarde";
|
||||
this.autfunction = "WEB_CADMGT";
|
||||
this.record_title = L("cad_legendawaarde");
|
||||
this.records_title = L("cad_legendawaarde_m");
|
||||
@@ -27,13 +27,13 @@ function model_cad_legendawaarde()
|
||||
this.fields = {
|
||||
"id": {
|
||||
"dbs": "cad_legendawaarde_key",
|
||||
"label": L("lcl_key"),
|
||||
"label": "Key",
|
||||
"typ": "key",
|
||||
"required": true,
|
||||
"filter": "exact",
|
||||
"seq": "cad_s_cad_legendawaarde_key"
|
||||
},
|
||||
"graphiclegenda": {
|
||||
"legendas": {
|
||||
"dbs": "cad_legenda_key",
|
||||
"label": L("cad_legenda"),
|
||||
"typ": "key",
|
||||
@@ -68,7 +68,7 @@ function model_cad_legendawaarde()
|
||||
this.list = {
|
||||
"columns": [
|
||||
"id",
|
||||
"graphiclegenda",
|
||||
"legendas",
|
||||
"name",
|
||||
"description",
|
||||
"rgb"
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
|
||||
function model_cad_thema()
|
||||
{
|
||||
this.records_name = "graphicthemes";
|
||||
this.record_name = "graphictheme";
|
||||
this.table = "cad_thema";
|
||||
this.primary = "cad_thema_key";
|
||||
this.records_name = "cad_themas";
|
||||
this.record_name = "cad_thema";
|
||||
this.autfunction = "WEB_CADMGT";
|
||||
this.record_title = L("cad_thema");
|
||||
this.records_title = L("cad_thema_m");
|
||||
@@ -27,7 +27,7 @@ function model_cad_thema()
|
||||
this.fields = {
|
||||
"id": {
|
||||
"dbs": "cad_thema_key",
|
||||
"label": L("lcl_key"),
|
||||
"label": "Key",
|
||||
"typ": "key",
|
||||
"required": true,
|
||||
"filter": "exact",
|
||||
@@ -40,13 +40,13 @@ function model_cad_thema()
|
||||
"translate": true,
|
||||
"filter": "like"
|
||||
},
|
||||
"viewname": {
|
||||
"view_name": {
|
||||
"dbs": "cad_thema_view",
|
||||
"label": L("cad_label_view"),
|
||||
"typ": "varchar",
|
||||
"filter": "like"
|
||||
},
|
||||
"graphiclegend": {
|
||||
"legendas": {
|
||||
"dbs": "cad_legenda_key",
|
||||
"label": L("cad_legenda"),
|
||||
"typ": "key",
|
||||
@@ -57,34 +57,32 @@ function model_cad_thema()
|
||||
},
|
||||
"defaultvalue": null,
|
||||
"filter": "exact",
|
||||
"emptyoption": null,
|
||||
"multiedit": true
|
||||
"emptyoption": null
|
||||
},
|
||||
"authorization": {
|
||||
"dbs": "fac_functie_key",
|
||||
"label": L("fac_functie_key"),
|
||||
"typ": "key",
|
||||
"foreign": "fac_functie",
|
||||
"LOVinit": "",
|
||||
"multiedit": true
|
||||
"LOVinit": ""
|
||||
},
|
||||
"position": {
|
||||
"type_place": {
|
||||
"dbs": "plaats.waar",
|
||||
"label": L("cad_label_type_waar"),
|
||||
"typ": "varchar",
|
||||
"hidden_fld": true,
|
||||
"LOV": buildCadPositionLOV(),
|
||||
"LOV": type_place_LOV(),
|
||||
"filter": "exact"
|
||||
},
|
||||
"situation": {
|
||||
"type_situation": {
|
||||
"dbs": "plaats.situatie",
|
||||
"label": L("cad_label_type_situatie"),
|
||||
"typ": "varchar",
|
||||
"hidden_fld": true,
|
||||
"LOV": buildCadSituationLOV(),
|
||||
"LOV": type_situation_LOV(),
|
||||
"filter": "exact"
|
||||
},
|
||||
"themetype": {
|
||||
"thema_type": {
|
||||
"dbs": "cad_thema_type",
|
||||
"label": L("cad_label_type"),
|
||||
"typ": "number",
|
||||
@@ -151,11 +149,10 @@ function model_cad_thema()
|
||||
}
|
||||
]
|
||||
},
|
||||
"themeurl": {
|
||||
"thema_url": {
|
||||
"dbs": "cad_thema_onclick_url",
|
||||
"label": L("cad_thema_onclick_url"),
|
||||
"typ": "varchar",
|
||||
"multiedit": true
|
||||
"typ": "varchar"
|
||||
},
|
||||
"_generate": {
|
||||
"dbs": "dual.dummy",
|
||||
@@ -172,16 +169,6 @@ function model_cad_thema()
|
||||
};
|
||||
|
||||
|
||||
this.hook_pre_put = function(params, jsondata, key)
|
||||
{ // update
|
||||
refresh_legenda(jsondata);
|
||||
}
|
||||
this.hook_pre_post = function(params, jsondata)
|
||||
{ // insert
|
||||
refresh_legenda(jsondata);
|
||||
}
|
||||
|
||||
|
||||
var ext_sql = "(SELECT BITAND(cad_thema_type, 27) waar"
|
||||
+ " , BITAND(cad_thema_type, 4) situatie"
|
||||
+ " , cad_thema_key"
|
||||
@@ -195,5 +182,20 @@ function model_cad_thema()
|
||||
this.REST_POST = generic_REST_POST(this);
|
||||
this.REST_PUT = generic_REST_PUT(this);
|
||||
this.REST_DELETE = generic_REST_DELETE(this);
|
||||
|
||||
|
||||
function type_place_LOV()
|
||||
{
|
||||
return "1;" + L("cad_label_type_bi_rui")
|
||||
+ ";9;" + L("cad_label_type_bi_wp")
|
||||
+ ";17;" + L("cad_label_type_bi_obj")
|
||||
+ ";2;" + L("cad_label_type_bu_ts")
|
||||
+ ";18;" + L("cad_label_type_bu_obj");
|
||||
}
|
||||
function type_situation_LOV()
|
||||
{
|
||||
return "0;" + L("cad_label_type_si_act")
|
||||
+ ";4;" + L("cad_label_type_si_sce");
|
||||
}
|
||||
}
|
||||
%>
|
||||
@@ -11,22 +11,54 @@
|
||||
Notes:
|
||||
*/
|
||||
%>
|
||||
<!-- #include file="../ALG/alg.inc" -->
|
||||
<%
|
||||
|
||||
function model_cadcontours()
|
||||
model_cadcontours =
|
||||
{
|
||||
this.table = "cad_imp_contour",
|
||||
this.primary = "cad_imp_contour_key";
|
||||
this.records_name = "cadcontours";
|
||||
this.record_name = "cadcontour";
|
||||
this.fields = {"id" : { dbs: "cad_imp_contour_key", typ: "key", filter: "exact" },
|
||||
"name" : { dbs: "cad_imp_contour_nr", typ: "varchar", filter: "like" },
|
||||
"cadarea" : { dbs: "cad_imp_contour_opp", typ: "float" },
|
||||
"cadalt1" : { dbs: "cad_imp_contour_opp_alt1", typ: "float" },
|
||||
"cadalt2" : { dbs: "cad_imp_contour.cad_imp_contour_opp_alt2", typ: "float" },
|
||||
"concept" : { dbs: "cad_imp_contour_concept", typ: "number" }
|
||||
};
|
||||
table: "cad_imp_contour",
|
||||
primary: "cad_imp_contour_key",
|
||||
aliasprefix: "CAD.",
|
||||
records_name: "cadcontours",
|
||||
record_name: "cadcontour",
|
||||
fields: {"id" : { dbs: "cad_imp_contour_key", typ: "key", filter: "exact" },
|
||||
"name" : { dbs: "cad_imp_contour_nr", typ: "varchar", filter: "like" },
|
||||
"cadarea" : { dbs: "cad_imp_contour_opp", typ: "float" },
|
||||
"cadalt1" : { dbs: "cad_imp_contour_opp_alt1", typ: "float" },
|
||||
"cadalt2" : { dbs: "cad_imp_contour.cad_imp_contour_opp_alt2", typ: "float" },
|
||||
"concept" : { dbs: "cad_imp_contour_concept", typ: "number" }
|
||||
},
|
||||
|
||||
// (nog) geen eigen GET en dergelijke, alleen via include van model_rooms
|
||||
_check_authorization: function(params, method)
|
||||
{
|
||||
},
|
||||
_analyze_fields: function (fields, params, jsondata) /* analyseer inkomende data, common voor PUT en POST */
|
||||
{
|
||||
},
|
||||
REST_GET: function _GET(params, jsondata)
|
||||
{
|
||||
model_cadcontours._check_authorization(params, "GET");
|
||||
var query = api2.sqlfields(params, model_cadcontours);
|
||||
|
||||
var wheres = api2.sqlfilter(params, model_cadcontours);
|
||||
query.wheres = query.wheres.concat(wheres);
|
||||
|
||||
var sql = "SELECT " + query.selects.join(", ")
|
||||
+ " FROM " + query.tables.join(", ")
|
||||
+ (query.wheres.length ? " WHERE " + query.wheres.join(" AND " ) : "")
|
||||
|
||||
var json = api2.sql2json (params, sql, model_cadcontours);
|
||||
|
||||
return json;
|
||||
},
|
||||
REST_PUT: function (params, jsondata, the_key) /* update cad contour */
|
||||
{
|
||||
},
|
||||
REST_POST: function (params, jsondata) /* new cad contour */
|
||||
{
|
||||
},
|
||||
REST_DELETE: function (params, the_key) /* delete cad contour */
|
||||
{
|
||||
}
|
||||
}
|
||||
%>
|
||||
@@ -2,7 +2,7 @@
|
||||
$Revision$
|
||||
$Id$
|
||||
|
||||
File: model_cnt_disc_params.inc
|
||||
File: model_bes_disc_params.inc
|
||||
|
||||
Description: Vanuit CodeCharge gegenereerd model voor cnt_discipline
|
||||
|
||||
@@ -14,27 +14,27 @@
|
||||
<%
|
||||
model_cnt_disc_params =
|
||||
{
|
||||
"records_name": "cnt_disc_params",
|
||||
"record_name": "cnt_disc_params",
|
||||
"table": "cnt_disc_params",
|
||||
"primary": "cnt_disc_params_key",
|
||||
"records_name": "cnt_disc_params",
|
||||
"record_name": "cnt_disc_params",
|
||||
"autfunction": "WEB_CNTMGT",
|
||||
|
||||
|
||||
"fields": {
|
||||
"id": {
|
||||
"dbs": "cnt_disc_params_key",
|
||||
"label": L("lcl_key"),
|
||||
"label": "Key",
|
||||
"typ": "key",
|
||||
"seq": "cnt_s_cnt_disc_params_key"
|
||||
},
|
||||
"contractdiscipline": {
|
||||
"cnt_ins_discipline_key": {
|
||||
"dbs": "cnt_ins_discipline_key",
|
||||
"label": "Foreign key",
|
||||
"typ": "key",
|
||||
"hidden_fld": true
|
||||
},
|
||||
"contracttype": {
|
||||
"invoice_type": {
|
||||
"dbs": "cnt_srtcontract_type",
|
||||
"label": L("cnt_discipline_cnt_disckey"),
|
||||
"typ": "key",
|
||||
@@ -45,7 +45,7 @@ model_cnt_disc_params =
|
||||
"desc": "cnt_typecontract_omschrijving"
|
||||
}
|
||||
},
|
||||
"schedule": {
|
||||
"invoice_schedule": {
|
||||
"dbs": "cnt_disc_params_factuurschema",
|
||||
"label": L("cnt_discipline_factuurschema"),
|
||||
"typ": "check0"
|
||||
@@ -66,7 +66,7 @@ model_cnt_disc_params =
|
||||
"label": L("cnt_discipline_factuurappr"),
|
||||
"typ": "check0"
|
||||
},
|
||||
"invoicelimit": { // "limit" is een reserved naam in API2
|
||||
"limit": {
|
||||
"dbs": "cnt_disc_params_factuurgrens",
|
||||
"label": L("cnt_discipline_factuurgrens"),
|
||||
"typ": "number"
|
||||
|
||||
@@ -34,11 +34,10 @@ function model_cnt_discipline(disc_key, params)
|
||||
|
||||
_model_cnt_discipline = // Internal only
|
||||
{
|
||||
"records_name":"contractdisciplines",
|
||||
"record_name": "contractdiscipline",
|
||||
"table": "ins_tab_discipline",
|
||||
"audit": { "childtable": "cnt_disc_params" }, // Parameters voor fac_audit.
|
||||
"primary": "ins_discipline_key",
|
||||
"records_name":"cnt_disciplines",
|
||||
"record_name": "cnt_discipline",
|
||||
"soft_delete": "ins_discipline_verwijder",
|
||||
"autfunction": "WEB_CNTMGT",
|
||||
"record_title": L("cnt_discipline"),
|
||||
@@ -48,7 +47,7 @@ _model_cnt_discipline = // Internal only
|
||||
"fields": {
|
||||
"id": {
|
||||
"dbs": "ins_discipline_key",
|
||||
"label": L("lcl_key"),
|
||||
"label": "Key",
|
||||
"typ": "key",
|
||||
"required": true,
|
||||
"filter": "exact",
|
||||
@@ -62,7 +61,7 @@ _model_cnt_discipline = // Internal only
|
||||
"translate": true,
|
||||
"required": true
|
||||
},
|
||||
"module": {
|
||||
"ins_discipline_module": {
|
||||
"dbs": "ins_discipline_module",
|
||||
"label": L("ins_discipline_module"),
|
||||
"typ": "varchar",
|
||||
@@ -85,7 +84,7 @@ _model_cnt_discipline = // Internal only
|
||||
},
|
||||
"disc_params": {
|
||||
"model": model_cnt_disc_params,
|
||||
"joinfield": "contractdiscipline"
|
||||
"joinfield": "cnt_ins_discipline_key"
|
||||
}
|
||||
}
|
||||
%>
|
||||
@@ -4,40 +4,38 @@
|
||||
|
||||
File: model_cnt_kenmerk.inc
|
||||
|
||||
Description: Model voor cnt_kenmerk
|
||||
Description: Vanuit CodeCharge gegenereerd model voor cnt_kenmerk
|
||||
|
||||
Context:
|
||||
|
||||
Notes:
|
||||
*/
|
||||
%>
|
||||
<!-- #include file="model_cnt_srtkenmerk.inc"-->
|
||||
<%
|
||||
|
||||
function model_cnt_kenmerk(params)
|
||||
function model_cnt_kenmerk()
|
||||
{
|
||||
params = params || {};
|
||||
this.records_name = "contractproperties";
|
||||
this.record_name = "contractproperty";
|
||||
this.table = "cnt_kenmerk";
|
||||
this.primary = "cnt_kenmerk_key";
|
||||
this.records_name = "cnt_kenmerks";
|
||||
this.record_name = "cnt_kenmerk";
|
||||
this.soft_delete = "cnt_kenmerk_verwijder";
|
||||
this.autfunction = params.internal?false:"WEB_CNTMGT";
|
||||
this.autfunction = "WEB_CNTMGT";
|
||||
this.record_title = L("cnt_kenmerk");
|
||||
this.records_title = L("cnt_kenmerk_m");
|
||||
this.module = "CNT";
|
||||
|
||||
|
||||
this.fields = {
|
||||
"id": {
|
||||
"dbs": "cnt_kenmerk_key",
|
||||
"label": L("lcl_key"),
|
||||
"label": "Key",
|
||||
"typ": "key",
|
||||
"required": true,
|
||||
"filter": "exact",
|
||||
"seq": "cnt_s_cnt_kenmerk_key",
|
||||
"readonly": true
|
||||
},
|
||||
"contractpropertytype": {
|
||||
"property_key": {
|
||||
"dbs": "cnt_srtkenmerk_key",
|
||||
"label": L("mgt_srtkenmerk_key"),
|
||||
"typ": "key",
|
||||
@@ -56,7 +54,7 @@ function model_cnt_kenmerk(params)
|
||||
"LOVinit": "",
|
||||
"friendlyname": true
|
||||
},
|
||||
"attributetypehide": {
|
||||
"property_type": {
|
||||
"dbs": "cnt_srtkenmerk.cnt_srtkenmerk_kenmerktype",
|
||||
"label": L("mgt_srtkenmerk_kenmerktype"),
|
||||
"typ": "varchar",
|
||||
@@ -64,7 +62,7 @@ function model_cnt_kenmerk(params)
|
||||
"LOV": buildKenmerktypeLOV(),
|
||||
"filter": "exact"
|
||||
},
|
||||
"contractdiscipline": {
|
||||
"contract_type": {
|
||||
"dbs": "cnt_srtcontract_key",
|
||||
"label": L("cnt_srtcontract_key"),
|
||||
"typ": "key",
|
||||
@@ -81,7 +79,7 @@ function model_cnt_kenmerk(params)
|
||||
"filter": "exact",
|
||||
"LOVinit": ""
|
||||
},
|
||||
"level": {
|
||||
"cnt_kenmerk_niveau": {
|
||||
"dbs": "cnt_kenmerk_niveau",
|
||||
"label": L("mgt_kenmerk_niveau"),
|
||||
"typ": "varchar",
|
||||
@@ -95,7 +93,7 @@ function model_cnt_kenmerk(params)
|
||||
"typ": "number",
|
||||
"required": true
|
||||
},
|
||||
"location": {
|
||||
"cnt_kenmerk_locatiekolom": {
|
||||
"dbs": "cnt_kenmerk_locatiekolom",
|
||||
"label": L("ins_kenmerk_locatiekolom"),
|
||||
"typ": "varchar",
|
||||
@@ -108,7 +106,7 @@ function model_cnt_kenmerk(params)
|
||||
"LOV": buildVerplichtingList(),
|
||||
"emptyoption": null
|
||||
},
|
||||
"group": {
|
||||
"property_group": {
|
||||
"dbs": "cnt_kenmerk_groep",
|
||||
"label": L("mgt_kenmerk_groep"),
|
||||
"typ": "key",
|
||||
@@ -121,7 +119,7 @@ function model_cnt_kenmerk(params)
|
||||
"label": L("mgt_kenmerk_toonbaar"),
|
||||
"typ": "check"
|
||||
},
|
||||
"propertydefault": {
|
||||
"default": {
|
||||
"dbs": "cnt_kenmerk_default",
|
||||
"label": L("mgt_kenmerk_default"),
|
||||
"typ": "memo",
|
||||
@@ -140,21 +138,6 @@ function model_cnt_kenmerk(params)
|
||||
}
|
||||
};
|
||||
|
||||
this.getPropertyType = function (kenmerkdata)
|
||||
{
|
||||
var typedata = api2.GET(new model_cnt_srtkenmerk({internal: params.internal}), kenmerkdata.contractpropertytype.id);
|
||||
return typedata;
|
||||
}
|
||||
|
||||
this.hook_pre_edit = function (obj, fld)
|
||||
{
|
||||
%>
|
||||
<script type="text/javascript">
|
||||
var module = "CNT";
|
||||
</script>
|
||||
<%
|
||||
}
|
||||
|
||||
|
||||
this.REST_GET = generic_REST_GET(this, {
|
||||
"GET": {
|
||||
|
||||
@@ -13,23 +13,22 @@
|
||||
%>
|
||||
<%
|
||||
|
||||
function model_cnt_srtkenmerk(params)
|
||||
function model_cnt_srtkenmerk()
|
||||
{
|
||||
params = params || {};
|
||||
this.records_name = "contractpropertytypes";
|
||||
this.record_name = "contractpropertytype";
|
||||
this.table = "cnt_srtkenmerk";
|
||||
this.primary = "cnt_srtkenmerk_key";
|
||||
this.records_name = "cnt_srtkenmerks";
|
||||
this.record_name = "cnt_srtkenmerk";
|
||||
this.soft_delete = "cnt_srtkenmerk_verwijder";
|
||||
this.autfunction = params.internal?false:"WEB_CNTMGT";
|
||||
this.record_title = L("cnt_srtkenmerk");
|
||||
this.records_title = L("cnt_srtkenmerk_m");
|
||||
this.autfunction = "WEB_CNTMGT";
|
||||
this.record_title = L("mgt_srtkenmerk");
|
||||
this.records_title = L("mgt_srtkenmerk_m");
|
||||
|
||||
|
||||
this.fields = {
|
||||
"id": {
|
||||
"dbs": "cnt_srtkenmerk_key",
|
||||
"label": L("lcl_key"),
|
||||
"label": "Key",
|
||||
"typ": "key",
|
||||
"required": true,
|
||||
"filter": "exact",
|
||||
@@ -43,7 +42,7 @@ function model_cnt_srtkenmerk(params)
|
||||
"required": true,
|
||||
"filter": "like"
|
||||
},
|
||||
"attributetype": {
|
||||
"property_type": {
|
||||
"dbs": "cnt_srtkenmerk_kenmerktype",
|
||||
"label": L("mgt_srtkenmerk_kenmerktype"),
|
||||
"typ": "varchar",
|
||||
@@ -93,18 +92,6 @@ function model_cnt_srtkenmerk(params)
|
||||
};
|
||||
|
||||
|
||||
this.hook_pre_edit = function (obj, fld)
|
||||
{
|
||||
var kenmerktype = (obj.attributetype ? obj.attributetype.id : "");
|
||||
fld.attributetype.LOV = buildKenmerktypeLOV(kenmerktype);
|
||||
%>
|
||||
<script type="text/javascript">
|
||||
var module = "CNT";
|
||||
var property_type = "<%=safe.jsstring(kenmerktype)%>";
|
||||
</script>
|
||||
<%
|
||||
}
|
||||
|
||||
this.REST_GET = generic_REST_GET(this);
|
||||
this.REST_POST = generic_REST_POST(this);
|
||||
this.REST_PUT = generic_REST_PUT(this);
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
|
||||
function model_cnt_termijn()
|
||||
{
|
||||
this.records_name = "contractperiods";
|
||||
this.record_name = "contractperiod";
|
||||
this.table = "cnt_termijn";
|
||||
this.primary = "cnt_termijn_key";
|
||||
this.records_name = "cnt_termijns";
|
||||
this.record_name = "cnt_termijn";
|
||||
this.autfunction = "WEB_CNTMGT";
|
||||
this.record_title = L("cnt_termijn");
|
||||
this.records_title = L("cnt_termijn_m");
|
||||
@@ -26,7 +26,7 @@ function model_cnt_termijn()
|
||||
this.fields = {
|
||||
"id": {
|
||||
"dbs": "cnt_termijn_key",
|
||||
"label": L("lcl_key"),
|
||||
"label": "Key",
|
||||
"typ": "key",
|
||||
"required": true,
|
||||
"filter": "exact",
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
%>
|
||||
<!-- #include file="../prs/prs.inc" -->
|
||||
<!-- #include file="./model_custom_fields.inc"-->
|
||||
<!-- #include file="./model_prs_kenmerk.inc"-->
|
||||
<%
|
||||
|
||||
function model_companies()
|
||||
@@ -58,7 +57,7 @@ function model_companies()
|
||||
|
||||
this.includes = {
|
||||
"custom_fields" : {
|
||||
"model": new model_custom_fields(this, new model_prs_kenmerk("B", { internal: true }), { readman: true, readuse: true, pNiveau: "B" }),
|
||||
"model": new model_custom_fields(this, "PRS", { readman: true, readuse: true, pNiveau: "B" }),
|
||||
"joinfield": "flexparentkey"
|
||||
}
|
||||
};
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
%>
|
||||
<!-- #include file="../Shared/discx3d.inc" -->
|
||||
<!-- #include file="../cnt/cnt.inc" -->
|
||||
<!-- #include file="./model_fac_tracking.inc"-->
|
||||
<!-- #include file="./model_tracking.inc"-->
|
||||
<!-- #include file="./model_cnt_factuurschema.inc"-->
|
||||
<%
|
||||
|
||||
@@ -47,7 +47,7 @@ model_contracts =
|
||||
includes: {
|
||||
"tracking": {
|
||||
model: new model_tracking(['contract']),
|
||||
joinfield: "trackingrefkey"
|
||||
joinfield: "fac_tracking_refkey"
|
||||
},
|
||||
"schedule": {
|
||||
model: new model_cnt_factuurschema(),
|
||||
|
||||
@@ -14,27 +14,27 @@
|
||||
<%
|
||||
model_ctr_disc_params =
|
||||
{
|
||||
"records_name": "taskdisciplineparams",
|
||||
"record_name": "taskdisciplineparam",
|
||||
"table": "ctr_disc_params",
|
||||
"primary": "ctr_disc_params_key",
|
||||
"records_name": "ctr_disc_params",
|
||||
"record_name": "ctr_disc_params",
|
||||
"autfunction": "WEB_CTRMSU",
|
||||
|
||||
|
||||
"fields": {
|
||||
"id": {
|
||||
"dbs": "ctr_disc_params_key",
|
||||
"label": L("lcl_key"),
|
||||
"label": "Key",
|
||||
"typ": "key",
|
||||
"seq": "bes_s_ctr_disc_params_key"
|
||||
},
|
||||
"taskdiscipline": {
|
||||
"ctr_ins_discipline_key": {
|
||||
"dbs": "ctr_ins_discipline_key",
|
||||
"label": "Foreign key",
|
||||
"typ": "key",
|
||||
"hidden_fld": true
|
||||
},
|
||||
"type": {
|
||||
"inspection_type": {
|
||||
"dbs": "ctr_disc_params_controle_type",
|
||||
"label": L("ctr_inspection_type"),
|
||||
"typ": "key",
|
||||
@@ -46,12 +46,6 @@ model_ctr_disc_params =
|
||||
"label": L("ctr_ismjob"),
|
||||
"typ": "check0",
|
||||
"readonly": S("mjb_enabled") != 1
|
||||
},
|
||||
"stdmelding": {
|
||||
"dbs": "mld_stdmelding_key",
|
||||
"label": L("mld_stdmelding_key"),
|
||||
"typ": "key",
|
||||
"foreign": "mld_stdmelding"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,11 +36,10 @@ function model_ctr_discipline(disc_key, params)
|
||||
|
||||
function _model_ctr_discipline()
|
||||
{
|
||||
this.records_name = "taskdisciplines";
|
||||
this.record_name = "taskdiscipline";
|
||||
this.table = "ins_tab_discipline";
|
||||
this.audit = { "childtable": "ctr_disc_params" }, // Parameters voor fac_audit.
|
||||
this.primary = "ins_discipline_key";
|
||||
this.records_name = "ins_tab_disciplines";
|
||||
this.record_name = "ins_tab_discipline";
|
||||
this.autfunction = "WEB_CTRMGT";
|
||||
this.record_title = L("ctr_discipline");
|
||||
this.records_title = L("ctr_discipline_m");
|
||||
@@ -48,7 +47,7 @@ function _model_ctr_discipline()
|
||||
this.fields = {
|
||||
"id": {
|
||||
"dbs": "ins_discipline_key",
|
||||
"label": L("lcl_key"),
|
||||
"label": "Key",
|
||||
"typ": "key",
|
||||
"required": true,
|
||||
"filter": "exact",
|
||||
@@ -72,7 +71,7 @@ function _model_ctr_discipline()
|
||||
/* Velden van CTR_DISC_PARAMS komen er dynamisch bij */
|
||||
this.disc_params = {
|
||||
model: model_ctr_disc_params,
|
||||
joinfield: "taskdiscipline"
|
||||
joinfield: "ctr_ins_discipline_key"
|
||||
};
|
||||
this.soft_delete = "ins_discipline_verwijder";
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user