9 Commits

Author SHA1 Message Date
Jos Groot Lipman
eef9f77ee7 FSN#52706 revert, verkeerde branch
svn path=/Website/branches/v2016.3/; revision=37444
2018-03-21 13:41:23 +00:00
Jos Groot Lipman
97be2acd04 FSN#52706 bez_bezoekers_opmerking niet wissen als S("vis_remark") readonly aangeeft
svn path=/Website/branches/v2016.3/; revision=37435
2018-03-21 12:42:28 +00:00
Maarten van der Heide
a625193071 Merge naar 2016.3 na per ongeluk inchecken op 2016.2
svn path=/Website/branches/v2016.3/; revision=34360
2017-06-20 07:02:42 +00:00
Arthur Egberink
720dc5b349 YKPN#40922 -- Storingen KPN koppeling met Strukton
svn path=/Website/branches/v2016.3/; revision=34252
2017-06-14 06:42:45 +00:00
Arthur Egberink
5f95221c04 FSN#37813 -- Implementatie PCHW Gemeente Westland
PCHD#33780 -- Inrichting het Gelders Huis


svn path=/Website/branches/v2016.3/; revision=34170
2017-06-08 07:37:08 +00:00
Suzan Wiegerinck
87713227b4 nieuwe klantservers dus nieuwe instellingen voor webdav
svn path=/Website/branches/v2016.3/; revision=34025
2017-05-29 09:48:51 +00:00
Maarten van der Heide
046f6200f1 MNNL#40289 Wijziging bestelopdrachtbon
svn path=/Website/branches/v2016.3/; revision=34020
2017-05-29 09:19:49 +00:00
Dennis Hartmann
ca955f49af svn path=/Website/branches/v2016.3/; revision=33975 2017-05-23 13:00:42 +00:00
Dennis Hartmann
3afd92770f NYBU#40604 witregels/spaties toevoegen
svn path=/Website/branches/v2016.3/; revision=33972
2017-05-23 11:53:13 +00:00
1232 changed files with 17060 additions and 43442 deletions

View File

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

View File

@@ -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));

View File

@@ -72,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++;
}
}

View File

@@ -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>

View File

@@ -117,16 +117,6 @@ else
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>

View File

@@ -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),

View File

@@ -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

View File

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

View File

@@ -53,7 +53,7 @@ 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;
@@ -90,7 +90,7 @@ oRs.Close();
function openMaps(bldKey)
{
fwnd = window.open('../cad/ShowGoogleMap.asp?bld_key=' + bldKey, 'FGShow',
"width=800, height=600, directories=no, location=no, menubar=no,"
"width=640, height=480, directories=no, location=no, menubar=no,"
+ "resizable=yes, status=no, titlebar=yes, toolbar=no");
fwnd.focus()
return;
@@ -161,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();

View File

@@ -46,7 +46,7 @@ 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,7 +87,7 @@ oRs.Close();
function openMaps(locKey)
{
fwnd = window.open('../cad/ShowGoogleMap.asp?loc_key=' + locKey, 'FGShow',
"width=800, height=600, directories=no, location=no, menubar=no,"
"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();

View File

@@ -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();

View File

@@ -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();

View File

@@ -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
View File

@@ -1 +0,0 @@
TESTER

View File

@@ -62,9 +62,6 @@ function API_func()
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+")");

View File

@@ -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" -->

View File

@@ -41,6 +41,8 @@
ts.Close();
}
Session("logging") = API.apidata.loglevel||0;
var xmlReq = Server.CreateObject("MSXML2.DOMDocument.6.0");
xmlReq.load(Request);

View File

@@ -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"

View File

@@ -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&amp;labelPos=2&amp;vKey=<xsl:value-of select="//afspraak/plaats/regio/district/locatie/gebouw/verdieping/key"/>&amp;highlight=<xsl:value-of select="//afspraak/plaats/regio/district/locatie/gebouw/verdieping/ruimte/key"/>&amp;mode=0&amp;discs=981&amp;sizeX=700&amp;sizeY=400&amp;offsetX=10&amp;offsetY=10&amp;scale=950&amp;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);

View File

@@ -1,5 +1,4 @@
<%@ language = "JavaScript" %>
<% Server.ScriptTimeout=6000; %>
<% /*
$Revision$
$Id$

View File

@@ -105,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
@@ -125,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
@@ -133,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)
@@ -203,247 +194,277 @@ 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 });
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)
if (plaats_key != -1)
{
fields.push({ dbs: "mld_alg_onroerendgoed_keys", typ: "key", val: plaats_key });
}
}
if (!alglevel_ok)
{
resultcode = 4;
resulttekst = "Location not found";
__DoLog(resulttekst, "#00FF00");
}
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 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'))";
var oRs = Oracle.Execute(ksql);
if (!oRs.eof)
{
fields.push({ dbs: "mld_alg_onroerendgoed_keys", typ: "key", val: plaats_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();
}
}
if (!alglevel_ok)
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))
{
resultcode = 5;
resulttekst = "Location not found";
__DoLog(resulttekst, "#00FF00");
__DoLog(pResult.errmsg, "#00FF00");
}
var kpn_key = user.afdeling().prs_kostenplaats_key();
if (meld_kpn && meld_kpn != "")
{
var tempKpn = getKpn(meld_kpn);
if (tempKpn != -1)
kpn_key = tempKpn;
}
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 }
]);
// 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))
{
__DoLog(pResult.errmsg, "#00FF00");
}
}
} // end geldige stdmld_key
} // end insert
}
} // end geldige stdmld_key
} // end geldige ext_id
var binfo = {returncode: resultcode,
@@ -467,134 +488,6 @@ 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);
if (API.apidata.stylesheet)

View File

@@ -50,6 +50,9 @@ 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.
@@ -139,7 +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 txt_mut_datum = XMLval(opdrachten[i], "mut_datum"); // UPD
var opdrstatus = XMLval(opdrachten[i], "status"); // UPD
@@ -258,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;

View File

@@ -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" -->

View File

@@ -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,50 +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);
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
@@ -108,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)
@@ -205,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 + "/";

View File

@@ -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">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">&nbsp;
<%
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>

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

View File

@@ -1,444 +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/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:""));
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.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 + ")");
}
}
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.send(data);
if (objXMLHTTP.status >= 200 && objXMLHTTP.status <= 299)
{
return objXMLHTTP;
}
WScript.Echo(objXMLHTTP.responseText);
WScript.Echo(objXMLHTTP.status);
return null;
}

View File

@@ -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>");
}
);

View File

@@ -16,7 +16,7 @@
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++)
@@ -81,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":
@@ -126,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
@@ -147,7 +143,6 @@ api2 = {
break;
case "varchar":
case "memo":
case "html":
filter = "like";
break;
case "date":
@@ -199,7 +194,7 @@ api2 = {
continue;
if (filterval instanceof Array)
{
safe_val = filterval.join(", ");
safe_val = filterval.join(",");
if (typeof filter != 'function')
safe_val = "(" + safe_val + ")";
operand = " IN ";
@@ -235,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"];
@@ -296,12 +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);
var safe_val = parseInt(filterval, 10);
if (isNaN(safe_val))
{
return ["0=1"]; // niets gevonden
@@ -309,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);
@@ -327,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+"%");
@@ -413,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_/))
{
@@ -653,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 &&
@@ -743,8 +712,6 @@ api2 = {
continue;
if (field.readonly)
continue;
if (field.insertonly && !params.isNew)
continue;
if (field.fnval)
var newval = field.fnval(jsondata);
@@ -759,28 +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";
newval = "(SELECT {0} FROM {1} WHERE {2} = {3})".format(field.foreign.key,
field.foreign.tbl,
field.foreign.desc,
safe.quoted_sql(newval.name));
}
}
if (newval && typeof newval == "object" && "id" in newval)
{ // dereference
newval = newval.id;
jsondata[fld] = newval;
}
break;
case "date":
@@ -842,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);
}
}
}
@@ -979,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)
@@ -1037,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)
@@ -1056,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)
@@ -1145,8 +1077,6 @@ api2 = {
var field = model.fields[fld];
if (field.hidden)
continue;
if ("fields" in params.filter && !inArray(fld, params.filter.fields.split(",")))
continue;
var val = api2.sql2jsonval(oRs, fld, model)
//waarom was dit aanwezig?
@@ -1170,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
{
@@ -1228,7 +1148,7 @@ api2 = {
},
error: function (code, msg)
{
abort_with_warning(msg, code);
abort_with_warning(msg, code)
},
find_fieldindex_by_dbsname: function(array, value)
{
@@ -1339,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
@@ -1406,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);
@@ -1459,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
@@ -1470,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"])
@@ -1496,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)
{
@@ -1525,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)
{
@@ -1541,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];
@@ -1560,13 +1442,12 @@ 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)
abort_with_warning(err.friendlyMsg);
var inctrack = api2.process_includes(params, model, jsondata, the_key);
if ("disc_params" in model)
{
// Nu de one-on-one tabel. De eigen sequence daarvan interesseert ons niet
@@ -1577,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);
}
@@ -1594,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)
{
@@ -1605,43 +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;
}
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)
abort_with_warning(err.friendlyMsg);
if (model.trackcode)
shared.trackaction(model.trackcode, the_key, 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 ("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)
abort_with_warning(err.friendlyMsg);
}
var err = Oracle.Execute(xxxUpd.sql, true);
if (err.friendlyMsg)
abort_with_warning(err.friendlyMsg);
}
return { key: the_key, warning: "" };
@@ -1655,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)
{

View File

@@ -1,160 +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/mgt/fac_groep.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_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" },
"issues" : { "filename": "appl/api2/api_issues.asp", "module": "MLD" },
"issuetypes" : { "filename": "appl/api2/api_issuetypes.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/mgt/prs_perslid.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" },
"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" },
"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;
}
%>

View File

@@ -11,7 +11,6 @@
*/
%>
<!-- #include file="api2.inc" -->
<!-- #include file="api2_swagger.inc" -->
<!-- #include file="../scf/scaffolding_common.inc" -->
<%
var DEZE = this;
@@ -27,14 +26,6 @@ api2_rest = {
if (!APIKEY && Session("user_key") > 0)
{
user_key = Session("user_key"); // Hierdoor is de API intern te gebruiken zonder authenticatie
var method = String(Request.ServerVariables("REQUEST_METHOD"));
if (method != "GET") // Vereis dan wel het CSRF token
{
var token = Request.ServerVariables("HTTP_X_CSRF_TOKEN").Count // Meegegeven als X-CSRF-TOKEN
? String(Request.ServerVariables("HTTP_X_CSRF_TOKEN"))
: "";
protectRequest.validateToken(token);
}
}
else
{
@@ -43,7 +34,7 @@ api2_rest = {
else
Session.Abandon(); // Altijd, voor de zekerheid
var sql = "SELECT prs_perslid_key, prs_perslid_naam, prs_perslid_oslogin"
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);
@@ -57,7 +48,7 @@ api2_rest = {
Response.AddHeader("WWW-Authenticate", "Basic realm=\"" + S("basic_auth_realm") + "\"");
Response.End;
};
__Log("API2 User is: {0} ({1})".format(oRs("prs_perslid_naam").Value, oRs("prs_perslid_oslogin").Value));
__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)
@@ -143,20 +134,8 @@ 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
@@ -188,100 +167,61 @@ api2_rest = {
if (/PUT|POST/.test(method)) // Dan is er in de body data meegestuurd
{
if (filter.mode == "attachment" && "custom_fields" in model.includes)
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)
@@ -290,24 +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")
{
var result = model["REST_" + method]( requestparams, key );
}
else if (filter.mode == "attachment" && "custom_fields" in model.includes)
{ // GET/PUT/POST https://xxxx.facilitor.nl/trunk/api2/visitors/99685/attachments/1040/testfile.jpg"
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
@@ -325,44 +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)
{ // TODO
//__DoLog("api_gen_import empty body posted", "#ffff00");
//Response.Write("Error: no data posted for API import");
//Response.End; // Grof maar anders AiAi, dat is nog erger
}
var fileStream = Server.CreateObject("ADODB.Stream");
fileStream.Type = 1; // adTypeBinary eerst nog
fileStream.Open();
fileStream.Write(Request.BinaryRead(bytes));
jsondata["custom_fields"][0]["attachments"][0].datastream = fileStream;
}
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")
{
@@ -371,8 +273,7 @@ api2_rest = {
else if (model.record_name in jsondata) // een enkel record
{
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
@@ -417,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'
@@ -429,12 +330,10 @@ 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
{
@@ -463,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";
@@ -511,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";
@@ -521,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;
@@ -549,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);
@@ -626,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 = '&nbsp;';
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)
@@ -747,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", 0);
for (var i = 0; i < data.length; i++)
arrayElement.appendChild(record2json(data[i], record_name));
xmlDoc.appendChild(arrayElement);
@@ -897,9 +691,8 @@ function RequestJSON()
}
catch (e)
{
result = { error: e.description || (e.message + ": " + e.name) };
__DoLog("JSON eval faalt met: '{0}'\n{1}".format(result, 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 };
}
@@ -978,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]);

View File

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

View File

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

View File

@@ -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" -->

View File

@@ -3,23 +3,23 @@
$Revision$
$Id$
File: api_about.asp
File: api_persons.asp
Description:
Description: PRS_PERSLID API
Parameters:
Context:
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_about.asp";
THIS_FILE = "appl/api/api_persons.asp";
%>
<!-- #include file="../Shared/common.inc" -->
<!-- #include file="./api2_rest.inc" -->
<!-- #include file="../Shared/json2.js" -->
<!-- #include file="./model_about.inc" -->
<!-- #include file="./model_persons.inc" -->
<%
api2_rest.process(model_about);
api2_rest.process(model_persons);
%>

View File

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

View File

@@ -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
}
}
%>

View File

@@ -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?
}
}
%>

View File

@@ -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
}
};

View File

@@ -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",

View File

@@ -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" }

View File

@@ -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";

View File

@@ -1,85 +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 = "WEB_FACFAC";
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"
},
"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
}
/* ,
"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);
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);
}
}
%>

View File

@@ -1,110 +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 = "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"
}
},
"device_id": {
"dbs": "aut_client_perslid_device_id",
"label": L("aut_client_perslid_device"),
"typ": "varchar",
"filter": "exact"
},
"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"]
};
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);
}
}
%>

View File

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

View File

@@ -1,110 +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")
// De foreign's
+ ";20;" + L("lcl_prs_person_function")
+ ";21;" + L("lcl_prs_organisatie")
//+ 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);
}
%>

View File

@@ -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"
@@ -158,12 +151,12 @@ model_bes_disc_params =
"LOV": L("bes_discipline_freeartikelLOV"),
"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",
@@ -173,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",
@@ -218,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",
@@ -248,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",
@@ -261,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",

View File

@@ -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"
}

View File

@@ -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",

View File

@@ -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",

View File

@@ -13,32 +13,31 @@
%>
<%
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": {
@@ -48,7 +47,7 @@ function model_bes_kenmerk(params)
},
"filter": "exact"
},
"orderpropertytype": {
"property_key": {
"dbs": "bes_srtkenmerk_key",
"label": L("mgt_srtkenmerk_key"),
"typ": "key",
@@ -68,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",
@@ -80,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",
@@ -91,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",
@@ -111,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",
@@ -124,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",
@@ -139,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",
@@ -158,7 +157,7 @@ function model_bes_kenmerk(params)
"filter": "like",
"defaultvalue": null
},
"regexp": {
"property_regexp": {
"dbs": "bes_kenmerk_regexp",
"label": L("mgt_kenmerk_regexp"),
"typ": "varchar"
@@ -166,43 +165,6 @@ function model_bes_kenmerk(params)
};
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"
+ " , S.bes_srtkenmerk_omschrijving"
@@ -236,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, {});
}
%>

View File

@@ -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": [

View File

@@ -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": ""
}

View File

@@ -15,20 +15,20 @@
function model_bes_srtkenmerk()
{
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 = "WEB_BESMGT";
this.record_title = L("bes_srtkenmerk");
this.records_title = L("bes_srtkenmerk_m");
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",
@@ -42,7 +42,7 @@ function model_bes_srtkenmerk()
"translate": true,
"filter": "like"
},
"attributetype": {
"property_type": {
"dbs": "bes_srtkenmerk_kenmerktype",
"label": L("mgt_srtkenmerk_kenmerktype"),
"typ": "varchar",
@@ -86,22 +86,9 @@ function model_bes_srtkenmerk()
};
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, {});
}
%>

View File

@@ -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",

View File

@@ -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"

View File

@@ -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
}
};

View File

@@ -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",

View File

@@ -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",
@@ -121,7 +120,7 @@ function model_bez_kenmerk(params)
"filter": "exact",
"LOVinit": ""
},
"propertydefault": {
"default": {
"dbs": "bez_kenmerk_default",
"label": L("mgt_kenmerk_default"),
"typ": "memo",
@@ -135,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, {});
}
%>

View File

@@ -1,194 +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" -->
<%
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(),
"emptyoption": null
},
"budgetproject": {
"dbs": "bgt_project_key",
"label": L("bgt_project_omschrijving"),
"typ": "key",
"required": true,
"insertonly": true,
"foreign": bgt_budgetproject_foreign(),
"emptyoption": null
},
"budgetcostcategory": {
"dbs": "bgt_kostenrubriek_key",
"label": L("bgt_kostenrubriek_oms"),
"typ": "key",
"required": false,
"insertonly": true,
"foreign": bgt_budgetcostcategory_foreign()
},
"costtypegroup": {
"dbs": "prs_kostensoortgrp_key",
"label": L("prs_kostensoortgrp_key"),
"typ": "key",
"required": false,
"insertonly": true,
"foreign": bgt_costtypegroup_foreign(),
"LOVinit": "",
"filter": "exact"
},
"costtype": {
"dbs": "prs_kostensoort_key",
"label": L("prs_kostensoort_key"),
"typ": "key",
"required": false,
"insertonly": true,
"foreign": bgt_costtype_foreign()
},
"amountoriginal": {
"dbs": "bgt_budget_bedrag_origineel",
"sql": "(BGT.getBudgetOpDatum(bgt_budget.bgt_budget_key, NULL))",
"label": L("bgt_budget_origineel"),
"typ": "float",
"iscurrency": true,
"total": true
},
"amountmutation": {
"dbs": "bgt_budget_bedrag_mutatie",
"sql": "(BGT.getBudgetMutaties(bgt_budget.bgt_budget_key, NULL, NULL))",
"label": L("bgt_budget_mutaties"),
"typ": "float",
"iscurrency": true,
"total": true
},
"amount": {
"dbs": "bgt_budget_bedrag",
"label": L("bgt_budget_bedrag"),
"typ": "float",
"iscurrency": true,
"total": true,
"required": true
},
"vat": {
"dbs": "bgt_budget_btwbedrag",
"label": L("bgt_budget_btwbedrag"),
"typ": "float",
"iscurrency": true,
"total": true,
"required": true
},
"contingency": {
"dbs": "bgt_budget_isreserve",
"label": L("bgt_budget_isreserve"),
"typ": "check0",
"defaultvalue": 0
},
"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
},
"account": {
"dbs": "prs_kostenplaats_key",
"label": L("bgt_budget_account"),
"typ": "key",
"foreign": {
"tbl": "prs_kostenplaats",
"key": "prs_kostenplaats_key",
"desc": "prs_kostenplaats_nr"
}
}
};
this.edit = {
// "modal": true
};
this.list = {
"columns": [
"budgetcostcategory",
"costtypegroup",
"costtype",
"amount",
"vat"
]
};
this.hook_pre_edit = function (obj, fld)
{
if (obj.id > -1)
{
fld.amount.readonly = true;
fld.vat.readonly = true;
}
}
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.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);
}
%>

View File

@@ -1,229 +0,0 @@
<% /*
$Revision$
$Id$
File: model_bgt_budgetmutatie.inc
Description: Model voor bgt_budgetmutatie
Context:
Notes:
*/
%>
<%
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(+)"
+ " 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
},
"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
},
"amountdifference": {
"dbs": "bgt_budget_bedrag_verschil",
"sql": "COALESCE(bgt_budget_bedrag_van, 0) + COALESCE(bgt_budget_bedrag_naar, 0)",
"label": L("bgt_budgetmutatie"),
"typ": "float",
"iscurrency": true,
"total": true
}
};
this.edit = {
"modal": true
};
this.list = {
"columns": [
"mutationdate",
"name",
"budgetfrom",
"budgetto",
"amountto",
"amountdifference"
]
};
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")));
}
var budget_key = getQParamInt("budgetcommon", -1);
if (budget_key > -1)
{
this.REST_GET = generic_REST_GET(this, {
"GET": {
"wheres": ["bgt_budget_key_van = {0} or bgt_budget_key_naar = {0}".format(budget_key)]
}
});
}
else
{
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);
}
%>

View File

@@ -1,56 +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_BGTMAN",
"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"
}
}
}
api2.generic_REST(model_bgt_disc_params);
%>

View File

@@ -1,94 +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_BGTMAN";
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"
}
};
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"
};
}
%>

View File

@@ -1,71 +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"
}
},
"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);
}
%>

View File

@@ -1,110 +0,0 @@
<% /*
$Revision$
$Id$
File: model_bgt_project.inc
Description: Model voor bgt_project
Context:
Notes:
*/
%>
<!-- #include file="../api2/model_bgt_kostenrubriek.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"
}
},
"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"
},
"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": {
"tbl": "prs_kostenplaats",
"key": "prs_kostenplaats_key",
"desc": "prs_kostenplaats_nr"
}
},
"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"};
// 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);
}
%>

View File

@@ -13,57 +13,33 @@
%>
<!-- #include file="../Shared/discxalg3d.inc"-->
<!-- #include file="./model_custom_fields.inc"-->
<!-- #include file="../mgt/mgt_tools.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(", ")
@@ -71,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 */
{
}
}
%>

View File

@@ -11,15 +11,14 @@
Notes:
*/
%>
<!-- #include file="../mgt/mgt_tools.inc" -->
<%
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");
@@ -28,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",
@@ -40,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",
@@ -50,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",
@@ -139,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"
@@ -167,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");
}
}
%>

View File

@@ -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);

View File

@@ -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"

View File

@@ -11,15 +11,14 @@
Notes: TODO: JGL: Ik ben er nog niet helemaal uit hoe de bitjes netjes op te lossen
*/
%>
<!-- #include file="../mgt/mgt_tools.inc" -->
<%
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");
@@ -28,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",
@@ -41,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",
@@ -58,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",
@@ -152,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",
@@ -173,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"
@@ -196,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");
}
}
%>

View File

@@ -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"

View File

@@ -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"
}
}
%>

View File

@@ -13,30 +13,29 @@
%>
<%
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",
@@ -55,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",
@@ -63,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",
@@ -80,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",
@@ -94,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",
@@ -107,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",
@@ -120,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,16 +139,6 @@ function model_cnt_kenmerk(params)
};
this.hook_pre_edit = function (obj, fld)
{
%>
<script type="text/javascript">
var module = "CNT";
</script>
<%
}
this.REST_GET = generic_REST_GET(this, {
"GET": {
"tables": [ "cnt_srtkenmerk"],

View File

@@ -15,20 +15,20 @@
function model_cnt_srtkenmerk()
{
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 = "WEB_CNTMGT";
this.record_title = L("cnt_srtkenmerk");
this.records_title = L("cnt_srtkenmerk_m");
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",
@@ -42,7 +42,7 @@ function model_cnt_srtkenmerk()
"required": true,
"filter": "like"
},
"attributetype": {
"property_type": {
"dbs": "cnt_srtkenmerk_kenmerktype",
"label": L("mgt_srtkenmerk_kenmerktype"),
"typ": "varchar",
@@ -92,18 +92,6 @@ function model_cnt_srtkenmerk()
};
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);

View File

@@ -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",

View File

@@ -13,8 +13,6 @@
%>
<!-- #include file="../prs/prs.inc" -->
<!-- #include file="./model_custom_fields.inc"-->
<!-- #include file="../mgt/mgt_tools.inc"-->
<!-- #include file="./model_prs_kenmerk.inc"-->
<%
function model_companies()
@@ -59,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"
}
};

View File

@@ -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(),

View File

@@ -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",

View File

@@ -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";
}

View File

@@ -5,15 +5,10 @@
File: model_custom_fields.inc
Description: Flexkenmerken model
Context: Er is g<><67>n eigen api_custom_fields
We kunnen alleen via een include van een parent die dan ook
vooral alle autorisatiecontrole voor ons kan verzorgen
Notes: Voor de GET gebruiken we getSqlFlex uit resultset_flex
Lekker gemakkelijk hoewel hij niet 100% de volgnummer beperkingen volgt
Voor de PUT/POST/DELETE gebruiken we de functies van PACKAGE flx
Parameters:
Context:
Notes:
*/
%>
@@ -23,124 +18,67 @@
function model_custom_fields(formodel, flexModule, flexParams)
{
var flexModel = null; // alleen nog niet bij issues
if (typeof flexModule != "string")
{
flexModel = flexModule;
flexModule = flexModel.module;
}
flexParams = flexParams || {};
this.module = flexModule;
this.records_name = "custom_fields";
this.record_name = "custom_field";
this.table = "flex";
this.primary = "kenmerk_key";
this.records_title = L("custom_field_m");
this.record_title = L("custom_field");
this.keyfield = "propertyid"; // api2/process_includes werkt nu iets anders
flexParams = flexParams || {};
this.module = flexModule;
this.table = "flex";
this.primary = "kenmerk_key";
this.records_name = "custom_fields";
this.record_name = "custom_field";
// this.records_title = L("lcl_orders");
// this.record_title = L("lcl_opdr_info");
// getSqlFlex heeft bij multi-language 'user' al nodig voor de lcl's
// daarom hieronder een indirecte/ delayed fntablesql
this.fntablesql = function _fntablesql()
{
var theSqlFlex = getSqlFlex(flexModule, formodel.primary, flexParams);
var custom_fields = getQParamIntArray("custom_fields", []);
if (custom_fields.length)
theSqlFlex = "SELECT * FROM ({0}) WHERE kenmerk_key IN ({1})".format(theSqlFlex, custom_fields.join(", "))
return "(" + theSqlFlex + ") flex";
}
this.fields = {
// De echte unieke waarde "id" is bez_kenmerkwaarde_key.
// We doen echter alles op basis van de samengestelde kenmerk_key + parent_key
// De naam van dat veld weten we hier even niet echter
// en hebben we ook niet nodig
"propertyid": {
"dbs": "kenmerk_key",
"label": L("lcl_key"),
"typ": "key"
},
"value": {
"dbs": "waarde",
"label": L("lcl_fac_value"),
"typ": "varchar"
},
"type": {
"dbs": "kenmerktype",
"label": L("mgt_srtkenmerk_kenmerktype"),
"typ": "varchar"
},
"sequence": {
"dbs": "volgnummer",
"label": L("mgt_kenmerk_volgnummer"),
"typ": "number" },
"label": {
"dbs": "omschrijving",
"label": L("mgt_srtkenmerk_label"),
"typ": "varchar"
},
"flexparentkey": {
"dbs": "flexparentkey",
"typ": "key"
},
// TODO: record.flexparentid wordt er uitgestript vanwege niet teruglinken naar de parent
// we hebben hem echter wel nodig. Dit moet beter....
"xflexparentkey": {
"dbs": "flexparentkey",
"typ": "key",
"sql": "flexparentkey"
}
};
this.fields =
{ "id": { dbs: "kenmerk_key", typ: "key" }, // TODO: dit klopt niet helemaal. De echte unieke waarde is bez_kenmerkwaarde_key
"value": { dbs: "waarde", typ: "varchar" },
"type": { dbs: "kenmerktype", typ: "varchar" },
"sequence": { dbs: "volgnummer", typ: "number" },
"label": { dbs: "omschrijving", typ: "varchar" },
"flexparentkey": { dbs: "flexparentkey", typ: "key" },
// TODO: record.flexparentid wordt er uitgestript vanwege niet teruglinken naar de parent
// we hebben hem echter wel nodig. Dit moet beter....
"xflexparentkey": { dbs: "xflexparentkey", typ: "key", sql: "flexparentkey" }
};
// Deze functie wordt na de GET aangeroepen. De bijlagen zijn zo afwijkend
// dat ik dat niet fatsoenlijk in 'fields' verwerkt kreeg
this.post_get = function (params, record)
this.post_get = function (record)
{
if (record.type == 'F' || record.type == 'M')
{
var flexparam = flexProps(flexModule, record.xflexparentkey, String(record.propertyid), flexParams.pNiveau,
{ getFiles: true, getFileEncoded: params.filter.fileencoding, api2name: formodel.records_name });
var flexparam = flexProps(flexModule, record.xflexparentkey, String(record.id), flexParams.pNiveau,
{ getFiles: true, api2name: formodel.records_name });
record.attachments = [];
for (var f in flexparam.files)
{
var file = flexparam.files[f];
var attachment = { name: file.name,
date: file.date,
size: file.size,
content_url: file.deepurl,
digest: file.digest };
switch (params.filter.fileencoding) // De enige twee encodings die we ondersteunen
{
case "base64":
attachment.content_base64 = file.data;
break;
case "hex":
attachment.content_hex = file.data;
break;
}
record.attachments.push(attachment);
record.attachments.push({ name: file.name,
date: file.date,
size: file.size,
content_url: file.deepurl,
digest: file.digest })
};
}
delete record["xflexparentkey"]; // nu niet meer nodig
}
// Voor flexbijlagen kennen we een duale interface
// Enerzijds zitten ze gewoon als attachements-object in de JSON
// die een GET van custom_fields oplevert
// Anderzijds zijn ze met GET/PUT/POST/DELETE rechtstreeks te benaderen onder
// /api2/visitors/1234/attachments/1000/test.jpg
this.streamattachment = function(filter, flexfields)
{
for (var fid in flexfields)
{
if (flexfields[fid].propertyid == filter.subfolder && flexfields[fid].attachments)
if (flexfields[fid].id == filter.subfolder && flexfields[fid].attachments)
{
for (var i = 0; i < flexfields[fid].attachments.length; i++)
{
var att = flexfields[fid].attachments[i];
if (att.name.toLowerCase() == filter.filename.toLowerCase()) // Gevonden!!!!
{
var params = flexProps(this.module, filter.id, filter.subfolder, flexParams.pNiveau);
params = flexProps(this.module, filter.id, filter.subfolder, flexParams.pNiveau);
// In de praktijk (b)lijkt IE de ETag niet te sturen voor downloads
// maar wij ondersteunen het in ieder geval wel.
var eTag = '"' + att.digest + '"';
@@ -161,104 +99,36 @@ function model_custom_fields(formodel, flexModule, flexParams)
Response.Status = "404 Not Found";
}
if (flexModel) // nog even niet voor MLD
this.REST_PUT = function (params, jsondata, the_key, parent_key) /* update custom_field */
{ // Let op: parameter the_key is de kenmerk_key, niet een een kenmerkwaarde_key
// Merk op dat flexProps ook wel het type oplevert. Ik wil echter migreren naar modellen
var kenmerkdata = api2.GET(flexModel, jsondata.propertyid);
// TODO: if (!kenmerkdata) en rechtencontrole
var typ = kenmerkdata.attributetype.id;
if (typ == 'F' || typ == 'M')
{
var flexparams = flexProps(this.module, parent_key, the_key, flexParams.pNiveau);
// TODO: bij type F zorgen dat er <20><>n file overblijft
for (var i = 0; i < jsondata.attachments.length; i++)
{
var attachment = jsondata.attachments[i];
var safefilename = safe.filename(attachment.name);
if (flexparams.isAllowedName(safefilename))
{
CreateFullPath(flexparams.AttachPath);
if ("datastream" in attachment) // PUT op /api2/visitors/1234/attachments/1000/test.jpg
{
attachment.datastream.SaveToFile(flexparams.AttachPath + safefilename, 2); // adSaveCreateOverWrite
}
else if ("content_base64" in attachment || "content_hex" in attachment)
{
var fileencoding = "content_base64" in attachment?"bin.base64":"bin.hex";
encodedString2File(flexparams.AttachPath + safefilename,
attachment.content_base64 || attachment.content_hex,
fileencoding);
}
}
else
{
Response.Status = "422 Unprocessable Entity";
Response.End;
}
}
}
if (typ != "M")
{
var sql = "BEGIN flx.setflex({0}".format(safe.quoted_sql(this.module))
+ " , {0}".format(the_key) // == jsondata.propertyid
+ " , {0}".format(parent_key)
+ " , {0}".format(safe.quoted_sql(flexParams.pNiveau))
+ " , {0});".format(safe.quoted_sql(jsondata.value))
+ "END;"
Oracle.Execute(sql);
}
}
if (flexModel) // nog even niet voor MLD
this.REST_POST = function (params, jsondata, parent_key) /* add custom_field */
{ // Voor flexvelden is er geen verschil tusen 'toevoegen' en 'bijwerken'
this.REST_PUT(params, jsondata, jsondata.propertyid, parent_key);
}
this.disabled_REST_DELETE = function (params, the_key) /* remove custom_field */
{
// custom_fields zijn ietwat afwijkend
// 'verwijderen' doe je door de waarde op NULL te zetten (net zoals met vaste velden)
// Anders loop je risico dat bij een update velden die niet in de include=custom_fields
// zitten (omdat je er gewoon geen rechten op had) zo maar verwijderd worden
// TODO: flexfiles wel kunnen deleten
}
this.list = { columns: ["propertyid", "label", "value"] }
this.list = { columns: ["id", "label", "value"] }
// Merk op: g<><67>n eigen REST_GET
// We werken toch alleen via een include van een parent die dan ook
// We kunnen alleen via een include van een parent die dan ook
// vooral alle autorisatiecontrole voor ons kan verzorgen
// this.REST_GET = generic_REST_GET(this, {});
}
function set_custom_field(jsondata, kenmerk_key, val, typ)
{
if (!("custom_fields" in jsondata))
jsondata.custom_fields = [];
for (var i=0; i< jsondata.custom_fields.length; i++)
{
if (jsondata.custom_fields[i].propertyid == kenmerk_key)
if (jsondata.custom_fields[i].id == kenmerk_key)
{
jsondata.custom_fields[i].value = val;
return; // direct klaar
}
}
// JGL: is het volgende wel nodig? Opdrachten gingen via saveFlexKenmerken maar dat is achterhaald?
if (!typ)
abort_with_warning("Cannot set_custom_field key '{0}' without type".format(kenmerk_key));
jsondata.custom_fields.push({ propertyid: kenmerk_key, value: val, type: typ });
jsondata.custom_fields.push({ id: kenmerk_key, value: val, type: typ });
}
function get_custom_field(jsondata, kenmerk_key)
{
if (!("custom_fields" in jsondata))
return null;
for (var i=0; i< jsondata.custom_fields.length; i++)
{
if (jsondata.custom_fields[i].propertyid == kenmerk_key)
if (jsondata.custom_fields[i].id == kenmerk_key)
{
return jsondata.custom_fields[i].value; // direct klaar
}

View File

@@ -0,0 +1,12 @@
<% /*
$Revision$
$Id$
File: model_departments.inc
Description: department model.
Parameters:
Context:
Notes:
*/

View File

@@ -6,10 +6,9 @@
Description: Doc model.
Parameters:
Context: Dit bestand loopt 1-op-1 met model_doc.xsl
(Alleen) wat je hier in this stopt kun je opvragen
Context:
Notes: Met trunk/api2/doc.doc?debug=1 kun je eventueel de XML bekijken
Notes:
*/
%>
@@ -24,16 +23,10 @@ function model_doc()
this.autfunction = "WEB_APIDOC";
var apis = model_apis.REST_GET({});
// Met XSLT 1.0 kun je niet lekker groeperen (op modulenaam) dus
// maar gewoon hier in JavaScript
this.modules = { };
this.fields = {};
for (var i = 0; i < apis.length; i++)
{
var modulecode = apis[i].modulecode || "XXX";
if (!(modulecode in this.modules))
this.modules[modulecode] = { name: apis[i].module, apis: { } };
this.modules[modulecode].apis[ apis[i].id ] = { label: apis[i].name };
this.fields[ apis[i].id ] = { label: apis[i].id };
}
this.REST_GET = generic_REST_GET(this, {});

View File

@@ -7,30 +7,20 @@
<html>
<head>
<link rel="stylesheet" type="text/css" href="../appl/api2/reference.css?"/>
<title>FACILITOR&#174; API reference</title>
</head>
<body>
<h1>FACILITOR&#174; API reference</h1>
<xsl:for-each select="/api/modules/*">
<xsl:sort select="name" />
<h2><xsl:value-of select="name"/></h2>
<xsl:element name="ul">
<xsl:for-each select="apis/*">
<xsl:sort select="local-name()" />
<xsl:element name="li">
&#xA0;<xsl:element name="a">
<xsl:attribute name="href">../api2/<xsl:value-of select="local-name()"/>.doc</xsl:attribute>
<xsl:value-of select="local-name()"/>
</xsl:element>
&#xA0;<span class='apidesc'><xsl:value-of select="label"/></span>
</xsl:element>
</xsl:for-each>
<xsl:element name="ul">
<xsl:for-each select="/api/fields/*">
<xsl:element name="li">
<xsl:element name="a">
<xsl:attribute name="href">../api2/<xsl:value-of select="local-name()"/>.doc</xsl:attribute>
<xsl:value-of select="local-name()"/>
</xsl:element>
</xsl:element>
</xsl:for-each>
<p>&#169; <a href="https://facilitor.nl">Facilitor BV</a>, the Netherlands. Use of the FACILITOR API is restricted by the FACILITOR-API regulations.</p>
</xsl:element>
<p>&#169; <a href="http://facilitor.nl">Facilitor BV</a>, the Netherlands. Use of the FACILITOR API is restricted by the FACILITOR-API regulations.</p>
<p>Technical support: +31 53 4800 710 or <a href="mailto:helpdesk@facilitor.nl">helpdesk@facilitor.nl</a></p>
</body>
</html>

View File

@@ -1,120 +0,0 @@
<% /*
$Revision$
$Id$
File: model_fac_audit.inc
Description:
Notes:
*/
function model_fac_audit()
{
this.records_name = "audits";
this.record_name = "audit";
this.table = "fac_audit";
this.primary = "fac_audit_key";
this.autfunction = "WEB_PRSSYS";
this.record_title = L("fac_audit");
this.records_title = L("fac_audit_m");
this.autolcl = function (lcl) // TODO: Kan dit niet gewoon als foreign of is de COALESCE dan een probleem?
{
return "COALESCE ((SELECT 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 = REPLACE(" + lcl + ", 'disc_params', 'discipline'))," // TODO: deze replace pakt voor cnt goed uit. Ook voor de rest?
+ " '<'||" + lcl + "||'>')";
};
this.fields = {
"id": {
"dbs": "fac_audit_key",
"label": L("lcl_key"),
"typ": "key",
"seq": "fac_s_fac_audit_key",
"orderby": " DESC" // eigenlijk altijd nieuwste bovenaan
},
"table": {
"dbs": "fac_audit_tabelnaam",
"label": L("fac_audit_tabelnaam"),
// filtert niet lekker meer "sql": this.autolcl("fac_audit_tabelnaam"),
"typ": "varchar",
"readonly": true
},
"record": {
"dbs": "fac_audit_tabelkey",
"label": L("fac_audit_tabelkey"),
"typ": "key",
"readonly": true
},
"column": {
"dbs": "fac_audit_veldnaam",
"label": L("fac_audit_veldnaam"),
"sql": this.autolcl("fac_audit_veldnaam"),
"typ": "varchar",
"readonly": true
},
"type": {
"dbs": "fac_audit_actie",
"label": L("fac_audit_actie"),
"typ": "varchar",
"readonly": true,
"LOV": L("fac_audit_actieLOV")
},
"old": {
"dbs": "fac_audit_waarde_oud",
"label": L("fac_audit_waarde_oud"),
"typ": "varchar",
"readonly": true
},
"new": {
"dbs": "fac_audit_waarde_nieuw",
"label": L("fac_audit_waarde_nieuw"),
"typ": "varchar",
"readonly": true
},
"person": {
"dbs": "prs_perslid_key",
"label": L("lcl_lcl_naam"),
"typ": "key",
"foreign": "prs_perslid",
"readonly": true
},
"description": {
"dbs": "fac_audit_opmerking",
"typ": "memo",
"label": L("fac_audit_opmerking")
},
"date": {
"dbs": "fac_audit_datum",
"label": L("lcl_date"),
"typ": "datetime",
"readonly": true
}
}
// Voor de include (ongebruikt)
this.list = {
"columns": [
"id",
"date",
"type",
"column",
"old",
"new",
"person",
"description"
]
};
this.edit = {
"modal": 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);
}
%>

View File

@@ -13,12 +13,12 @@
%>
<%
function model_fac_email_setting()
function fac_email_setting()
{
this.records_name = "emailsettings";
this.record_name = "emailsetting";
this.table = "fac_email_setting";
this.primary = "fac_email_setting_key";
this.records_name = "emailsettings";
this.record_name = "emailsetting";
this.autfunction = "WEB_FACTAB";
this.record_title = L("fac_email_setting");
this.records_title = L("fac_email_setting_m");
@@ -26,7 +26,7 @@ function model_fac_email_setting()
this.fields = {
"id": {
"dbs": "fac_email_setting_key",
"label": L("lcl_key"),
"label": "Key",
"typ": "key",
"required": true,
"filter": "exact",

View File

@@ -15,10 +15,10 @@
function model_fac_export_app()
{
this.records_name = "exportfunctions";
this.record_name = "exportfunction";
this.table = "fac_export_app";
this.primary = "fac_export_app_key";
this.records_name = "fac_export_apps";
this.record_name = "fac_export_app";
this.autfunction = "WEB_PRSSYS";
this.record_title = L("fac_export_app");
this.records_title = L("fac_export_app_m");
@@ -27,7 +27,7 @@ function model_fac_export_app()
this.fields = {
"id": {
"dbs": "fac_export_app_key",
"label": L("lcl_key"),
"label": "Key",
"typ": "key",
"required": true,
"filter": "exact",

View File

@@ -18,15 +18,11 @@
function model_fac_functie (functie_key, params)
{
this.records_name = "authorizationfunctions";
this.record_name = "authorizationfunction";
this.table = "fac_functie";
this.primary = "fac_functie_key";
this.autfunction = "WEB_PRSMSU";
this.record_title = L("fac_functie");
this.records_title = L("fac_functie_m");
this.records_name = "fac_functies";
this.record_name = "fac_functie";
this.module = null;
if (params.disc_key > 0)
{
var sql = "SELECT ins_discipline_module FROM ins_tab_discipline WHERE ins_discipline_key = " + params.disc_key;
@@ -34,77 +30,74 @@ function model_fac_functie (functie_key, params)
this.module = oRs("ins_discipline_module").Value;
oRs.Close();
}
this.fields = {
"id": {
"dbs": "fac_functie_key",
"label": L("lcl_key"),
"typ": "key",
"required": true,
"seq": "fac_s_fac_functie_key"
"dbs": "fac_functie_key",
"label": "Key",
"typ": "key",
"required": true,
"seq": "fac_s_fac_functie_key"
},
"module": {
"dbs": "fac_functie_module",
"label": L("fac_functie_module"),
"readonly": true,
"typ": "varchar",
"filterdefault": this.module?":!"+this.module:null,
"showfixedfilter": true,
"foreign": {
"tbl": "fac_module",
"key": "fac_module_name",
"desc": "fac_module_name || ' - ' || lcl.l(fac_module_remark)"
}
"dbs": "fac_functie_module",
"label": L("fac_functie_module"),
"readonly": true,
"typ": "varchar",
"filterdefault": this.module?":!"+this.module:null,
"showfixedfilter": true,
"foreign": {
"tbl": "fac_module",
"key": "fac_module_name",
"desc": "fac_module_name || ' - ' || lcl.l(fac_module_remark)"
}
},
"name": {
"dbs": "fac_functie_code",
"label": L("fac_functie_code"),
"readonly": true,
"typ": "varchar"
"dbs": "fac_functie_code",
"label": L("fac_functie_code"),
"readonly": true,
"typ": "varchar"
},
"sequence": {
"dbs": "fac_functie_volgnr",
"label": L("fac_functie_volgnr"),
"readonly": !user || !user.has("WEB_FACFAC"),
"typ": "number"
"_sorter": {
"dbs": "CASE WHEN SUBSTR(fac_functie_code, 8, 3) IN ('USE', 'FOF', 'BOF', 'BAC') AND SUBSTR(fac_functie_code, 5, 3) NOT IN ('UUR') THEN 0 ELSE 1 END",
"readonly": true,
"typ": "number"
},
"level": {
"dbs": "fac_functie_min_level",
"label": L("fac_functie_min_level"),
"readonly": true,
"typ": "number",
"LOV": L("fac_functie_min_levelLOV"),
"hidden_fld": true
"dbs": "fac_functie_min_level",
"label": L("fac_functie_min_level"),
"readonly": true,
"typ": "number",
"LOV": L("fac_functie_min_levelLOV"),
"hidden_fld": true
},
"discipline": {
"dbs": "fac_functie_discipline",
"label": L("fac_functie_discipline"),
"readonly": true,
"typ": "number",
"LOV": L("fac_functie_disciplineLOV"),
"hidden_fld": true
"dbs": "fac_functie_discipline",
"label": L("fac_functie_discipline"),
"readonly": true,
"typ": "number",
"LOV": L("fac_functie_disciplineLOV"),
"hidden_fld": true
},
"group": {
"dbs": "fac_functie_groep",
"label": L("fac_functie_groep"),
"readonly": true,
"typ": "number",
"LOV": L("fac_functie_groepLOV"),
"hidden_fld": true
"dbs": "fac_functie_groep",
"label": L("fac_functie_groep"),
"readonly": true,
"typ": "number",
"LOV": L("fac_functie_groepLOV"),
"hidden_fld": true
},
"description": {
"dbs": "fac_functie_omschrijving",
"label": L("fac_functie_omschrijving"),
"typ": "varchar",
"required": true,
"islcl": true
"dbs": "fac_functie_omschrijving",
"label": L("fac_functie_omschrijving"),
"typ": "varchar",
"required": true,
"islcl": true
},
"info": {
"dbs": "fac_functie_info",
"label": L("fac_functie_info"),
"typ": "memo",
"islcl": true
"dbs": "fac_functie_info",
"label": L("fac_functie_info"),
"typ": "memo",
"islcl": true
}
};
@@ -112,11 +105,15 @@ function model_fac_functie (functie_key, params)
{
this.includes = {"authorization":
{ "model": new model_fac_groeprechten(params),
"joinfield": "authorization",
"joinfield": "fac_functie",
"outertoggle": { def: false, lbl: L("fac_gebruiker_outerfunctie") }
}};
}
this.autfunction = "WEB_PRSMSU";
this.record_title = L("fac_functie");
this.records_title = L("fac_functie_m");
var xparams = { GET: { wheres: [] } }
if (params.disc_key > 0)
{
@@ -124,7 +121,7 @@ function model_fac_functie (functie_key, params)
"fac_functie_discipline = 1" // dan ook alleen de discipline gebonden functies
);
}
if (!user || !user.has("WEB_FACFAC"))
if (!user.has("WEB_FACFAC"))
{
xparams.GET.wheres.push("fac_functie_code NOT IN ('WEB_FACFAC', 'WEB_FACTAB')");
}

View File

@@ -16,26 +16,22 @@
function model_fac_gebruikersgroep()
{
this.records_name = "usergroup";
this.record_name = "usergroups";
this.table = "fac_gebruikersgroep";
this.primary = "fac_gebruikersgroep_key";
this.autfunction = "WEB_PRSMSU";
this.record_title = L("fac_gebruikersgroep");
this.records_title = L("fac_gebruikersgroep_m");
this.records_name = "usergroup";
this.record_name = "usergroups";
this.fields = {
"id": {
"dbs": "fac_gebruikersgroep_key",
"label": L("lcl_key"),
"label": "Key",
"typ": "key",
"hidden_fld": true,
"required": true,
"filter": "exact",
"seq": "fac_s_fac_gebruikersgroep_key"
},
"authorizationgroup": {
"fac_groep": {
"dbs": "fac_groep_key",
"label": L("fac_groep"),
"typ": "key",
@@ -45,29 +41,31 @@ function model_fac_gebruikersgroep()
"key": "fac_groep_key",
"desc": "fac_groep_omschrijving"
},
"uniquewith": "person"
"uniquewith": "user"
},
"person": {
"user": {
"dbs": "prs_perslid_key",
"label": L("prs_perslid"),
"typ": "key",
"required": true,
"foreign": "prs_perslid",
"uniquewith": "authorizationgroup"
"foreign": "PRS_PERSLID",
"uniquewith": "fac_groep"
}
};
this.list = {
"columns": [
//"id",
"authorizationgroup",
"person"
"fac_groep",
"user"
]
};
this.edit = {
modal: true
};
this.autfunction = "WEB_PRSMSU";
this.record_title = L("fac_gebruikersgroep");
this.records_title = L("fac_gebruikersgroep_m");
// Lidmaatschap van groepen met PRSSYS, FACTAB en FACFAC mag je alleen
// manipuleren als je zelf die rechten hebt
@@ -97,7 +95,7 @@ function model_fac_gebruikersgroep()
this.REST_GET = generic_REST_GET(this);
this.REST_POST = function (params, jsondata)
{
this._checkprotected(jsondata.authorizationgroup);
this._checkprotected(jsondata.fac_groep);
return generic_REST_POST(this)(params, jsondata);
}
// this.REST_PUT = generic_REST_PUT(this); // updated is wat overkill

View File

@@ -17,26 +17,14 @@
function model_fac_groep(groep_key, params)
{
this.records_name = "authorizationgroups";
this.record_name = "authorizationgroup";
this.table = "fac_groep";
this.audit = { // Parameters voor fac_audit.
"childtable": "fac_groeprechten",
"childaudit": {"sql": "SELECT fac_groeprechten_key"
+ " FROM fac_groeprechten"
+ " WHERE fac_groep_key IN ({0})",
"key": "fac_groeprechten_key"
}
};
this.primary = "fac_groep_key";
this.autfunction = "WEB_FACMSU";
this.record_title = L("fac_groep");
this.records_title = L("fac_groep_m");
this.records_name = "fac_groeps";
this.record_name = "fac_groep";
this.fields = {
"id": {
"dbs": "fac_groep_key",
"label": L("lcl_key"),
"label": "Key",
"typ": "key",
"required": true,
"seq": "fac_s_fac_groep_key"
@@ -57,7 +45,7 @@ function model_fac_groep(groep_key, params)
"label": L("lcl_prs_substitutes"),
"typ": "check0"
},
"membercount": {
"nn_leden": {
"dbs": "nn_leden",
"sql": "(SELECT COUNT(*) FROM fac_gebruikersgroep WHERE fac_groep.fac_groep_key = fac_gebruikersgroep.fac_groep_key)",
"label": L("fac_groep_nn_leden"),
@@ -68,8 +56,7 @@ function model_fac_groep(groep_key, params)
this.includes = {
"users": {
"model": new model_fac_gebruikersgroep(),
"joinfield": "authorizationgroup",
"multiadd": "person"
"joinfield": "fac_groep"
}
};
@@ -78,14 +65,18 @@ function model_fac_groep(groep_key, params)
this.includes["authorization"]
= {
"model": new model_fac_groeprechten(params),
"joinfield": "authorizationgroup",
"joinfield": "fac_groep",
outertoggle: { def: false, lbl: L("fac_gebruiker_outergroep") }
};
}
this.autfunction = "WEB_FACMSU";
this.record_title = L("fac_groep");
this.records_title = L("fac_groep_m");
// Groepen met WEB_FACFAC en WEB_FACTAB zie je niet als je die rechten niet zelf hebt
var xparams = { GET: { wheres: [] } }
if (!user || !user.has("WEB_FACFAC"))
if (!user.has("WEB_FACFAC"))
{
xparams.GET.wheres.push( "fac_groep.fac_groep_key NOT IN"
+ " (SELECT fac_groep_key"
@@ -94,7 +85,7 @@ function model_fac_groep(groep_key, params)
+ " WHERE fgr.fac_functie_key = ff.fac_functie_key"
+ " AND ff.fac_functie_code = 'WEB_FACFAC')");
}
if (!user || !user.has("WEB_FACTAB"))
if (!user.has("WEB_FACTAB"))
{
xparams.GET.wheres.push( "fac_groep.fac_groep_key NOT IN"
+ " (SELECT fac_groep_key"

View File

@@ -29,18 +29,16 @@
*/
function model_fac_groeprechten (params)
{
var params = params || {groep_key: -1, functie_key: -1, disc_key: -1};
params.disc_key = (params.disc_key ? params.disc_key : -1);
if (params && (params.groep_key > 0 || params.disc_key > 0 || params.functie_key > 0))
{ /* Oke */ }
else
INTERNAL_ERROR_GROEPRECHTEN; // minstens 1 van de drie moet er zijn
this.records_name = "authorizations";
this.record_name = "authorisation";
this.table = "fac_groeprechten";
this.primary = "fac_groeprechten_key";
this.records_name = "fac_groeprecht";
this.record_name = "fac_groeprechten";
this.autfunction = "WEB_FACMSU";
this.record_title = L("fac_groeprechten");
this.records_title = L("fac_groeprechten_m");
@@ -48,14 +46,14 @@ function model_fac_groeprechten (params)
this.fields = {
"id": {
"dbs": "fac_groeprechten_key",
"label": L("lcl_key"),
"label": "Key",
"typ": "key",
"hidden_fld": true,
"required": true,
"filter": "exact",
"seq": "fac_s_fac_groeprechten_key"
},
"authorizationgroup": {
"fac_groep": {
"dbs": "fac_groep_key",
"label": L("fac_groep"),
"typ": "key",
@@ -66,14 +64,14 @@ function model_fac_groeprechten (params)
"desc": "fac_groep_omschrijving"
}
},
"authorization": {
"fac_functie": {
"dbs": "fac_functie_key",
"label": L("fac_functie_key"),
"typ": "key",
"hidden_fld": true,
"foreign": "fac_functie"
},
"discipline": {
"ins_discipline": {
"dbs": "ins_discipline_key",
"label": L("mgt_discipline"),
"typ": "key",
@@ -85,25 +83,25 @@ function model_fac_groeprechten (params)
"where": "ins_discipline_verwijder IS NULL"
}
},
"basislevelread": {
"prs_level_read": {
"dbs": "fac_gebruiker_prs_level_read",
"label": L("fac_gebruiker_prs_level_read"),
"typ": "number",
"foreign": foreignPRSRechten
},
"basislevelwrite": {
"prs_level_write": {
"dbs": "fac_gebruiker_prs_level_write",
"label": L("fac_gebruiker_prs_level_write"),
"typ": "number",
"foreign": foreignPRSRechten
},
"realestatelevelread": {
"alg_level_read": {
"dbs": "fac_gebruiker_alg_level_read",
"label": L("fac_gebruiker_alg_level_read"),
"typ": "number",
"foreign": foreignALGRechten
},
"realestatelevelwrite": {
"alg_level_write": {
"dbs": "fac_gebruiker_alg_level_write",
"label": L("fac_gebruiker_alg_level_write"),
"typ": "number",
@@ -187,8 +185,8 @@ function model_fac_groeprechten (params)
oRs.Close();
if (!(this.min_level & (4 | 8)))
{
this.fields["basislevelread"].label = L("fac_gebruiker_lezen"); // Generiekere labels
this.fields["basislevelwrite"].label = L("fac_gebruiker_schrijven");
this.fields["prs_level_read"].label = L("fac_gebruiker_lezen"); // Generiekere labels
this.fields["prs_level_write"].label = L("fac_gebruiker_schrijven");
}
}
@@ -222,12 +220,12 @@ function model_fac_groeprechten (params)
+ " WHERE fac_functie_key = " + params.functie_key
+ " GROUP BY fac_groep_key, fac_functie_key) fac_groeprechten";
this.record_title += " TODO Functie: " + params.functie_key;
this.fields["basislevelread"].val = fnRechten;
this.fields["basislevelwrite"].val = fnRechten;
this.fields["realestatelevelread"].val = fnRechten;
this.fields["realestatelevelwrite"].val = fnRechten;
this.fields["prs_level_read"].val = fnRechten;
this.fields["prs_level_write"].val = fnRechten;
this.fields["alg_level_read"].val = fnRechten;
this.fields["alg_level_write"].val = fnRechten;
this.fields["discipline"] =
this.fields["ins_discipline"] =
{
"dbs": "nn_disc",
"label": L("mgt_discipline"),
@@ -241,9 +239,7 @@ function model_fac_groeprechten (params)
this.tablesql = "(SELECT MIN(fac_groeprechten_key) fac_groeprechten_key,"
+ " fac_groep_key,"
+ " g.fac_functie_key,"
/* missen we dit ooit?
+ " f.fac_functie_min_level,"
*/
+ " CASE"
+ " WHEN fac_functie_discipline = 1"
+ " THEN fac_functie_module || ' ' || "
@@ -262,13 +258,11 @@ function model_fac_groeprechten (params)
+ " AND g.fac_functie_key = f.fac_functie_key"
+ " GROUP BY fac_groep_key, g.fac_functie_key, fac_functie_discipline, fac_functie_min_level, fac_functie_module) fac_groeprechten";
this.record_title += " TODO Groep: " + params.groep_key;
/* missen we dit ooit?
this.fields["basislevelread"].val = fnRechten;
this.fields["basislevelwrite"].val = fnRechten;
this.fields["realestatelevelread"].val = fnRechten;
this.fields["realestatelevelwrite"].val = fnRechten;
*/
this.fields["discipline"] =
this.fields["prs_level_read"].val = fnRechten;
this.fields["prs_level_write"].val = fnRechten;
this.fields["alg_level_read"].val = fnRechten;
this.fields["alg_level_write"].val = fnRechten;
this.fields["ins_discipline"] =
{
"dbs": "nn_disc",
"label": L("mgt_discipline"),
@@ -290,11 +284,11 @@ function model_fac_groeprechten (params)
+ " WHERE ins_discipline_key = " + params.disc_key
+ " GROUP BY ins_discipline_key, fac_functie_key) fac_groeprechten";
this.record_title += " TODO Disc: " + params.groep_key;
this.fields["basislevelread"].val = fnRechten;
this.fields["basislevelwrite"].val = fnRechten;
this.fields["realestatelevelread"].val = fnRechten;
this.fields["realestatelevelwrite"].val = fnRechten;
this.fields["authorizationgroup"] =
this.fields["prs_level_read"].val = fnRechten;
this.fields["prs_level_write"].val = fnRechten;
this.fields["alg_level_read"].val = fnRechten;
this.fields["alg_level_write"].val = fnRechten;
this.fields["fac_groep"] =
{
"dbs": "nn_groep",
"label": L("fac_groep_m"),
@@ -307,13 +301,13 @@ function model_fac_groeprechten (params)
this.list = {
"columns": [
"id",
"authorization",
"authorizationgroup",
"discipline",
"basislevelread",
"basislevelwrite",
"realestatelevelread",
"realestatelevelwrite"
"fac_functie",
"fac_groep",
"ins_discipline",
"prs_level_read",
"prs_level_write",
"alg_level_read",
"alg_level_write"
]
};

143
APPL/API2/model_fac_idp.inc Normal file
View File

@@ -0,0 +1,143 @@
<% /*
$Revision$
$Id$
File: model_fac_idp.inc
Description:
Notes: Documentatie in de wiki onder Authenticeren
*/
function fac_idp()
{
this.table = "fac_idp";
this.primary = "fac_idp_key";
this.records_name = "idps";
this.record_name = "idp";
this.autfunction = "WEB_FACFAC";
this.record_title = L("fac_idp");
this.records_title = L("fac_idp_m");
this.fields = {
"id": {
"dbs": "fac_idp_key",
"label": "Key",
"typ": "key",
"seq": "fac_s_fac_idp_key"
},
"code": {
"dbs": "fac_idp_code",
"label": L("fac_idp_code"),
"typ": "varchar"
},
"name": {
"dbs": "fac_idp_omschrijving",
"label": L("fac_idp_omschrijving"),
"typ": "varchar",
"required": true
},
"type": {
"dbs": "fac_idp_type",
"label": L("fac_idp_type"),
"typ": "key",
"required": true,
"LOV": L("fac_idp_typeLOV")
},
"remark": {
"dbs": "fac_idp_opmerking",
"label": L("fac_idp_opmerking"),
"typ": "memo"
},
"secret": {
"dbs": "fac_idp_secret",
"label": L("fac_idp_secret"),
"typ": "varchar",
"defaultvalue": shared.random(32)
},
"audience": {
"dbs": "fac_idp_audience",
"label": L("fac_idp_audience"),
"typ": "varchar",
"placeholder": customerId + ".facilitor.nl"
},
"issuer": {
"dbs": "fac_idp_issuer",
"label": L("fac_idp_issuer"),
"typ": "varchar"
},
"algorithm": {
"dbs": "fac_idp_algorithm",
"label": L("fac_idp_algorithm"),
"typ": "varchar"
},
"timeout": {
"dbs": "fac_idp_clockskew",
"label": L("fac_idp_clockskew"),
"typ": "number",
"defaultvalue": 30
},
"duration": {
"dbs": "fac_idp_duration",
"label": L("fac_idp_duration"),
"typ": "number"
},
"remote_loginurl": {
"dbs": "fac_idp_remote_loginurl",
"label": L("fac_idp_remote_loginurl"),
"typ": "varchar"
},
"remote_logouturl": {
"dbs": "fac_idp_remote_logouturl",
"label": L("fac_idp_remote_logouturl"),
"typ": "varchar"
},
"ipfilter": {
"dbs": "fac_idp_ipfilter",
"label": L("fac_idp_ipfilter"),
"typ": "varchar"
},
"_currentIP" : {
"dbs": "",
"label": "Current IP",
"typ": "label",
"labelvalue": String(Request.ServerVariables("REMOTE_ADDR"))
},
"ipauto": {
"dbs": "fac_idp_ipauto",
"label": L("fac_idp_ipauto"),
"typ": "check0"
},
/*
"company": {
"dbs": "prs_bedrijf_key",
"typ": "key",
"foreign": "prs_bedrijf",
"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("fac_idp_functie_key"),
"typ": "key",
"foreign": "fac_functie"
},
*/
"internal": {
"dbs": "fac_idp_internal",
"label": L("fac_idp_internal"),
"typ": "check0",
"readonly": 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);
}
%>

View File

@@ -15,10 +15,10 @@
function model_fac_import_app()
{
this.records_name = "importfunctions";
this.record_name = "importfunction";
this.table = "fac_import_app";
this.primary = "fac_import_app_key";
this.records_name = "fac_import_apps";
this.record_name = "fac_import_app";
this.autfunction = "WEB_PRSSYS"; //"WEB_BESMGT";
this.record_title = L("fac_import_app");
this.records_title = L("fac_import_app_m");
@@ -27,7 +27,7 @@ function model_fac_import_app()
this.fields = {
"id": {
"dbs": "fac_import_app_key",
"label": L("lcl_key"),
"label": "Key",
"typ": "key",
"required": true,
"filter": "exact",
@@ -52,7 +52,7 @@ function model_fac_import_app()
"foreign": "fac_functie",
"filter": "exact"
},
"orderdiscipline": {
"catalog": {
"dbs": "ins_discipline_key",
"label": L("fac_ins_discipline_key"),
"typ": "key",

View File

@@ -2,9 +2,9 @@
$Revision$
$Id$
File: model_fac_notificatie_job.inc
File: model_fac_notificatiejob.inc
Description: Vanuit CodeCharge gegenereerd model voor fac_notificatie_job
Description: Vanuit CodeCharge gegenereerd model voor fac_notificatiejob
Context:
@@ -13,12 +13,12 @@
%>
<%
function model_fac_notificatie_job()
function model_fac_notificatiejob()
{
this.records_name = "notificationjobs";
this.record_name = "notificationjob";
this.table = "fac_notificatie_job";
this.primary = "fac_notificatie_job_key";
this.records_name = "fac_notificatie_jobs";
this.record_name = "fac_notificatie_job";
this.autfunction = "WEB_PRSSYS";
this.record_title = L("fac_notificatie_job");
this.records_title = L("fac_notificatie_job_m");
@@ -27,7 +27,7 @@ function model_fac_notificatie_job()
this.fields = {
"id": {
"dbs": "fac_notificatie_job_key",
"label": L("lcl_key"),
"label": "Key",
"typ": "key",
"hidden_fld": true,
"required": true,
@@ -55,7 +55,7 @@ function model_fac_notificatie_job()
"required": true
},
"jobmode": { // Niet hernoemen naar 'mode', dat wordt door scaffolding in de url al gebruikt
"job_mode": { // Niet hernoemen naar 'mode', dat wordt door scaffolding in de url al gebruikt
"dbs": "fac_notificatie_job_mode",
"label": L("fac_notificatie_job_mode"),
"typ": "number",

View File

@@ -16,17 +16,10 @@
function model_fac_profiel()
{
this.records_name = "profiles";
this.record_name = "profile";
this.table = "fac_profiel";
this.audit = { // Parameters voor fac_audit.
"childtable": "fac_profielwaarde",
"childaudit": {"sql": "SELECT fac_profielwaarde_key"
+ " FROM fac_profielwaarde"
+ " WHERE fac_profiel_key IN ({0})"
}
};
this.primary = "fac_profiel_key";
this.records_name = "fac_profiels";
this.record_name = "fac_profiel";
this.autfunction = "WEB_FINMSU";
this.record_title = L("fac_profiel");
this.records_title = L("fac_profiel_m");
@@ -35,7 +28,7 @@ function model_fac_profiel()
this.fields = {
"id": {
"dbs": "fac_profiel_key",
"label": L("lcl_key"),
"label": "Key",
"typ": "key",
"required": true,
"filter": "exact",
@@ -49,7 +42,7 @@ function model_fac_profiel()
"translate": true,
"filter": "like"
},
"profilelimit": { // "limit" is een reserved naam in API2
"profile_limit": {
"dbs": "fac_profiel_limiet",
"label": L("fac_profiel_limiet"),
"typ": "number"
@@ -58,11 +51,9 @@ function model_fac_profiel()
this.includes = {
"profilevalues": {
"profile_values": {
"model": new model_fac_profielwaarde(),
"joinfield": "profile",
"enable_update": true,
"multiadd": "catalog"
"joinfield": "profile"
}
};

View File

@@ -15,21 +15,23 @@
function model_fac_profielwaarde()
{
this.records_name = "profilevalues";
this.record_name = "profilevalue";
this.table = "fac_profielwaarde";
this.primary = "fac_profielwaarde_key";
this.records_name = "fac_profielwaardes";
this.record_name = "fac_profielwaarde";
this.autfunction = "WEB_FINMSU";
this.record_title = L("fac_profielwaarde");
this.records_title = L("fac_profielwaarde_m");
var catalogus_sql = "SELECT B.ins_discipline_key"
+ " , B.ins_discipline_omschrijving as omschrijving"
+ " , '' as prefix"
+ " , " + safe.qL("lcl_bes_Catalogus") + "||': '|| B.ins_discipline_omschrijving as omschrijving_ext"
+ " FROM bes_v_aanwezigdiscipline B"
+ " UNION ALL "
+ "SELECT M.ins_discipline_key"
+ " , M.ins_discipline_omschrijving"
+ " , S.ins_srtdiscipline_prefix"
+ " , " + safe.qL("lcl_mld_vakgroep") + "||': '|| S.ins_srtdiscipline_prefix ||'-'|| M.ins_discipline_omschrijving"
+ " FROM mld_v_aanwezigdiscipline M"
+ " , ins_srtdiscipline S"
@@ -38,7 +40,7 @@ function model_fac_profielwaarde()
this.fields = {
"id": {
"dbs": "fac_profielwaarde_key",
"label": L("lcl_key"),
"label": "Key",
"typ": "key",
"required": true,
"filter": "exact",
@@ -49,19 +51,23 @@ function model_fac_profielwaarde()
"label": L("fac_profiel"),
"typ": "key",
"required": true,
"insertonly": true,
"foreign": {
"tbl": "fac_profiel",
"key": "fac_profiel_key",
"desc": "fac_profiel_omschrijving"
}
},
"prefix": {
"dbs": "catalogus.prefix",
"label": L("ins_discipline_prefix"),
"typ": "varchar",
"readonly": true
},
"catalog": {
"dbs": "ins_discipline_key",
"label": L("mgt_discipline"),
"typ": "key",
"required": true,
"insertonly": true,
"foreign": {
"tbl": "("+ catalogus_sql + ")",
"key": "ins_discipline_key",
@@ -69,12 +75,11 @@ function model_fac_profielwaarde()
},
"friendlyname": true
},
"valuelimit": {
"value_limit": {
"dbs": "fac_profielwaarde_limiet",
"label": L("fac_profielwaarde_limiet"),
"typ": "number",
"required": true,
"multiedit": true
"required": true
}
};
@@ -83,8 +88,9 @@ function model_fac_profielwaarde()
this.list = {
"columns": [
"id",
"prefix",
"catalog",
"valuelimit"
"value_limit"
]
};
this.search = {
@@ -94,8 +100,13 @@ function model_fac_profielwaarde()
"modal": true
};
this.REST_GET = generic_REST_GET(this);
var ext_sql = "("+catalogus_sql+") catalogus"
this.REST_GET = generic_REST_GET(this, {
"GET": {
"tables": [ ext_sql],
"wheres": [ "fac_profielwaarde.ins_discipline_key = catalogus.ins_discipline_key"]
}
});
this.REST_POST = generic_REST_POST(this);
this.REST_PUT = generic_REST_PUT(this);
this.REST_DELETE = generic_REST_DELETE(this);

View File

@@ -16,26 +16,17 @@
model_fac_session = // Internal only
{
"table": "fac_session",
"primary": "fac_session_key",
"primary": "fac_session_sessionid_hash",
"records_name": "fac_sessions",
"record_name": "fac_session",
"record_title": L("fac_session"),
"records_title": L("fac_session_m"),
"autfunction": "WEB_FACTAB",
"record_title": "FACILITOR session", // L("fac_session"),
"records_title": "FACILITOR sessions", // L("fac_session_m"),
autfunction: "WEB_FACTAB",
"fields": {
"id": {
"dbs": "fac_session_key",
"label": "Key",
"typ": "key",
"required": true,
"seq": "fac_s_fac_session_key"
},
"hash": {
"dbs": "fac_session_sessionid_hash",
"label": L("fac_session_sessionid_hash"),
"typ": "varchar"
},
id: {
dbs: "fac_session_sessionid_hash",
"typ": "key" },
"user": {
"dbs": "prs_perslid_key",
"label": L("lcl_user"),
@@ -44,27 +35,27 @@ model_fac_session = // Internal only
},
"data": {
"dbs": "fac_session_data",
"label": L("fac_session_data"),
//"label": L("fac_session_data"),
"typ": "varchar"
},
"creation": {
"dbs": "fac_session_aanmaak",
"label": L("fac_session_aanmaak"),
//"label": L("fac_session_aanmaak"),
"typ": "datetime"
},
"expire": {
"dbs": "fac_session_expire",
"label": L("fac_session_expire"),
//"label": L("fac_session_expire"),
"typ": "datetime"
},
"ip": {
"dbs": "fac_session_ip",
"label": L("fac_session_ip"),
//"label": L("fac_session_ip")
"typ": "varchar"
},
"useragent": {
"dbs": "fac_session_useragent",
"label": L("fac_session_useragent"),
//"label": L("fac_session_useragent")
"typ": "varchar"
}

View File

@@ -20,7 +20,7 @@ function model_fac_setting()
this.record_name = "fac_setting";
this.autfunction = "WEB_PROFIL"; //Om zelf al je geregistreerde gegevens te kunnen inzien
this.record_title = L("lcl_fac_setting");
this.records_title = L("lcl_fac_setting_m");
// this.records_title = L("lcl_fac_setting_m");
this.fields = {
@@ -34,63 +34,63 @@ function model_fac_setting()
},
"module": {
"dbs": "fac_setting_module",
"label": L("lcl_fac_module"),
// "label": L("lcl_fac_module"),
"typ": "varchar",
"required": true
},
"name": {
"dbs": "fac_setting_name",
"label": L("lcl_fac_name"),
// "label": L("lcl_fac_name"),
"typ": "varchar",
"required": true
},
"description": {
"dbs": "fac_setting_description",
"label": L("lcl_fac_descr"),
// "label": L("lcl_fac_descr"),
"typ": "varchar",
"required": true
},
"comment": {
"dbs": "fac_setting_comment",
"label": L("lcl_fac_comment"),
// "label": L("lcl_fac_comment"),
"typ": "varchar"
},
"flags": {
"dbs": "fac_setting_flags",
"label": L("lcl_fac_flags"),
// "label": L("lcl_fac_flags"),
"typ": "number"
},
"type": {
"dbs": "fac_setting_type",
"label": L("lcl_fac_settingtype"),
// "label": L("lcl_fac_settingtype"),
"typ": "varchar",
"required": true
},
"default": {
"dbs": "fac_setting_default",
"label": L("lcl_fac_default"),
// "label": L("lcl_fac_default"),
"typ": "varchar"
},
"overrule": {
"dbs": "fac_setting_pvalue",
"label": L("lcl_fac_overrule"),
// "label": L("lcl_fac_overrule"),
"typ": "varchar"
},
"value": {
"dbs": "value",
"sql": "COALESCE(fac_setting_pvalue, fac_setting_default)",
"label": L("lcl_fac_value"),
// "label": L("lcl_fac_value"),
"typ": "varchar"
},
"date": {
"dbs": "fac_setting_datum",
"label": L("lcl_fac_time"),
// "label": L("lcl_fac_time"),
"typ": "datetime"
},
"changed_by": {
"dbs": "prs_perslid_key",
"label": L("prs_perslid"),
"typ": "key",
"typ": "number",
"foreign": "prs_perslid"
},
"authorization": {

View File

@@ -1,155 +0,0 @@
<% /*
$Revision$
$Id$
File: model_fac_sp.inc
Description:
Notes:
*/
%>
<!-- #include file="./model_fac_sp_map.inc" -->
<%
function model_fac_sp()
{
this.records_name = "identityproviders";
this.record_name = "identityprovider";
this.table = "fac_sp";
this.primary = "fac_sp_key";
this.autfunction = "WEB_FACFAC";
this.record_title = L("fac_sp");
this.records_title = L("fac_sp_m");
this.fields = {
"id": {
"dbs": "fac_sp_key",
"label": L("lcl_key"),
"typ": "key",
"seq": "fac_s_fac_sp_key"
},
"code": {
"dbs": "fac_sp_code",
"label": L("fac_sp_code"),
"typ": "varchar",
"filter": "exact"
},
"name": {
"dbs": "fac_sp_omschrijving",
"label": L("fac_sp_omschrijving"),
"typ": "varchar",
"required": true
},
"type": {
"dbs": "fac_sp_type",
"label": L("fac_sp_type"),
"typ": "key",
"required": true,
"LOV": L("fac_aut_typeLOV") // TODO?
},
"remark": {
"dbs": "fac_sp_opmerking",
"label": L("fac_sp_opmerking"),
"typ": "memo"
},
"secret": {
"dbs": "fac_sp_secret",
"label": L("fac_sp_secret"),
"typ": "varchar",
"defaultvalue": shared.random(32),
"secret": true
},
"audience": {
"dbs": "fac_sp_audience",
"label": L("fac_sp_audience"),
"typ": "varchar",
"placeholder": customerId + ".facilitor.nl"
},
"issuer": {
"dbs": "fac_sp_issuer",
"label": L("fac_sp_issuer"),
"typ": "varchar"
},
"algorithm": {
"dbs": "fac_sp_algorithm",
"label": L("fac_sp_algorithm"),
"typ": "varchar"
},
"timeout": {
"dbs": "fac_sp_clockskew",
"label": L("fac_sp_clockskew"),
"typ": "number",
"defaultvalue": 30
},
"duration": {
"dbs": "fac_sp_duration",
"label": L("fac_sp_duration"),
"typ": "number"
},
"remoteloginurl": {
"dbs": "fac_sp_remote_loginurl",
"label": L("fac_sp_remote_loginurl"),
"typ": "varchar"
},
"remotelogouturl": {
"dbs": "fac_sp_remote_logouturl",
"label": L("fac_sp_remote_logouturl"),
"typ": "varchar"
},
"ipfilter": {
"dbs": "fac_sp_ipfilter",
"label": L("fac_sp_ipfilter"),
"typ": "varchar"
},
"_currentIP" : {
"dbs": "",
"label": "Current IP",
"typ": "label",
"labelvalue": String(Request.ServerVariables("REMOTE_ADDR"))
},
"ipauto": {
"dbs": "fac_sp_ipauto",
"label": L("fac_sp_ipauto"),
"typ": "check0"
},
/*
"company": {
"dbs": "prs_bedrijf_key",
"typ": "key",
"foreign": "prs_bedrijf",
"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("fac_sp_functie_key"),
"typ": "key",
"foreign": "fac_functie"
},
*/
"internal": {
"dbs": "fac_sp_internal",
"label": L("fac_sp_internal"),
"typ": "check0",
"readonly": true
}
}
this.includes =
{ "spmappings": { model: new model_fac_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);
}
%>

View File

@@ -1,71 +0,0 @@
<% /*
$Revision$
$Id$
File: model_fac_sp_map.inc
Description: Door sp 'released attributes'
Notes:
*/
function model_fac_sp_map()
{
this.records_name = "spmappings";
this.record_name = "spmapping";
this.table = "fac_sp_map";
this.primary = "fac_sp_map_key";
this.autfunction = "WEB_FACFAC";
this.record_title = L("fac_sp_map");
this.records_title = L("fac_sp_map_m");
this.fields = {
"id": {
"dbs": "fac_sp_map_key",
"label": L("lcl_key"),
"typ": "key",
"seq": "fac_s_fac_sp_map_key"
},
"serviceprovider": {
"dbs": "fac_sp_key",
"label": L("fac_sp"),
"typ": "key",
"hidden_fld": true,
"required": true
},
"name": {
"dbs": "fac_sp_map_from",
"label": L("fac_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": "fac_sp_map_to",
"label": L("fac_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);
}
%>

View File

@@ -15,10 +15,10 @@
function model_fac_srtnotificatie(cust)
{
this.records_name = "notificationtypes";
this.record_name = "notificationtype";
this.table = "fac_srtnotificatie";
this.primary = "fac_srtnotificatie_key";
this.records_name = "fac_srtnotificaties";
this.record_name = "fac_srtnotificatie";
this.autfunction = "WEB_PRSSYS";
this.record_title = L("fac_srtnotificatie");
this.records_title = L("fac_srtnotificatie_m");
@@ -26,7 +26,7 @@ function model_fac_srtnotificatie(cust)
this.fields = {
"id": {
"dbs": "fac_srtnotificatie_key",
"label": L("lcl_key"),
"label": "Key",
"typ": "key",
"required": true,
"seq": "fac_s_fac_srtnotificatie_key",
@@ -54,7 +54,7 @@ function model_fac_srtnotificatie(cust)
"LOV": fill_srtnotificatie_LOV(),
"emptyoption": null
},
"notificationurl": {
"notification_url": {
"dbs": "fac_srtnotificatie_url",
"label": L("fac_srtnotificatie_url"),
"typ": "varchar",
@@ -66,7 +66,7 @@ function model_fac_srtnotificatie(cust)
"typ": "varchar",
"readonly": true
},
"notificationmode": {
"notification_mode": {
"dbs": "fac_srtnotificatie_mode",
"label": "",
"typ": "number",
@@ -75,7 +75,7 @@ function model_fac_srtnotificatie(cust)
"name": "",
"label": "",
"typ": "check",
"mask": 63,
"mask": 31,
"radios": [
{
"name": "portal_statusinfo",
@@ -101,11 +101,6 @@ function model_fac_srtnotificatie(cust)
"name": "stylesheet",
"label": L("fac_srtnotificatie_stylesheet"),
"mask": 16
},
{
"name": "app_push",
"label": L("fac_srtnotificatie_pushapp"),
"mask": 32
}
]
}
@@ -126,65 +121,55 @@ function model_fac_srtnotificatie(cust)
"dbs": "fac_srtnotificatie_usermode",
"label": L("fac_srtnotificatie_usermode"),
"typ": "check0",
"listfunction": fnshowusermode,
"multiedit": true
"listfunction": fnshowusermode
},
"mailbuilding": {
"mail_building": {
"dbs": "fac_srtnotificatie_gebouw",
"label": L("fac_srtnotificatie_gebouw"),
"typ": "check0",
"listfunction": fnshowmailbuilding,
"multiedit": true
"listfunction": fnshowmailbuilding
},
"delay": {
"dbs": "fac_srtnotificatie_delay",
"label": L("fac_srtnotificatie_delay"),
"typ": "number",
"required": true,
"defaultvalue": "0",
"multiedit": true
"defaultvalue": "0"
},
"modestatus": {
"mode_status": {
"dbs": "notimode.status",
"label": L("fac_srtnotificatie_status"),
"typ": "varchar",
"hidden_fld": true
},
"modeemail": {
"mode_email": {
"dbs": "notimode.email",
"label": L("fac_srtnotificatie_mail"),
"typ": "varchar",
"hidden_fld": true
},
"modesms": {
"mode_sms": {
"dbs": "notimode.sms",
"label": L("fac_srtnotificatie_sms"),
"typ": "varchar",
"hidden_fld": true
},
"modealert": {
"mode_alert": {
"dbs": "notimode.portal",
"label": L("fac_srtnotificatie_alert"),
"typ": "varchar",
"hidden_fld": true
},
"modeapp": {
"dbs": "notimode.apppush",
"label": L("fac_srtnotificatie_app"),
"typ": "varchar",
"hidden_fld": true
}
};
if (!S("puo_smsaccount"))
this.fields.notificationmode.bits[0].radios.splice(2, 1);
this.fields.notification_mode.bits[0].radios.splice(2, 1);
var ext_sql = "(SELECT fac_srtnotificatie_key"
+ " , DECODE(BITAND(fac_srtnotificatie_mode, 1), 1,"+ safe.qL("lcl_on") +", '') status"
+ " , DECODE(BITAND(fac_srtnotificatie_mode, 2), 2,"+ safe.qL("lcl_on") +", '') email"
+ " , DECODE(BITAND(fac_srtnotificatie_mode, 4), 4,"+ safe.qL("lcl_on") +", '') sms"
+ " , DECODE(BITAND(fac_srtnotificatie_mode, 8), 8,"+ safe.qL("lcl_on") +", '') portal"
+ " , DECODE(BITAND(fac_srtnotificatie_mode, 32),32,"+ safe.qL("lcl_on") +", '') apppush"
+ " FROM fac_srtnotificatie) notimode ";
var get_param = {
@@ -194,24 +179,6 @@ function model_fac_srtnotificatie(cust)
}
};
function fill_srtnotificatie_LOV()
{
var xmlnodeLOV = "";
var sql = "SELECT distinct fac_srtnotificatie_xmlnode"
+ " , NVL(fac_srtnotificatie_xmlnode,'<empty>') xmlnode_lov"
+ " FROM fac_srtnotificatie"
+ " ORDER BY 1 NULLS FIRST";
var oRs = Oracle.Execute(sql);
while (!oRs.eof)
{
var xmlnode = oRs("fac_srtnotificatie_xmlnode").Value;
xmlnodeLOV += (xmlnodeLOV?";":"") + xmlnode + ";" + oRs("xmlnode_lov").Value;
oRs.moveNext();
}
oRs.Close();
return xmlnodeLOV;
}
function xxx_srtkenmerk_sql()
{
var sql = "(select sk.mld_srtkenmerk_key srtkenmerk_key"
@@ -234,7 +201,7 @@ function model_fac_srtnotificatie(cust)
this.fields.xmlnode.readonly = false;
this.fields.xmlnode.required = true;
this.fields.description.required = true;
this.fields.notificationurl.readonly = false;
this.fields.notification_url.readonly = false;
this.fields.group.readonly = false;
get_param.GET.wheres.push("UPPER(SUBSTR(fac_srtnotificatie_code, 1, 4)) = 'CUST' ");
@@ -251,9 +218,9 @@ function model_fac_srtnotificatie(cust)
// Voorlopig mag alleen voor meldingen en opdrachten het vinkje 'E-mail sturen naar gebouw'
// gezet worden
if (iscust == 1 || !inArray(obj.name.substring(0,3), ["MLD", "ORD"]))
fld.mailbuilding.readonly = true;
fld.mail_building.readonly = true;
if (inArray(obj.name, ["MLDAFM", "MLDAFR", "MLDUPD"]))
if (inArray(obj.name, ["MLDAFM", "MLDAFR"]))
{
fld.attachment.foreign.tbl = xxx_srtkenmerk_sql();
}

Some files were not shown because too many files have changed in this diff Show More