You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

165 lines
8.2 KiB

return: text
lang: plpgsql
parameters:
p0:
type: text
name: i_table_code
src: |
DECLARE
result TEXT;
BEGIN
-- Si Toutes les tables, mettre à jour oid par codes
IF (i_table_code = '*ALL') THEN
PERFORM base.cti_initialize_classes_by_code('rh');
PERFORM base.cti_initialize_listes_by_code('rh');
END IF;
IF (i_table_code = 'ANA' OR i_table_code = '*ALL') THEN
EXECUTE 'SELECT base.cti_update_classes(''rh'', ''t_section_analytique'', ''ANA'','''');';
EXECUTE 'SELECT base.cti_update_classes(''rh'', ''p_ventilation_section'', ''ANA'',''section_analytique_section'');';
END IF;
IF (i_table_code = 'AGE' OR i_table_code = '*ALL') THEN
EXECUTE 'SELECT base.cti_update_classes(''rh'', ''t_ages'', ''AGE'','''');';
END IF;
IF (i_table_code = 'ANC' OR i_table_code = '*ALL') THEN
EXECUTE 'SELECT base.cti_update_classes(''rh'', ''t_anciennetes_annee'', ''ANC'','''');';
END IF;
IF (i_table_code = 'CPO' OR i_table_code = '*ALL') THEN
EXECUTE 'SELECT base.cti_update_classes(''rh'', ''t_codes_postaux'', ''CPO'','''');';
END IF;
IF (i_table_code = 'CPT' OR i_table_code = '*ALL') THEN
EXECUTE 'SELECT base.cti_update_classes(''rh'', ''t_compte'', ''CPT'','''');';
END IF;
IF (i_table_code = 'ETS' OR i_table_code = '*ALL') THEN
EXECUTE 'SELECT base.cti_update_classes(''rh'', ''t_etablissements'', ''ETS'','''');';
END IF;
IF (i_table_code = 'COM' OR i_table_code = '*ALL') THEN
EXECUTE 'SELECT base.cti_update_classes(''rh'', ''t_compte'', ''COM'','''');';
END IF;
IF (i_table_code = 'MOA' OR i_table_code = '*ALL') THEN
EXECUTE 'SELECT base.cti_update_classes(''rh'', ''t_motifs_arret'', ''MOA'','''');';
END IF;
IF (i_table_code = 'NAT' OR i_table_code = '*ALL') THEN
EXECUTE 'SELECT base.cti_update_classes(''rh'', ''t_nationalites'', ''NAT'','''');';
END IF;
IF (i_table_code = 'ORC' OR i_table_code = '*ALL') THEN
EXECUTE 'SELECT base.cti_update_classes(''rh'', ''t_organismes_cotisation'', ''ORC'','''');';
END IF;
IF (i_table_code = 'CAE' OR i_table_code = '*ALL') THEN
EXECUTE 'SELECT base.cti_update_classes(''rh'', ''p_profils'', ''CAE'',''cadre_emploi_section'');';
END IF;
IF (i_table_code = 'CAC' OR i_table_code = '*ALL') THEN
EXECUTE 'SELECT base.cti_update_classes(''rh'', ''p_profils'', ''CAC'',''categorie_conge_section'');';
END IF;
IF (i_table_code = 'CSC' OR i_table_code = '*ALL') THEN
EXECUTE 'SELECT base.cti_update_classes(''rh'', ''p_profils'', ''CSC'',''categorie_socio_professionnelle_section'');';
END IF;
IF (i_table_code = 'CAS' OR i_table_code = '*ALL') THEN
EXECUTE 'SELECT base.cti_update_classes(''rh'', ''p_profils'', ''CAS'',''categorie_statutaire_section'');';
END IF;
IF (i_table_code = 'CEM' OR i_table_code = '*ALL') THEN
EXECUTE 'SELECT base.cti_update_classes(''rh'', ''p_profils'', ''CEM'',''code_emploi_section'');';
END IF;
IF (i_table_code = 'GCP' OR i_table_code = '*ALL') THEN
EXECUTE 'SELECT base.cti_update_classes(''rh'', ''p_profils'', ''GCP'',''commission_paritaire_section'');';
END IF;
IF (i_table_code = 'COI' OR i_table_code = '*ALL') THEN
EXECUTE 'SELECT base.cti_update_classes(''rh'', ''p_profils'', ''COI'',''compte_salarie_section'');';
END IF;
IF (i_table_code = 'FIL' OR i_table_code = '*ALL') THEN
EXECUTE 'SELECT base.cti_update_classes(''rh'', ''p_profils'', ''FIL'',''filiere_section'');';
END IF;
IF (i_table_code = 'GCT' OR i_table_code = '*ALL') THEN
EXECUTE 'SELECT base.cti_update_classes(''rh'', ''p_profils'', ''GCT'',''groupe_cotisant_section'');';
END IF;
IF (i_table_code = 'GRG' OR i_table_code = '*ALL') THEN
EXECUTE 'SELECT base.cti_update_classes(''rh'', ''p_profils'', ''GRG'',''grille_groupe_section'');';
END IF;
IF (i_table_code = 'GRI' OR i_table_code = '*ALL') THEN
EXECUTE 'SELECT base.cti_update_classes(''rh'', ''p_profils'', ''GRI'',''grille_section'');';
END IF;
IF (i_table_code = 'LEB' OR i_table_code = '*ALL') THEN
EXECUTE 'SELECT base.cti_update_classes(''rh'', ''p_profils'', ''LEB'',''lettre_budgetaire_section'');';
END IF;
IF (i_table_code = 'MTD' OR i_table_code = '*ALL') THEN
EXECUTE 'SELECT base.cti_update_classes(''rh'', ''p_profils'', ''MTD'',''motif_debut_section'');';
END IF;
IF (i_table_code = 'MTF' OR i_table_code = '*ALL') THEN
EXECUTE 'SELECT base.cti_update_classes(''rh'', ''p_profils'', ''MTF'',''motif_fin_section'');';
END IF;
IF (i_table_code = 'PNI' OR i_table_code = '*ALL') THEN
EXECUTE 'SELECT base.cti_update_classes(''rh'', ''t_planning_niveau'', ''PNI'','''');';
END IF;
IF (i_table_code = 'SER' OR i_table_code = '*ALL') THEN
EXECUTE 'SELECT base.cti_update_classes(''rh'', ''p_profils'', ''SER'',''service_section'');';
EXECUTE 'SELECT base.cti_update_classes(''rh'', ''t_planning_service'', ''SER'',''service_section'');';
END IF;
IF (i_table_code = 'QUA' OR i_table_code = '*ALL') THEN
EXECUTE 'SELECT base.cti_update_classes(''rh'', ''p_profils'', ''QUA'',''qualification_section'');';
EXECUTE 'SELECT base.cti_update_classes(''rh'', ''t_planning_qualification'', ''QUA'',''qualification_section'');';
END IF;
IF (i_table_code = 'SAC' OR i_table_code = '*ALL') THEN
EXECUTE 'SELECT base.cti_update_classes(''rh'', ''p_profils'', ''SAC'',''section_analytique_section'');';
END IF;
IF (i_table_code = 'SAP' OR i_table_code = '*ALL') THEN
EXECUTE 'SELECT base.cti_update_classes(''rh'', ''p_profils'', ''SAP'',''section_analytique_paie_section'');';
END IF;
IF (i_table_code = 'SPE' OR i_table_code = '*ALL') THEN
EXECUTE 'SELECT base.cti_update_classes(''rh'', ''p_profils'', ''SPE'',''specialite_section'');';
END IF;
IF (i_table_code = 'STA' OR i_table_code = '*ALL') THEN
EXECUTE 'SELECT base.cti_update_classes(''rh'', ''p_profils'', ''STA'',''statut_section'');';
END IF;
IF (i_table_code = 'TCN' OR i_table_code = '*ALL') THEN
EXECUTE 'SELECT base.cti_update_classes(''rh'', ''p_profils'', ''TCN'',''type_contrat_section'');';
END IF;
IF (i_table_code = 'THO' OR i_table_code = '*ALL') THEN
EXECUTE 'SELECT base.cti_update_classes(''rh'', ''p_profils'', ''THO'',''type_horaire_section'');';
END IF;
IF (i_table_code = 'TTT' OR i_table_code = '*ALL') THEN
EXECUTE 'SELECT base.cti_update_classes(''rh'', ''p_profils'', ''TTT'',''type_temps_travail_section'');';
END IF;
IF (i_table_code = 'UNF' OR i_table_code = '*ALL') THEN
EXECUTE 'SELECT base.cti_update_classes(''rh'', ''p_profils'', ''UNF'',''unite_fonctionnelle_section'');';
END IF;
IF (i_table_code = 'RUP' OR i_table_code = '*ALL') THEN
EXECUTE 'SELECT base.cti_update_classes(''rh'', ''t_rubriques'', ''RUP'','''');';
END IF;
IF (i_table_code = 'SAL' OR i_table_code = '*ALL') THEN
EXECUTE 'SELECT base.cti_update_classes(''rh'', ''p_salaries'', ''SAL'','''');';
END IF;
IF (i_table_code = 'PQU' OR i_table_code = '*ALL') THEN
EXECUTE 'SELECT base.cti_update_classes(''rh'', ''t_planning_qualification'', ''PQU'','''');';
END IF;
IF (i_table_code = 'PSE' OR i_table_code = '*ALL') THEN
EXECUTE 'SELECT base.cti_update_classes(''rh'', ''t_planning_service'', ''PSE'','''');';
END IF;
IF (i_table_code = 'PAB' OR i_table_code = '*ALL') THEN
EXECUTE 'SELECT base.cti_update_classes(''rh'', ''t_planning_type_absence'', ''PAB'','''');';
END IF;
IF (i_table_code = 'PCH' OR i_table_code = '*ALL') THEN
EXECUTE 'SELECT base.cti_update_classes(''rh'', ''t_planning_code_horaire'', ''PCH'','''');';
END IF;
IF (i_table_code = 'TCN' OR i_table_code = 'TTT' OR i_table_code = '*ALL') THEN
EXECUTE 'SELECT rh.cti_update_effectif_permanent();';
END IF;
IF (i_table_code = 'POLE' OR i_table_code = '*ALL') THEN
PERFORM base.cti_update_classes('base', 't_pole', 'POLE','');
UPDATE rh.t_pole SET
section_id = t_pole.section_id,
section_code = t_pole.section_code,
section_texte = t_pole.section_texte
FROM base.t_pole as t_pole_base
WHERE t_pole.oid = t_pole_base.oid AND
(
t_pole.section_id IS DISTINCT FROM t_pole_base.section_id OR
t_pole.section_code IS DISTINCT FROM t_pole_base.section_code OR
t_pole.section_texte IS DISTINCT FROM t_pole_base.section_texte
)
;
END IF;
RETURN 'OK';
END;