876 lines
28 KiB
PHP
876 lines
28 KiB
PHP
<% /*
|
|
$Revision: 1 $
|
|
$Modtime: 24-09-09 19:11 $
|
|
|
|
File: shared/PRSFunctions.asp
|
|
Description: Generieke serverside PRS functies
|
|
Parameters:
|
|
Context:
|
|
Result:
|
|
Note:
|
|
*/
|
|
|
|
/************************************************************\
|
|
* Bepaal allerlei gegevens van een persoon
|
|
* Input: prsKey (moet bestaan)
|
|
* Result: Perslid object
|
|
\************************************************************/
|
|
function Perslid(prsKey)
|
|
{
|
|
this._prs_perslid_key = prsKey;
|
|
}
|
|
|
|
// Forceer het ophalen van prs_perslid data
|
|
Perslid.prototype._require_prs_perslid = function()
|
|
{
|
|
if (this._prs_afdeling_key == null)
|
|
{
|
|
var sql = "SELECT p.prs_perslid_key, "
|
|
+ prs_pers_string + " naam, "
|
|
+ " p.prs_afdeling_key,"
|
|
+ " p.fac_profiel_key,"
|
|
+ " prs_perslid_telefoonnr,"
|
|
+ " prs_perslid_mobiel,"
|
|
+ " p.prs_perslid_email,"
|
|
+ " p.mld_adres_key,"
|
|
+ " sp.prs_srtperslid_omschrijving"
|
|
+ " FROM prs_perslid p, prs_srtperslid sp"
|
|
+ " WHERE p.prs_srtperslid_key = sp.prs_srtperslid_key"
|
|
+ " AND prs_perslid_key = " + this._prs_perslid_key
|
|
var oRs = Oracle.Execute(sql);
|
|
if (!oRs.eof)
|
|
{
|
|
this._prs_afdeling_key = oRs("prs_afdeling_key").value;
|
|
this._naam = oRs("naam").value;
|
|
this._prs_afdeling_key = oRs("prs_afdeling_key").value;
|
|
this._prs_perslid_telefoonnr = oRs("prs_perslid_telefoonnr").value;
|
|
this._prs_perslid_mobiel = oRs("prs_perslid_mobiel").value;
|
|
this._fac_profiel_key = oRs("fac_profiel_key").value;
|
|
this._prs_perslid_email = oRs("prs_perslid_email").value;
|
|
this._prs_srtperslid = oRs("prs_srtperslid_omschrijving").value;
|
|
this._objAfdeling = null;
|
|
this._mld_adres_key = oRs("mld_adres_key").Value;
|
|
}
|
|
oRs.close();
|
|
}
|
|
}
|
|
|
|
// Forceer het ophalen van plaats data van prs_perslid
|
|
Perslid.prototype._require_prs_perslid_plaats = function()
|
|
{
|
|
if (!this._werkplekken)
|
|
{
|
|
this._werkplekken = [];
|
|
var sql = "SELECT prs_werkplek_key"
|
|
+ " FROM prs_v_aanwezigperslidwerkplek w"
|
|
+ " WHERE prs_perslid_key = " + this._prs_perslid_key
|
|
+ " ORDER BY w.prs_perslidwerkplek_bezetting DESC"; // Hoogste bezetting vooraan TODO: en dan op plaatsaanduiding
|
|
var oRs = Oracle.Execute(sql);
|
|
while (!oRs.eof)
|
|
{
|
|
this._werkplekken.push(new Werkplek(oRs("prs_werkplek_key")));
|
|
oRs.MoveNext();
|
|
}
|
|
oRs.close();
|
|
}
|
|
}
|
|
|
|
Perslid.prototype.werkplekken = function()
|
|
{
|
|
this._require_prs_perslid_plaats();
|
|
return this._werkplekken;
|
|
}
|
|
|
|
Perslid.prototype.prs_perslid_key = function()
|
|
{
|
|
this._require_prs_perslid();
|
|
return this._prs_perslid_key;
|
|
}
|
|
|
|
Perslid.prototype.prs_afdeling_key = function()
|
|
{
|
|
this._require_prs_perslid();
|
|
return this._prs_afdeling_key;
|
|
}
|
|
|
|
Perslid.prototype.naam = function naam()
|
|
{
|
|
this._require_prs_perslid();
|
|
return this._naam;
|
|
}
|
|
|
|
Perslid.prototype.prs_perslid_telefoonnr = function()
|
|
{
|
|
this._require_prs_perslid();
|
|
return this._prs_perslid_telefoonnr;
|
|
}
|
|
|
|
Perslid.prototype.prs_perslid_mobiel = function()
|
|
{
|
|
this._require_prs_perslid();
|
|
return this._prs_perslid_mobiel;
|
|
}
|
|
|
|
Perslid.prototype.fac_profiel_key = function()
|
|
{
|
|
this._require_prs_perslid();
|
|
return this._fac_profiel_key;
|
|
}
|
|
|
|
Perslid.prototype.prs_perslid_email = function()
|
|
{
|
|
this._require_prs_perslid();
|
|
return this._prs_perslid_email;
|
|
}
|
|
|
|
Perslid.prototype.prs_srtperslid = function()
|
|
{
|
|
this._require_prs_perslid();
|
|
return this._prs_srtperslid;
|
|
}
|
|
|
|
Perslid.prototype.mld_adres_key = function()
|
|
{
|
|
this._require_prs_perslid();
|
|
return this._mld_adres_key;
|
|
}
|
|
|
|
Perslid.prototype.kpn_string = function()
|
|
{
|
|
if (!this._kpn_string)
|
|
{
|
|
this._require_prs_perslid();
|
|
this.kpn_string ="-";
|
|
if (this.afdeling().prs_kostenplaats_key())
|
|
{
|
|
var oRs = Oracle.Execute("SELECT " + prs_kpn_string +", prs_perslid_naam_full"
|
|
+ " FROM prs_kostenplaats k, prs_v_perslid_fullnames pf"
|
|
+ " WHERE k.prs_perslid_key = pf.prs_perslid_key"
|
|
+ " AND k.prs_kostenplaats_key = " + this.afdeling().prs_kostenplaats_key());
|
|
if (!oRs.eof)
|
|
this._kpn_string = '' + oRs(0).value;
|
|
this._kpn_budgethouder = '' + oRs(1).value; // TODO: Jos, hoe lever ik deze nou netjes op? kpn toch object?
|
|
oRs.close();
|
|
}
|
|
}
|
|
return this._kpn_string;
|
|
}
|
|
|
|
// De volgende 5 functies zijn een beetje gemakzucht, ze pakken de locatie_key etc van de eerste werkplek of geven -1
|
|
Perslid.prototype.alg_locatie_key = function()
|
|
{
|
|
this._require_prs_perslid_plaats();
|
|
if (this._werkplekken.length)
|
|
return this._werkplekken[0].alg_locatie_key();
|
|
else
|
|
return -1;
|
|
}
|
|
|
|
Perslid.prototype.alg_gebouw_key = function()
|
|
{
|
|
this._require_prs_perslid_plaats();
|
|
if (this._werkplekken.length)
|
|
return this._werkplekken[0].alg_gebouw_key();
|
|
else
|
|
return -1;
|
|
}
|
|
|
|
Perslid.prototype.alg_verdieping_key = function()
|
|
{
|
|
this._require_prs_perslid_plaats();
|
|
if (this._werkplekken.length)
|
|
return this._werkplekken[0].alg_verdieping_key();
|
|
else
|
|
return -1;
|
|
}
|
|
|
|
Perslid.prototype.alg_ruimte_key = function()
|
|
{
|
|
this._require_prs_perslid_plaats();
|
|
if (this._werkplekken.length)
|
|
return this._werkplekken[0].alg_ruimte_key();
|
|
else
|
|
return -1;
|
|
}
|
|
|
|
Perslid.prototype.prs_werkplek_key = function()
|
|
{
|
|
this._require_prs_perslid_plaats();
|
|
if (this._werkplekken.length)
|
|
return this._werkplekken[0].prs_werkplek_key();
|
|
else
|
|
return -1;
|
|
}
|
|
|
|
Perslid.prototype.aantal_werkplekken = function()
|
|
{
|
|
this._require_prs_perslid_plaats();
|
|
return this._werkplekken.length;
|
|
}
|
|
|
|
Perslid.prototype.afdeling = function()
|
|
{
|
|
this._require_prs_perslid();
|
|
if (this._objAfdeling == null)
|
|
this._objAfdeling = new Afdeling(this._prs_afdeling_key)
|
|
return this._objAfdeling;
|
|
}
|
|
|
|
Perslid.prototype.locatie = function()
|
|
{
|
|
this._require_prs_perslid_plaats();
|
|
if (this._objLocatie == null)
|
|
this._objLocatie = new Locatie(this.alg_locatie_key())
|
|
return this._objLocatie;
|
|
}
|
|
|
|
Perslid.prototype.gebouw = function()
|
|
{
|
|
this._require_prs_perslid_plaats();
|
|
if (this._objGebouw == null)
|
|
this._objGebouw = new Gebouw(this.alg_gebouw_key())
|
|
return this._objGebouw;
|
|
}
|
|
|
|
Perslid.prototype.verdieping = function()
|
|
{
|
|
this._require_prs_perslid_plaats();
|
|
if (this._objVerdieping == null)
|
|
this._objVerdieping = new Verdieping(this.alg_verdieping_key())
|
|
return this._objVerdieping;
|
|
}
|
|
|
|
Perslid.prototype.ruimte = function()
|
|
{
|
|
this._require_prs_perslid_plaats();
|
|
if (this._objRuimte == null)
|
|
this._objRuimte = new Ruimte(this.alg_ruimte_key())
|
|
return this._objRuimte;
|
|
}
|
|
|
|
Perslid.prototype.werkplek = function()
|
|
{
|
|
this._require_prs_perslid_plaats();
|
|
if (this._objWerkplek == null)
|
|
this._objWerkplek = new Werkplek(this._prs_werkplek_key)
|
|
return this._objWerkplek;
|
|
}
|
|
|
|
// checkAutorisation
|
|
// @param autfunction
|
|
// @param isOptional
|
|
// @param ins_discipline_key
|
|
// result:
|
|
// null als helemaal geen rechten (alles level 9) maar wel isOptional
|
|
// meldig 'U bent niet geauthoriseerd' als helemaal geen rechten en niet isOptional
|
|
// anders: { PRSreadlevel: 0, PRSwritelevel: 1, ALGreadlevel: 0, ALGwritelevel: 1, autfunctionkey: 64 }
|
|
Perslid.prototype.checkAutorisation = function checkAutorisation(autfunction, isOptional, ins_discipline_key)
|
|
{
|
|
// IN: globals user_key, autfunction // autfunction MUST be set in the includer, and is something like 'WEB_MLDBOF'
|
|
// OUT: globals PRSreadlevel, PRSwritelevel, ALGreadlevel, ALGwritelevel, thisfunc_enabled,autfunctionkey
|
|
if (autfunction=="*")
|
|
return { PRSreadlevel: -1,
|
|
PRSwritelevel: -1,
|
|
ALGreadlevel: -1,
|
|
ALGwritelevel: -1,
|
|
autfunctionkey: -1 };
|
|
|
|
var PRSreadlevel = '99'; // No authorization by default
|
|
var PRSwritelevel = '99'; // No authorization by default
|
|
var ALGreadlevel = '99'; // No authorization by default
|
|
var ALGwritelevel = '99'; // No authorization by default
|
|
var thisfunc_enabled = false; // No authorization by default
|
|
var autfunctionkey = -1; // Kan heel handig zijn.
|
|
|
|
// MIN om te kijken over alle mogelijke disciplines heen
|
|
oRs = Oracle.Execute("SELECT f.fac_functie_key"
|
|
+ " FROM fac_functie f "
|
|
+ " WHERE f.fac_functie_code = '" + autfunction + "'")
|
|
if (!oRs.Eof)
|
|
{
|
|
autfunctionkey = oRs(0).value;
|
|
|
|
sql = "SELECT COALESCE(MIN(FAC_GEBRUIKER_PRS_LEVEL_READ), 9)"
|
|
+ ", COALESCE(MIN(FAC_GEBRUIKER_PRS_LEVEL_WRITE), 9)"
|
|
+ ", COALESCE(MIN(FAC_GEBRUIKER_ALG_LEVEL_READ), 9)"
|
|
+ ", COALESCE(MIN(FAC_GEBRUIKER_ALG_LEVEL_WRITE), 9)"
|
|
+ " FROM fac_v_webgebruiker w"
|
|
+ " WHERE w.prs_perslid_key = " + this._prs_perslid_key
|
|
+ " AND w.fac_functie_key = " + autfunctionkey;
|
|
if (typeof ins_discipline_key != 'undefined')
|
|
sql += " AND ins_discipline_key = " + ins_discipline_key
|
|
|
|
oRs = Oracle.Execute(sql)
|
|
// Let op: door de MIN() hierboven zal er eigenlijk altijd een record zijn.
|
|
if (!oRs.Eof)
|
|
{ // the next statements do not need execution if this fac_functie.fac_functie_discipline != 1
|
|
PRSreadlevel = oRs(0).value;
|
|
PRSwritelevel = oRs(1).value;
|
|
ALGreadlevel = oRs(2).value;
|
|
ALGwritelevel = oRs(3).value;
|
|
thisfunc_enabled = (PRSreadlevel < 9 || PRSwritelevel < 9 || ALGreadlevel < 9 || ALGwritelevel < 9);
|
|
}
|
|
}
|
|
if (thisfunc_enabled)
|
|
{
|
|
__Log('Authorization for '+autfunction+'('+autfunctionkey+')=('+PRSreadlevel+','+PRSwritelevel+','+ALGreadlevel+','+ALGwritelevel+')');
|
|
return { PRSreadlevel: PRSreadlevel,
|
|
PRSwritelevel: PRSwritelevel,
|
|
ALGreadlevel: ALGreadlevel,
|
|
ALGwritelevel: ALGwritelevel,
|
|
autfunctionkey: autfunctionkey};
|
|
}
|
|
else
|
|
{
|
|
__Log('NOT Authorized for ' + autfunction);
|
|
if (isOptional)
|
|
return null;
|
|
else
|
|
{
|
|
Response.Write("<body><p>" + lcl_no_auth + "</p></body>");
|
|
Response.End;
|
|
}
|
|
}
|
|
oRs.close();
|
|
}
|
|
|
|
// func_enabled
|
|
// result:
|
|
// null als helemaal geen rechten (alles level 9) maar wel isOptional
|
|
// meldig 'U bent niet geauthoriseerd' als helemaal geen rechten en niet isOptional
|
|
// anders ["MLDBOF"].true , ["MLDBO2"].false bijvoorbeeld voor resp. wel en geen schrijfrechten
|
|
// Als autfunction meegegeven dan moeten er ook minstens schrijf(!) rechten zijn volgens autfunction
|
|
Perslid.prototype.func_enabled = function _func_enabled(module, ins_discipline_key, alg_key, prs_key, autfunction)
|
|
{
|
|
var sql;
|
|
|
|
var PRSLevel = -1; // Default heeel ver weg
|
|
// TODO: Bedrijf niveau ondersteunen?
|
|
if (typeof prs_key != "undefined" && prs_key != null)
|
|
{
|
|
if (prs_key==user_key)
|
|
PRSLevel = 8;
|
|
else
|
|
{
|
|
var sql = "SELECT MAX (a.niveau) niveau"
|
|
+ " FROM prs_v_afdeling_familie a, prs_perslid p, prs_v_afdeling_familie aa"
|
|
+ " WHERE p.prs_afdeling_key = a.prs_afdeling_key"
|
|
+ " AND p.prs_perslid_key = " + prs_key // -- de ander
|
|
+ " AND a.prs_afdeling_elder_key = aa.prs_afdeling_elder_key"
|
|
+ " AND aa.prs_afdeling_key = " + this.prs_afdeling_key(); // zelf
|
|
var oRs = Oracle.Execute(sql);
|
|
PRSLevel = oRs("niveau").Value||-1;
|
|
}
|
|
}
|
|
|
|
// TODO: loc_key afzonderlijk ondersteunen
|
|
var ALGLevel = -1; // Default heeel ver weg
|
|
if (typeof alg_key != "undefined" && alg_key != null)
|
|
{
|
|
var sql = "SELECT COALESCE(g.alg_locatie_key, -1) alg_locatie_key"
|
|
+ ", COALESCE(g.alg_gebouw_key, -1) alg_gebouw_key"
|
|
+ ", COALESCE(g.alg_verdieping_key, -1) alg_verdieping_key"
|
|
+ ", COALESCE(g.alg_ruimte_key, -1) alg_ruimte_key"
|
|
+ " FROM alg_v_allonroerendgoed g"
|
|
+ " WHERE g.alg_onroerendgoed_keys(+)="+alg_key
|
|
var oRs = Oracle.Execute(sql);
|
|
var loc = oRs("alg_locatie_key").Value;
|
|
var bld = oRs("alg_gebouw_key").Value;
|
|
var flo = oRs("alg_verdieping_key").Value;
|
|
var room = oRs("alg_ruimte_key").Value;
|
|
if (room != -1) {
|
|
// kijk of room binnen de scope valt
|
|
sql = "SELECT max(niveau)"
|
|
+ " FROM fac_v_my_rooms"
|
|
+ " WHERE prs_perslid_key = " + user_key
|
|
+ " AND alg_ruimte_key = " + room;
|
|
}
|
|
else if (flo != -1) {
|
|
// kijk of flo binnen de scope valt
|
|
sql = "SELECT max(niveau)"
|
|
+ " FROM fac_v_my_floors"
|
|
+ " WHERE prs_perslid_key = " + user_key
|
|
+ " AND alg_verdieping_key = " + flo;
|
|
}
|
|
else if (bld != -1) {
|
|
// kijk of bld binnen de scope valt
|
|
sql = "SELECT max(niveau)"
|
|
+ " FROM fac_v_my_buildings"
|
|
+ " WHERE prs_perslid_key = " + user_key
|
|
+ " AND alg_gebouw_key = " + bld;
|
|
}
|
|
else if (loc != -1) {
|
|
// kijk of loc binnen de scope valt
|
|
sql = "SELECT max(niveau)"
|
|
+ " FROM fac_v_my_locations"
|
|
+ " WHERE prs_perslid_key = " + user_key
|
|
+ " AND alg_locatie_key = " + loc;
|
|
}
|
|
oRs = Oracle.Execute(sql);
|
|
ALGLevel = oRs(0).Value||-1;
|
|
}
|
|
|
|
var sql = "SELECT f.fac_functie_code, fac_functie_min_level"
|
|
+ ", COALESCE(MIN(FAC_GEBRUIKER_PRS_LEVEL_READ ), 9) FAC_GEBRUIKER_PRS_LEVEL_READ"
|
|
+ ", COALESCE(MIN(FAC_GEBRUIKER_PRS_LEVEL_WRITE), 9) FAC_GEBRUIKER_PRS_LEVEL_WRITE"
|
|
+ ", COALESCE(MIN(FAC_GEBRUIKER_ALG_LEVEL_READ ), 9) FAC_GEBRUIKER_ALG_LEVEL_READ"
|
|
+ ", COALESCE(MIN(FAC_GEBRUIKER_ALG_LEVEL_WRITE), 9) FAC_GEBRUIKER_ALG_LEVEL_WRITE"
|
|
+ " FROM fac_v_webgebruiker w, fac_functie f"
|
|
+ " WHERE w.prs_perslid_key = " + this._prs_perslid_key
|
|
+ " AND w.fac_functie_key = f.fac_functie_key"
|
|
+ " AND ins_discipline_key = " + ins_discipline_key
|
|
+ " GROUP BY f.fac_functie_code, fac_functie_min_level"
|
|
|
|
|
|
var func_enabled = { _funcodes: [],
|
|
canWrite : function (funcode)
|
|
{__Log("canWrite " + funcode + ": " + (this._funcodes[funcode]&&this._funcodes[funcode].canWrite));
|
|
return this._funcodes[funcode]&&this._funcodes[funcode].canWrite;
|
|
},
|
|
canRead : function (funcode)
|
|
{
|
|
return this._funcodes[funcode]!=null;
|
|
}
|
|
};
|
|
|
|
var anyfound = false;
|
|
oRs = Oracle.Execute(sql)
|
|
while( !oRs.eof )
|
|
{ // TODO Afhankelijk van fac_functie_minlevel per fac_functie ook iets doen met PRSLevel en ALGLevel.
|
|
var fac_functie_min_level = oRs("fac_functie_min_level").Value;
|
|
|
|
var canRead = (oRs("FAC_GEBRUIKER_ALG_LEVEL_READ")<9 || oRs("FAC_GEBRUIKER_PRS_LEVEL_READ")<9);
|
|
var canWrite = (oRs("FAC_GEBRUIKER_ALG_LEVEL_WRITE")<9 || oRs("FAC_GEBRUIKER_PRS_LEVEL_WRITE")<9);
|
|
if (fac_functie_min_level && 8) // ALG
|
|
{
|
|
canRead = canRead && oRs("FAC_GEBRUIKER_ALG_LEVEL_READ")<= ALGLevel;
|
|
canWrite = canRead && oRs("FAC_GEBRUIKER_ALG_LEVEL_WRITE")<= ALGLevel;
|
|
}
|
|
if (fac_functie_min_level && 4) // PRS
|
|
{
|
|
canRead = canRead && oRs("FAC_GEBRUIKER_PRS_LEVEL_READ")<= PRSLevel;
|
|
canWrite = canRead && oRs("FAC_GEBRUIKER_PRS_LEVEL_WRITE")<= PRSLevel;
|
|
}
|
|
if (canRead)
|
|
{
|
|
func_enabled._funcodes[oRs("fac_functie_code").Value] = { canWrite: canWrite };
|
|
anyfound = true;
|
|
}
|
|
oRs.MoveNext();
|
|
}
|
|
oRs.close();
|
|
if (anyfound)
|
|
{
|
|
if (typeof autfunction != "undefined") // Dan ook schrijfrechten controleren
|
|
{
|
|
anyfound = func_enabled.canWrite(autfunction);
|
|
}
|
|
}
|
|
if (!anyfound)
|
|
{
|
|
__Log('NOT Authorized for ' + module +
|
|
" disc: " + ins_discipline_key +
|
|
" ALGLevel: " + ALGLevel +
|
|
" alg: " + alg_key +
|
|
" prs: " + prs_key +
|
|
" PRSLevel: " + PRSLevel +
|
|
" autfunction: " + autfunction);
|
|
{
|
|
Response.Write("<body><p>" + lcl_no_auth + "</p></body>");
|
|
Response.End;
|
|
}
|
|
};
|
|
|
|
return func_enabled;
|
|
}
|
|
|
|
Perslid.prototype.canWritePerslid = function _canWritePerslid(prs_key, autlevel)
|
|
{
|
|
var sql = "select prs_perslid_key, prs_perslid_verwijder"
|
|
+ " from prs_perslid p"
|
|
+ " where prs_perslid_key = " + prs_key
|
|
if (autlevel == 0)
|
|
sql += " AND p.prs_afdeling_key IN "
|
|
+ " (SELECT a.prs_afdeling_key FROM prs_v_afdeling a "
|
|
+ " WHERE a.prs_bedrijf_key = " + user.afdeling().prs_bedrijf_key() + " )"
|
|
else if (autlevel > 0)
|
|
sql += " AND p.prs_afdeling_key IN "
|
|
+ " (SELECT prs_afdeling_key FROM prs_v_afdeling_familie a"
|
|
+ " WHERE a.prs_afdeling_elder_key IN"
|
|
+ " (SELECT aa.prs_afdeling_elder_key"
|
|
+ " FROM prs_v_afdeling_familie aa"
|
|
+ " WHERE aa.prs_afdeling_key="+user.prs_afdeling_key()
|
|
+ " AND aa.niveau = " + autlevel + "))"
|
|
var oRs = Oracle.Execute(sql);
|
|
var canWrite = (!oRs.eof && oRs("prs_perslid_verwijder").value == null);
|
|
oRs.close();
|
|
|
|
return canWrite;
|
|
}
|
|
|
|
// =================================================================================================
|
|
// =================================================================================================
|
|
|
|
/************************************************************\
|
|
* Bepaal allerlei gegevens van een afdeling
|
|
* Input: afdKey (moet bestaan)
|
|
* Result: Afdeling object
|
|
\************************************************************/
|
|
function Afdeling(afdKey)
|
|
{
|
|
var sql = " SELECT d.prs_afdeling_key"
|
|
+ ", " + prs_dep_string + " naam"
|
|
+ ", COALESCE(d.prs_kostenplaats_key, -1) prs_kostenplaats_key"
|
|
+ ", " + prs_kpn_string + " prs_kpn_string"
|
|
// + ", mld_adres_key"
|
|
+ " FROM prs_v_aanwezigafdeling d"
|
|
+ ", prs_kostenplaats k"
|
|
+ " WHERE d.prs_kostenplaats_key = k.prs_kostenplaats_key(+)"
|
|
+ " AND d.prs_afdeling_key = " + afdKey;
|
|
var oRs = Oracle.Execute(sql);
|
|
|
|
this._prs_afdeling_key = oRs("prs_afdeling_key").value; // afdKey
|
|
this._naam = oRs("naam").value;
|
|
this._prs_kostenplaats_key = oRs("prs_kostenplaats_key").value;
|
|
this._kpn_naam = oRs("prs_kpn_string").value;
|
|
oRs.close();
|
|
}
|
|
|
|
Afdeling.prototype.prs_afdeling_key = function()
|
|
{
|
|
return this._prs_afdeling_key;
|
|
}
|
|
|
|
Afdeling.prototype.prs_kostenplaats_key = function()
|
|
{
|
|
return this._prs_kostenplaats_key;
|
|
}
|
|
|
|
Afdeling.prototype.kpn_string = function()
|
|
{
|
|
if (!this._kpn_string)
|
|
{
|
|
this.kpn_string ="-";
|
|
if (this.prs_kostenplaats_key())
|
|
{
|
|
var oRs = Oracle.Execute("SELECT " + prs_kpn_string + " FROM prs_kostenplaats k"
|
|
+ " WHERE k.prs_kostenplaats_key = "+ this.prs_kostenplaats_key());
|
|
_kpn_string = '' + oRs(0).value;
|
|
oRs.close();
|
|
}
|
|
}
|
|
return this._kpn_string;
|
|
}
|
|
|
|
Afdeling.prototype.naam = function()
|
|
{
|
|
return this._naam;
|
|
}
|
|
Afdeling.prototype.kpn_naam = function()
|
|
{
|
|
return this._kpn_naam;
|
|
}
|
|
|
|
Afdeling.prototype.prs_bedrijf_key = function() // Voorheen user_comp
|
|
{
|
|
if (!this._prs_bedrijf_key)
|
|
{
|
|
var sql = "SELECT ab.prs_bedrijf_key"
|
|
+ " FROM PRS_V_AFDELING_BOOM ab"
|
|
+ " WHERE ab.prs_afdeling_key = " + this._prs_afdeling_key
|
|
var oRs = Oracle.Execute(sql);
|
|
this._prs_bedrijf_key = oRs(0).value;
|
|
oRs.close();
|
|
}
|
|
return this._prs_bedrijf_key;
|
|
}
|
|
|
|
Afdeling.prototype.mld_adres_key = function()
|
|
{
|
|
return this._mld_adres_key;
|
|
}
|
|
/************************************************************\
|
|
* Bepaal allerlei gegevens van een Locatie
|
|
* Input: locKey (moet bestaan)
|
|
* Result: Locatie object
|
|
\************************************************************/
|
|
function Locatie(locKey)
|
|
{
|
|
var sql = " SELECT l.alg_locatie_key"
|
|
+ ", l.alg_locatie_omschrijving naam"
|
|
+ ", " + alg_loc_string + " locatie_string"
|
|
+ ", l.alg_locatie_code"
|
|
+ " FROM alg_v_aanweziglocatie l"
|
|
+ " WHERE l.alg_locatie_key = " + locKey;
|
|
var oRs = Oracle.Execute(sql);
|
|
|
|
this._alg_locatie_key = oRs("alg_locatie_key").value; // locKey
|
|
this._naam = oRs("naam").value;
|
|
this._locatie_string = oRs("locatie_string").value;
|
|
this._alg_locatie_code = oRs("alg_locatie_code").value;
|
|
oRs.close();
|
|
}
|
|
|
|
Locatie.prototype.alg_locatie_key = function()
|
|
{
|
|
return this._alg_locatie_key;
|
|
}
|
|
|
|
Locatie.prototype.naam = function()
|
|
{
|
|
return this._naam;
|
|
}
|
|
|
|
Locatie.prototype.locatie_string = function()
|
|
{
|
|
return this._locatie_string;
|
|
}
|
|
|
|
Locatie.prototype.alg_locatie_code = function()
|
|
{
|
|
return this._alg_locatie_code;
|
|
}
|
|
|
|
/************************************************************\
|
|
* Bepaal allerlei gegevens van een Gebouw
|
|
* Input: bldKey (moet bestaan)
|
|
* Result: Gebouw object
|
|
\************************************************************/
|
|
function Gebouw(bldKey)
|
|
{
|
|
var sql = " SELECT g.alg_gebouw_key"
|
|
+ ", g.alg_gebouw_naam naam"
|
|
+ ", g.alg_gebouw_code"
|
|
+ ", " + prs_kpn_string + " kpn_naam"
|
|
+ ", g.prs_kostenplaats_key"
|
|
+ ", g.mld_adres_key"
|
|
+ " FROM alg_v_aanweziggebouw g, prs_kostenplaats k"
|
|
+ " WHERE g.alg_gebouw_key = " + bldKey
|
|
+ " AND k.prs_kostenplaats_key(+) = g.prs_kostenplaats_key";
|
|
var oRs = Oracle.Execute(sql);
|
|
|
|
this._alg_gebouw_key = oRs("alg_gebouw_key").value; // bldKey
|
|
this._naam = oRs("naam").value;
|
|
this._alg_gebouw_code = oRs("alg_gebouw_code").value;
|
|
this._kpn_naam = oRs("kpn_naam").Value;
|
|
this._prs_kostenplaats_key = oRs("prs_kostenplaats_key").Value;
|
|
this._mld_adres_key = oRs("mld_adres_key").Value;
|
|
oRs.close();
|
|
}
|
|
|
|
Gebouw.prototype.alg_gebouw_key = function()
|
|
{
|
|
return this._alg_gebouw_key;
|
|
}
|
|
|
|
Gebouw.prototype.naam = function()
|
|
{
|
|
return this._naam;
|
|
}
|
|
|
|
Gebouw.prototype.alg_gebouw_code = function()
|
|
{
|
|
return this._alg_gebouw_code;
|
|
}
|
|
|
|
Gebouw.prototype.kpn_naam = function()
|
|
{
|
|
return this._kpn_naam;
|
|
}
|
|
|
|
Gebouw.prototype.prs_kostenplaats_key = function()
|
|
{
|
|
return this._prs_kostenplaats_key;
|
|
}
|
|
Gebouw.prototype.mld_adres_key = function()
|
|
{
|
|
return this._mld_adres_key;
|
|
}
|
|
|
|
/************************************************************\
|
|
* Bepaal allerlei gegevens van een Verdieping
|
|
* Input: flrKey (moet bestaan)
|
|
* Result: Verdieping object
|
|
\************************************************************/
|
|
function Verdieping(flrKey)
|
|
{
|
|
var sql = " SELECT v.alg_verdieping_key"
|
|
+ ", v.alg_verdieping_omschrijving"
|
|
+ ", v.alg_verdieping_code"
|
|
+ " FROM alg_v_aanwezigverdieping v"
|
|
+ " WHERE v.alg_verdieping_key = " + flrKey;
|
|
var oRs = Oracle.Execute(sql);
|
|
|
|
this._alg_verdieping_key = oRs("alg_verdieping_key").value;
|
|
this._alg_verdieping_omschrijving = oRs("alg_verdieping_omschrijving").value;
|
|
this._alg_verdieping_code = oRs("alg_verdieping_code").value;
|
|
oRs.close();
|
|
}
|
|
|
|
Verdieping.prototype.alg_verdieping_key = function()
|
|
{
|
|
return this._alg_verdieping_key;
|
|
}
|
|
|
|
Verdieping.prototype.naam = function()
|
|
{
|
|
return this._alg_verdieping_omschrijving;
|
|
}
|
|
|
|
Verdieping.prototype.alg_verdieping_code = function()
|
|
{
|
|
return this._alg_verdieping_code;
|
|
}
|
|
|
|
/************************************************************\
|
|
* Bepaal allerlei gegevens van een Ruimte
|
|
* Input: roomKey (moet bestaan)
|
|
* Result: Ruimte object
|
|
\************************************************************/
|
|
function Ruimte(roomKey)
|
|
{
|
|
var sql = " SELECT r.alg_ruimte_key"
|
|
+ ", r.alg_ruimte_omschrijving"
|
|
+ ", r.alg_ruimte_nr"
|
|
+ " FROM alg_v_aanwezigruimte r"
|
|
+ " WHERE r.alg_ruimte_key = " + roomKey;
|
|
var oRs = Oracle.Execute(sql);
|
|
|
|
this._alg_ruimte_key = oRs("alg_ruimte_key").value;
|
|
this._alg_ruimte_omschrijving = oRs("alg_ruimte_omschrijving").value;
|
|
this._alg_ruimte_nr = oRs("alg_ruimte_nr").value;
|
|
|
|
oRs.close();
|
|
}
|
|
|
|
Ruimte.prototype.alg_ruimte_key = function()
|
|
{
|
|
return this._alg_ruimte_key;
|
|
}
|
|
|
|
Ruimte.prototype.naam = function()
|
|
{
|
|
return this._alg_ruimte_nr + ' (' + this._alg_ruimte_omschrijving + ')';
|
|
}
|
|
|
|
Ruimte.prototype.alg_ruimte_nr = function()
|
|
{
|
|
return this._alg_ruimte_nr;
|
|
}
|
|
|
|
/************************************************************\
|
|
* Bepaal allerlei gegevens van een Werkplek
|
|
* Input: wpKey (moet bestaan)
|
|
* Result: Werkplek object
|
|
\************************************************************/
|
|
function Werkplek(wpKey)
|
|
{
|
|
var sql = " SELECT w.prs_werkplek_key"
|
|
+ " , w.alg_locatie_key"
|
|
+ " , w.alg_gebouw_key"
|
|
+ " , w.alg_verdieping_key"
|
|
+ " , w.alg_ruimte_key"
|
|
+ " , w.prs_werkplek_omschrijving naam"
|
|
+ " , w.prs_werkplek_volgnr"
|
|
+ " , w.prs_werkplek_aanduiding,"
|
|
+ " (w.ALG_GEBOUW_CODE||' - '"+ "||w.ALG_VERDIEPING_CODE" + "||' - '||w.ALG_RUIMTE_NR) deliveryPlace"
|
|
+ " FROM prs_v_werkplek_gegevens w"
|
|
+ " WHERE w.prs_werkplek_key = " + wpKey;
|
|
var oRs = Oracle.Execute(sql);
|
|
|
|
this._prs_werkplek_key = oRs("prs_werkplek_key").value; // wpKey
|
|
this._alg_locatie_key = oRs("alg_locatie_key").value;
|
|
this._alg_gebouw_key = oRs("alg_gebouw_key").value;
|
|
this._alg_verdieping_key = oRs("alg_verdieping_key").value;
|
|
this._alg_ruimte_key = oRs("alg_ruimte_key").value;
|
|
this._naam = oRs("naam").value;
|
|
this._prs_werkplek_volgnr = oRs("prs_werkplek_volgnr").value;
|
|
this._prs_werkplek_aanduiding = oRs("prs_werkplek_aanduiding").value;
|
|
this._deliveryPlace = oRs("deliveryPlace").value;
|
|
oRs.close();
|
|
}
|
|
|
|
Werkplek.prototype.prs_werkplek_key = function()
|
|
{
|
|
return this._prs_werkplek_key;
|
|
}
|
|
Werkplek.prototype.alg_locatie_key = function()
|
|
{
|
|
return this._alg_locatie_key;
|
|
}
|
|
Werkplek.prototype.alg_locatie_naam = function()
|
|
{
|
|
return (new Locatie(this._alg_locatie_key)).naam();
|
|
}
|
|
|
|
Werkplek.prototype._require_alg_gebouw = function()
|
|
{
|
|
if (typeof this._alg_gebouw == "undefined")
|
|
{
|
|
this._alg_gebouw = new Gebouw(this._alg_gebouw_key);
|
|
}
|
|
}
|
|
|
|
Werkplek.prototype.alg_gebouw_key = function()
|
|
{
|
|
|
|
return this._alg_gebouw_key;
|
|
}
|
|
Werkplek.prototype.alg_gebouw_naam = function()
|
|
{
|
|
this._require_alg_gebouw();
|
|
return this._alg_gebouw.naam();
|
|
}
|
|
Werkplek.prototype.prs_kostenplaats_key = function()
|
|
{
|
|
this._require_alg_gebouw();
|
|
return this._alg_gebouw.prs_kostenplaats_key();
|
|
}
|
|
Werkplek.prototype.kpn_naam = function()
|
|
{
|
|
this._require_alg_gebouw();
|
|
return this._alg_gebouw.kpn_naam();
|
|
}
|
|
Werkplek.prototype.alg_verdieping_key = function()
|
|
{
|
|
return this._alg_verdieping_key;
|
|
}
|
|
Werkplek.prototype.alg_verdieping_naam = function()
|
|
{
|
|
return (new Verdieping(this._alg_verdieping_key)).naam();
|
|
}
|
|
Werkplek.prototype.alg_ruimte_key = function()
|
|
{
|
|
return this._alg_ruimte_key;
|
|
}
|
|
Werkplek.prototype.alg_ruimte_naam = function()
|
|
{
|
|
return (new Ruimte(this._alg_ruimte_key)).naam();
|
|
}
|
|
Werkplek.prototype.deliveryPlace = function()
|
|
{
|
|
return (new Ruimte(this._alg_ruimte_key)).naam();
|
|
}
|
|
Werkplek.prototype.deliveryPlace = function()
|
|
{
|
|
return this._deliveryPlace;
|
|
}
|
|
|
|
Werkplek.prototype.naam = function()
|
|
{
|
|
return this._naam;
|
|
}
|
|
|
|
Werkplek.prototype.prs_werkplek_volgnr = function()
|
|
{
|
|
return this._prs_werkplek_volgnr;
|
|
}
|
|
|
|
Werkplek.prototype.prs_werkplek_aanduiding = function()
|
|
{
|
|
return this._prs_werkplek_aanduiding;
|
|
}
|
|
|
|
%>
|
|
|