UWVA#18012

svn path=/Database/trunk/; revision=10346
This commit is contained in:
Peter Feij
2010-06-29 05:19:48 +00:00
parent e895063344
commit 863079f911

View File

@@ -1,9 +1,9 @@
#ifdef FAC
/* $Revision: 185 $
* $Modtime: 17-06-10 13:27 $
/* $Revision: 186 $
* $Modtime: 29-06-10 7:12 $
*/
/*
/*
*
* FAC_P_FAC_SAVE_RESTORE: Package voor het bewaren en teruggeven van primary keys binnen triggers.
*
@@ -435,8 +435,8 @@ END fac;
/
CREATE OR REPLACE PACKAGE BODY fac AS
-- This function is to be used instead of the native ADD_MONTHS function
-- If 29, 30 or 31 date doesn't exist in the month then de first of the next month is taken
-- This function is to be used instead of the native ADD_MONTHS function
-- If 29, 30 or 31 date doesn't exist in the month then de first of the next month is taken
FUNCTION addMonths (pdate1 IN DATE, padd_mon IN NUMBER) RETURN DATE IS
pdate2 date;
BEGIN
@@ -626,7 +626,7 @@ CREATE OR REPLACE PACKAGE BODY fac AS
ELSE
RETURN NULL;
END CASE;
IF tab_key IS NULL OR ttype = 'V' OR ttype IS NULL
THEN
sresult := 'SELECT ' || kolomtxt || ' from ' || objectnaam || ' where ' || kolomnaam || '=' || waarde;
@@ -643,12 +643,12 @@ CREATE OR REPLACE PACKAGE BODY fac AS
|| ' AND fac_usrtab_key = '
|| TO_CHAR (tab_key);
END IF;
IF sresult IS NOT NULL
THEN
EXECUTE IMMEDIATE sresult INTO resultvalue;
END IF;
RETURN resultvalue;
END;
@@ -725,7 +725,7 @@ CREATE OR REPLACE PACKAGE BODY fac AS
v_extra_day := 1;
END IF;
END IF;
-- Determine the registered holidays between FROM and TO
SELECT count(*)
@@ -746,7 +746,7 @@ CREATE OR REPLACE PACKAGE BODY fac AS
BEGIN
RETURN count_Work_Days0(pdate1,pdate2, TRUE);
END;
FUNCTION count_Work_Days( pdate1 IN DATE , pdate2 IN DATE ) RETURN NUMBER IS
BEGIN
RETURN count_Work_Days0(pdate1,pdate2, FALSE);
@@ -934,7 +934,7 @@ CREATE OR REPLACE PACKAGE BODY fac AS
v_found BOOLEAN;
BEGIN
v_firstdelim := INSTR (p_parseline, p_fielddelimitor, 1);
IF v_firstdelim = 0
THEN
-- no delimiter found, so this is the last field of the row
@@ -954,7 +954,7 @@ CREATE OR REPLACE PACKAGE BODY fac AS
-- we found a delimiter
p_field := SUBSTR (p_parseline, 1, v_firstdelim - 1);
v_first_quote := INSTR (p_field, '"', 1);
IF v_first_quote <> 1 OR p_field IS NULL
THEN
-- line does not start with a quote or field is empty
@@ -964,12 +964,12 @@ CREATE OR REPLACE PACKAGE BODY fac AS
-- double quote found. Search for the end double quote.
v_found := FALSE;
v_quote_count := 2;
WHILE v_found = FALSE
LOOP
-- look for the next double quote
v_next_quote := INSTR (p_parseline, '"', 1, v_quote_count);
IF v_next_quote = 0
THEN
-- no end quote found. So, it is the last field in the row
@@ -995,7 +995,7 @@ CREATE OR REPLACE PACKAGE BODY fac AS
v_found := TRUE;
ELSE
-- quote without delimiter found
-- this should never happen.
-- this should never happen.
v_quote_count := v_quote_count + 1;
END IF;
END IF;
@@ -1711,7 +1711,7 @@ CREATE OR REPLACE PACKAGE BODY fac AS
fac.imp_writelog (p_applname, p_applrun, 'E', v_errormsg, v_errorhint);
COMMIT;
END;
PROCEDURE imp_mld_delete_mld (p_applname IN VARCHAR2, p_applrun IN VARCHAR2, p_mode IN NUMBER)
AS
v_errormsg VARCHAR2 (1000);
@@ -1719,29 +1719,29 @@ CREATE OR REPLACE PACKAGE BODY fac AS
oracle_err_num NUMBER;
oracle_err_mes VARCHAR2 (200);
BEGIN
delete from mld_opdr;
delete from mld_melding;
delete from mld_stdmelding;
delete from prs_kostensoort;
delete from mld_disc_params;
delete from ins_tab_discipline where ins_discipline_module='MLD';
delete from ins_srtdiscipline;
EXCEPTION
WHEN OTHERS
THEN
oracle_err_num := SQLCODE;
oracle_err_mes := SUBSTR (SQLERRM, 1, 200);
v_errormsg := 'Niet alle servicedesk gegevens zijn verwijderd!';
v_errorhint :=
v_errorhint
|| ' (ORACLE error NUMBER = <'
@@ -2225,18 +2225,18 @@ CREATE OR REPLACE PACKAGE BODY fac AS
FROM DUAL;
INSERT INTO bes_bestelling (
bes_bestelling_key,
bes_bestelling_module,
bes_bestelling_status,
bes_bestelling_datum,
prs_perslid_key,
bes_bestelling_opmerking,
bes_bestelling_ordernr,
bes_bestelling_plaats,
mld_adres_key_lev,
bes_bestelling_item_cnt,
prs_kostenplaats_key,
bes_bestelling_leverdatum,
bes_bestelling_key,
bes_bestelling_module,
bes_bestelling_status,
bes_bestelling_datum,
prs_perslid_key,
bes_bestelling_opmerking,
bes_bestelling_ordernr,
bes_bestelling_plaats,
mld_adres_key_lev,
bes_bestelling_item_cnt,
prs_kostenplaats_key,
bes_bestelling_leverdatum,
bes_bestelling_kosten_klant
)
SELECT lkey_new,
@@ -2260,7 +2260,7 @@ CREATE OR REPLACE PACKAGE BODY fac AS
SELECT lkey_new, bes_kenmerk_key, bes_kenmerkbestell_waarde
FROM bes_kenmerkbestell
WHERE bes_kenmerkbestell_verwijder IS NULL AND bes_bestelling_key = lkey;
bes.setbestellingstatus(lkey_new, 2, NULL);
END CASE;
@@ -2410,7 +2410,7 @@ CREATE OR REPLACE PACKAGE BODY fac AS
RETURN lres;
END;
-- add a trackrecord for action pcode, entity prefkey. pdatum may be NULL
-- Doet niets als er een onbekende pcode wordt meegegeven
PROCEDURE trackaction (pcode VARCHAR2, prefkey NUMBER, puserkey NUMBER, pdatum DATE, poms VARCHAR2)
@@ -2666,13 +2666,15 @@ CREATE OR REPLACE PACKAGE BODY fac AS
RETURN; -- Geen niet bestaande of dirty reserveringen notificeren
END;
-- de afzender
-- de afzender, en moeten we wel?
lnotify := NULL;
BEGIN
-- Bepaal afzender, afhankelijk van catalogus (als res_ruimte) of anders de locatie
-- en check of er voor deze ruimtecatalogus uberhaupt moet worden genotificeerd
IF lres_ruimte_opstel_key IS NOT NULL
THEN
SELECT COALESCE (MAX (d.ins_discipline_email), MAX (l.alg_locatie_email))
INTO lsender
SELECT COALESCE (MAX (d.ins_discipline_email), MAX (l.alg_locatie_email)), MAX(res_disc_params_notify)
INTO lsender, lnotify
FROM res_ruimte_opstelling ro,
res_ruimte rr,
res_alg_ruimte rag,
@@ -2680,13 +2682,15 @@ CREATE OR REPLACE PACKAGE BODY fac AS
alg_verdieping v,
alg_gebouw g,
alg_locatie l,
ins_tab_discipline d
ins_tab_discipline d,
res_disc_params rdp
WHERE l.alg_locatie_key = g.alg_locatie_key
AND g.alg_gebouw_key = v.alg_gebouw_key
AND r.alg_verdieping_key = v.alg_verdieping_key
AND r.alg_ruimte_key = rag.alg_ruimte_key
AND rag.res_ruimte_key = rr.res_ruimte_key
AND d.ins_discipline_key = rr.res_discipline_key
AND rr.res_discipline_key = rdp.res_ins_discipline_key
AND rr.res_ruimte_key = ro.res_ruimte_key
AND ro.res_ruimte_opstel_key = lres_ruimte_opstel_key;
ELSIF lalg_ruimte_key IS NOT NULL
@@ -2706,6 +2710,13 @@ CREATE OR REPLACE PACKAGE BODY fac AS
THEN
lsender := NULL;
END;
-- Reserveringen worden eventueel niet genotificeerd als settings daartoe aanleiding geven.
-- We weten genoeg om te checken of dat zo is
IF (lnotify = 0)
THEN
-- Nothing to do: disc says no
RETURN;
END IF;
lxrefkey := lrefkey; -- de deelreservering
lrefkey := lreskey; -- de hoofdreservering
@@ -2936,7 +2947,7 @@ CREATE OR REPLACE PACKAGE BODY fac AS
AND st.fac_srtnotificatie_code = peventcode
AND fac_tracking_refkey = pkey);
END;
RETURN retkey;
END;
@@ -2954,19 +2965,19 @@ CREATE OR REPLACE PACKAGE BODY fac AS
revisionnr := REPLACE(revisionnr, 'Revision: ','');
UPDATE fac_module
SET fac_module_version = verstring;
UPDATE fac_version
SET fac_version_major = pmaj,
fac_version_minor = pmin,
fac_version_patch = ppatch,
fac_version_revision = revisionnr,
fac_version_date = SYSDATE;
UPDATE fac_message
SET fac_message_text = 'Facilitor ' || verstring || '$' || SUBSTR (prevision, 12, 2)
WHERE fac_message_code = 'FAC_M002';
END IF;
IF plang IS NOT NULL
THEN
UPDATE fac_version
@@ -2980,7 +2991,7 @@ CREATE OR REPLACE PACKAGE BODY fac AS
IF pcustid IS NOT NULL AND pcustnr IS NOT NULL
THEN
UPDATE fac_version
SET fac_version_cust = pcustid,
SET fac_version_cust = pcustid,
fac_version_custnr = pcustnr,
fac_version_date = SYSDATE;
END IF;