FSN#30208 voor usersync hebben we masterbedrijfkey en apikeys nodig

DCOL#29886 automatische interne contractkey

svn path=/Database/trunk/; revision=22508
This commit is contained in:
Peter Feij
2014-09-09 11:48:14 +00:00
parent f5c75ca9b6
commit b73c34e092
2 changed files with 25 additions and 2 deletions

View File

@@ -260,6 +260,7 @@ DEFINE_SETTING('CNT', 0003, 'cnt_contract_limit2' , 'number'
DEFINE_SETTING('CNT', 0003, 'cnt_contract_limit3' , 'number' , '125000' , 'De derde limiet van het contract approval mechanisme')
DEFINE_SETTING('CNT', 0003, 'cnt_approval_all' , 'number' , '0' , 'Goedkeuring contract vereist t.o.v. eerstvolgende limiet (=0 default) of t.o.v. totale kosten (in <20><>n keer)(=1)')
DEFINE_SETTING('CNT', 0003, 'cnt_factuur_totaalmarge' , 'number' , '0' , 'De toegestane marge op de totaal factuur (default 0)')
DEFINE_SETTING('CNT', 0003, 'cnt_internalnr_readonly' , 'number' , '0' , 'Het interne contractnummer wordt automatisch bepaalt en is niet wijzigbaar')
DEFINE_SETTING('FAQ', 0001, 'faq_enabled' , 'number' , '0' , 'Is kennisbank available {0 | 1} licensed separately')
DEFINE_SETTING('FAQ', 0003, 'faq_max_results' , 'number' , '10' , 'Limit the result to this number')
DEFINE_SETTING('FAQ', 0003, 'faq_kennisbank_popup' , 'number' , '3' , 'Show kennisbank popup {0=no | 01=1=FE | 10=2=FO | 11=3=FE+FO}')
@@ -443,6 +444,7 @@ DEFINE_SETTING('RES', 0003, 'res_reservering_flags' , 'number'
DEFINE_SETTING('RES', 0001, 'res_remoteurl_refuse' , 'string' , '' , 'Regexp, do not jump to these remote url (future use)')
DEFINE_SETTING('RES', 0003, 'res_strict_locfilter' , 'boolean' , 'false' , 'Do not show locations without catering. Can be extremely slow!')
DEFINE_SETTING('RES', 0003, 'res_cat_with_expired_room' , 'boolean' , 'false' , 'Can catering be edited when room is expired {false | true}')
DEFINE_SETTING('RES', 0003, 'res_allow_multi_cat' , 'boolean' , 'false' , 'Can catering be done on multi day reservation {false | true}')
DEFINE_SETTING('BEZ', 0003, 'vis_h' , 'float' , '0.25' , 'time stepsize')
DEFINE_SETTING('BEZ', 0003, 'vis_t1' , 'float' , '8' , 'visitors day start (hour)')
DEFINE_SETTING('BEZ', 0003, 'vis_t2' , 'float' , '18' , 'visitors day end (hour)')
@@ -507,7 +509,8 @@ DEFINE_SETTING('FAC', 0001, 'fac_api_allow_impersonate' , 'boolean'
DEFINE_SETTING('FAC', 0003, 'prs_bulk_mail_max' , 'number' , '0' , 'Maximum number of persons to be mailed')
DEFINE_SETTING('FAC', 0001, 'fac_pdf_printer' , 'number' , '0' , 'PDF Printer support bits (future use)')
DEFINE_SETTING('FAC', 0003, 'progress_notification_for' , 'boolean' , 'false' , 'Send progress notification to [false=prs_perslid_key | true=prs_perslid_key_voor]')
DEFINE_SETTING('FAC', 0001, 'secundarydomainurls' , 'array' , '' , 'Array of root-urls of related secondary domains (for ServiceProvidersPortal')
DEFINE_SETTING('FAC', 0001, 'xd_secundarydomainurls' , 'array' , '' , 'Array of root-urls of related secondary domains (for ServiceProvidersPortal)')
DEFINE_SETTING('FAC', 0001, 'xd_primary_bedrijfkey' , 'number' , '-1' , 'bedrijf_key of this Service Organisation (for ServiceProvidersPortal)')
/*
*

View File

@@ -103,7 +103,27 @@ CREATE_TRIGGER(prs_t_prs_perslid_B_I)
BEFORE INSERT ON prs_perslid
FOR EACH ROW
BEGIN
UPDATE_PRIMARY_KEY(prs_perslid_key, prs_s_prs_alluitvoerende_keys);
UPDATE_PRIMARY_KEY(prs_perslid_key, prs_s_prs_alluitvoerende_keys);
-- If this perslid belongs to the primary company of an xd-environment
-- it gets a default apikey to get synced across the domains
IF :new.prs_perslid_apikey IS NULL AND fac.getsetting ('xd_primary_bedrijfkey') > 0
THEN
DECLARE
dummy prs_afdeling.prs_bedrijf_key%TYPE;
BEGIN
SELECT prs_bedrijf_key
INTO dummy
FROM prs_afdeling
WHERE prs_afdeling_key = :new.prs_afdeling_key
AND prs_afdeling.prs_bedrijf_key = fac.getsetting ('xd_primary_bedrijfkey');
-- 52 lower en uppercase letters*32 is 182 bits equivalent
SELECT DBMS_RANDOM.string ('a', 32) INTO :new.prs_perslid_apikey FROM DUAL;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
NULL; -- persoon hoort niet bij de serviceorganisatie
END;
END IF;
END;
/