/* $Id$ */
/*============================================================================*
 |                 Copyright (c) 2017 Applaud Solutions UK Ltd                |
 |                             All rights reserved                            |
 *===========================================================================*/

SET VERIFY OFF
SET FEEDBACK OFF
WHENEVER OSERROR  EXIT FAILURE ROLLBACK
WHENEVER SQLERROR EXIT FAILURE ROLLBACK

DECLARE

  CURSOR csr_count
  IS
  SELECT count(*)
  FROM   xxas_form_field_triggers;

  CURSOR csr_trigger_count(cp_trigger_name IN varchar2)
  IS
  SELECT count(*)
  FROM   xxas_form_field_triggers
  WHERE  trigger_name = cp_trigger_name;

  l_triggers_count        number;
  l_trigger_count         number;

BEGIN

  OPEN  csr_count;
  FETCH csr_count INTO l_triggers_count;
  CLOSE csr_count;

  IF l_triggers_count = 0 THEN

    INSERT INTO xxas_form_field_triggers
      (trigger_name
      ,function_handler
      ,creation_date
      ,created_by
      ,last_update_date
      ,last_updated_by
      ,last_update_login)
    VALUES
      ('ABS_DURATION_CALC_OL_ABS'
      ,'xxas_absence_event_pkg.dur_cal_ol_abs_trigger_handler'
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,fnd_global.login_id);

    INSERT INTO xxas_form_field_triggers
      (trigger_name
      ,function_handler
      ,creation_date
      ,created_by
      ,last_update_date
      ,last_updated_by
      ,last_update_login)
    VALUES
      ('TCM_PAYMENT_TYPES_OL_TCM'
      ,'xxas_timecard_entry_pkg.payment_types_ol_tcm_handler'
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,fnd_global.login_id);

    INSERT INTO xxas_form_field_triggers
      (trigger_name
      ,function_handler
      ,creation_date
      ,created_by
      ,last_update_date
      ,last_updated_by
      ,last_update_login)
    VALUES
      ('TCM_DURATION_CALC_OL_TIMECARDS'
      ,'xxas_timecard_entry_pkg.dur_ol_tcm_trigger_handler'
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,fnd_global.login_id);

    INSERT INTO xxas_form_field_triggers
      (trigger_name
      ,function_handler
      ,creation_date
      ,created_by
      ,last_update_date
      ,last_updated_by
      ,last_update_login)
    VALUES
      ('ABS_DATE_TIME_SHOW_HIDE_REASONS'
      ,'xxas_absence_event_pkg.show_or_hide_dates_reasons'
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,fnd_global.login_id);

    INSERT INTO xxas_form_field_triggers
      (trigger_name
      ,function_handler
      ,creation_date
      ,created_by
      ,last_update_date
      ,last_updated_by
      ,last_update_login)
    VALUES
      ('TCM_SUMMARY_MSG_OL_TIMECARDS'
      ,'xxas_timecard_entry_pkg.summary_msg_ol_tcm_handler'
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,fnd_global.login_id);

  END IF;

  OPEN  csr_trigger_count('TCM_ASSIGNMENT_PERIOD_SUMMARY');
  FETCH csr_trigger_count INTO l_trigger_count;
  CLOSE csr_trigger_count;

  IF l_trigger_count = 0 THEN

    INSERT INTO xxas_form_field_triggers
      (trigger_name
      ,function_handler
      ,creation_date
      ,created_by
      ,last_update_date
      ,last_updated_by
      ,last_update_login)
    VALUES
      ('TCM_ASSIGNMENT_PERIOD_SUMMARY'
      ,'xxas_timecard_entry_pkg.asg_period_summary_handler'
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,fnd_global.login_id);

  END IF;

  OPEN  csr_trigger_count('TCM_DYNAMIC_FIELDS_GEN');
  FETCH csr_trigger_count INTO l_trigger_count;
  CLOSE csr_trigger_count;

  IF l_trigger_count = 0 THEN

    INSERT INTO xxas_form_field_triggers
      (trigger_name
      ,function_handler
      ,creation_date
      ,created_by
      ,last_update_date
      ,last_updated_by
      ,last_update_login)
    VALUES
      ('TCM_DYNAMIC_FIELDS_GEN'
      ,'xxas_timecard_entry_pkg.dynamic_fields_gen_handler'
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,fnd_global.login_id);

  END IF;

  OPEN  csr_trigger_count('TCM_COPY_TIME_FROM_PERIODS');
  FETCH csr_trigger_count INTO l_trigger_count;
  CLOSE csr_trigger_count;

  IF l_trigger_count = 0 THEN

    INSERT INTO xxas_form_field_triggers
      (trigger_name
      ,function_handler
      ,creation_date
      ,created_by
      ,last_update_date
      ,last_updated_by
      ,last_update_login)
    VALUES
      ('TCM_COPY_TIME_FROM_PERIODS'
      ,'xxas_timecard_entry_pkg.copy_time_from_periods_handler'
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,fnd_global.login_id);

  END IF;

  OPEN  csr_trigger_count('TCM_COPY_TIME_TO_PERIODS');
  FETCH csr_trigger_count INTO l_trigger_count;
  CLOSE csr_trigger_count;

  IF l_trigger_count = 0 THEN

    INSERT INTO xxas_form_field_triggers
      (trigger_name
      ,function_handler
      ,creation_date
      ,created_by
      ,last_update_date
      ,last_updated_by
      ,last_update_login)
    VALUES
      ('TCM_COPY_TIME_TO_PERIODS'
      ,'xxas_timecard_entry_pkg.copy_time_to_periods_handler'
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,fnd_global.login_id);

  END IF;

  OPEN  csr_trigger_count('TCM_PER_FROM_PERIOD_SUMMARY');
  FETCH csr_trigger_count INTO l_trigger_count;
  CLOSE csr_trigger_count;

  IF l_trigger_count = 0 THEN

    INSERT INTO xxas_form_field_triggers
      (trigger_name
      ,function_handler
      ,creation_date
      ,created_by
      ,last_update_date
      ,last_updated_by
      ,last_update_login)
    VALUES
      ('TCM_PER_FROM_PERIOD_SUMMARY'
      ,'xxas_timecard_entry_pkg.per_from_period_sum_handler'
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,fnd_global.login_id);

  END IF;

  OPEN  csr_trigger_count('TCM_PER_TO_PERIOD_SUMMARY');
  FETCH csr_trigger_count INTO l_trigger_count;
  CLOSE csr_trigger_count;

  IF l_trigger_count = 0 THEN

    INSERT INTO xxas_form_field_triggers
      (trigger_name
      ,function_handler
      ,creation_date
      ,created_by
      ,last_update_date
      ,last_updated_by
      ,last_update_login)
    VALUES
      ('TCM_PER_TO_PERIOD_SUMMARY'
      ,'xxas_timecard_entry_pkg.per_to_period_sum_handler'
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,fnd_global.login_id);

  END IF;

  OPEN  csr_trigger_count('TCM_TIMES_CAL_ON_DURATION');
  FETCH csr_trigger_count INTO l_trigger_count;
  CLOSE csr_trigger_count;

  IF l_trigger_count = 0 THEN

    INSERT INTO xxas_form_field_triggers
      (trigger_name
      ,function_handler
      ,creation_date
      ,created_by
      ,last_update_date
      ,last_updated_by
      ,last_update_login)
    VALUES
      ('TCM_TIMES_CAL_ON_DURATION'
      ,'xxas_timecard_entry_pkg.times_based_on_dur_handler'
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,fnd_global.login_id);

  END IF;
  
  OPEN  csr_trigger_count('WL_NOTIFIC_DYNAMIC_BUTTON');
  FETCH csr_trigger_count INTO l_trigger_count;
  CLOSE csr_trigger_count;
  
  IF l_trigger_count = 0 THEN

    INSERT INTO xxas_form_field_triggers
      (trigger_name
      ,function_handler
      ,creation_date
      ,created_by
      ,last_update_date
      ,last_updated_by
      ,last_update_login)
    VALUES
      ('WL_NOTIFIC_DYNAMIC_BUTTON'
      ,'xxas_com_worklist_pkg.dynamic_submit_handler'
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,fnd_global.login_id);

  END IF;
  
  OPEN  csr_trigger_count('WL_NOTIF_VAC_RULES');
  FETCH csr_trigger_count INTO l_trigger_count;
  CLOSE csr_trigger_count;
  IF l_trigger_count = 0 THEN

    INSERT INTO xxas_form_field_triggers
      (trigger_name
      ,function_handler
      ,creation_date
      ,created_by
      ,last_update_date
      ,last_updated_by
      ,last_update_login)
    VALUES
      ('WL_NOTIF_VAC_RULES'
      ,'xxas_com_worklist_pkg.dynamic_fields_vac_rule_desc'
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,fnd_global.login_id);

  END IF;
  
    OPEN  csr_trigger_count('WL_NOTIF_VAC_ACTION_DEC');
  FETCH csr_trigger_count INTO l_trigger_count;
  CLOSE csr_trigger_count;

  IF l_trigger_count = 0 THEN

    INSERT INTO xxas_form_field_triggers
      (trigger_name
      ,function_handler
      ,creation_date
      ,created_by
      ,last_update_date
      ,last_updated_by
      ,last_update_login)
    VALUES
      ('WL_NOTIF_VAC_ACTION_DEC'
      ,'xxas_com_worklist_pkg.dynamic_wl_vac_not_desc'
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,fnd_global.login_id);

  END IF;
  
   OPEN  csr_trigger_count('WL_NOTIF_VAC_RESPONSE_TYPE');
  FETCH csr_trigger_count INTO l_trigger_count;
  CLOSE csr_trigger_count;

  IF l_trigger_count = 0 THEN

    INSERT INTO xxas_form_field_triggers
      (trigger_name
      ,function_handler
      ,creation_date
      ,created_by
      ,last_update_date
      ,last_updated_by
      ,last_update_login)
    VALUES
      ('WL_NOTIF_VAC_RESPONSE_TYPE'
      ,'xxas_com_worklist_pkg.dynamic_vac_rul_response'
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,fnd_global.login_id);

  END IF;
  
  OPEN  csr_trigger_count('WL_NOTIF_VAC_RESPONSE_LOV');
  FETCH csr_trigger_count INTO l_trigger_count;
  CLOSE csr_trigger_count;

  IF l_trigger_count = 0 THEN

    INSERT INTO xxas_form_field_triggers
      (trigger_name
      ,function_handler
      ,creation_date
      ,created_by
      ,last_update_date
      ,last_updated_by
      ,last_update_login)
    VALUES
      ('WL_NOTIF_VAC_RESPONSE_LOV'
      ,'xxas_com_worklist_pkg.dynamic_vac_rul_lov'
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,fnd_global.login_id);

  END IF;

  
  OPEN  csr_trigger_count('WL_NOTIFIC_REASSIGN_DESC');
  FETCH csr_trigger_count INTO l_trigger_count;
  CLOSE csr_trigger_count;

  IF l_trigger_count = 0 THEN

    INSERT INTO xxas_form_field_triggers
      (trigger_name
      ,function_handler
      ,creation_date
      ,created_by
      ,last_update_date
      ,last_updated_by
      ,last_update_login)
    VALUES
      ('WL_NOTIFIC_REASSIGN_DESC'
      ,'xxas_com_worklist_pkg.dynamic_reassign_desc'
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,fnd_global.login_id);

  END IF;

  OPEN  csr_trigger_count('CHG_PAY_COMPONENT_AMOUNT');
  FETCH csr_trigger_count INTO l_trigger_count;
  CLOSE csr_trigger_count;

  IF l_trigger_count = 0 THEN

    INSERT INTO xxas_form_field_triggers
      (trigger_name
      ,function_handler
      ,creation_date
      ,created_by
      ,last_update_date
      ,last_updated_by
      ,last_update_login)
    VALUES
      ('CHG_PAY_COMPONENT_AMOUNT'
      ,'xxas_change_pay_pkg.salary_calc_comp_percent'
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,fnd_global.login_id);

  END IF;

  OPEN  csr_trigger_count('ABS_DUR_CALC_OL_ABS_ACR_BAL');
  FETCH csr_trigger_count INTO l_trigger_count;
  CLOSE csr_trigger_count;

  IF l_trigger_count = 0 THEN

    INSERT INTO xxas_form_field_triggers
      (trigger_name
      ,function_handler
      ,creation_date
      ,created_by
      ,last_update_date
      ,last_updated_by
      ,last_update_login)
    VALUES
      ('ABS_DUR_CALC_OL_ABS_ACR_BAL'
      ,'xxas_absence_event_pkg.dur_cal_ol_acr_bal_abs_handler'
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,fnd_global.login_id);

  END IF;

  OPEN  csr_trigger_count('ABS_DATE_TIME_SHOW_REASONS_ACR_BAL');
  FETCH csr_trigger_count INTO l_trigger_count;
  CLOSE csr_trigger_count;

  IF l_trigger_count = 0 THEN

    INSERT INTO xxas_form_field_triggers
      (trigger_name
      ,function_handler
      ,creation_date
      ,created_by
      ,last_update_date
      ,last_updated_by
      ,last_update_login)
    VALUES
      ('ABS_DATE_TIME_SHOW_REASONS_ACR_BAL'
      ,'xxas_absence_event_pkg.show_dates_reasons_acr_bal'
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,fnd_global.login_id);

  END IF;

  OPEN  csr_trigger_count('ABS_PROJ_BAL_ACCR_PLAN');
  FETCH csr_trigger_count INTO l_trigger_count;
  CLOSE csr_trigger_count;

  IF l_trigger_count = 0 THEN

    INSERT INTO xxas_form_field_triggers
      (trigger_name
      ,function_handler
      ,creation_date
      ,created_by
      ,last_update_date
      ,last_updated_by
      ,last_update_login)
    VALUES
      ('ABS_PROJ_BAL_ACCR_PLAN'
      ,'xxas_absence_event_pkg.project_bal_accr_plan_handler'
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,fnd_global.login_id);

  END IF;

  OPEN  csr_trigger_count('OTL_SUMMARY_MSG_OL_TIMECARDS');
  FETCH csr_trigger_count INTO l_trigger_count;
  CLOSE csr_trigger_count;

  IF l_trigger_count = 0 THEN

    INSERT INTO xxas_form_field_triggers
      (trigger_name
      ,function_handler
      ,creation_date
      ,created_by
      ,last_update_date
      ,last_updated_by
      ,last_update_login)
    VALUES
      ('OTL_SUMMARY_MSG_OL_TIMECARDS'
      ,'xxas_otl_timecard_entry_pkg.summary_msg_ol_tcm_handler'
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,fnd_global.login_id);

  END IF;

  OPEN  csr_trigger_count('OTL_HOURSTYPE_OL_TIMECARDS');
  FETCH csr_trigger_count INTO l_trigger_count;
  CLOSE csr_trigger_count;

  IF l_trigger_count = 0 THEN

    INSERT INTO xxas_form_field_triggers
      (trigger_name
      ,function_handler
      ,creation_date
      ,created_by
      ,last_update_date
      ,last_updated_by
      ,last_update_login)
    VALUES
      ('OTL_HOURSTYPE_OL_TIMECARDS'
      ,'xxas_otl_timecard_entry_pkg.hourstype_ol_timecard_handler'
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,fnd_global.login_id);

  END IF;

  OPEN  csr_trigger_count('OTL_DURATION_CALC_OL_TIMECARDS');
  FETCH csr_trigger_count INTO l_trigger_count;
  CLOSE csr_trigger_count;

  IF l_trigger_count = 0 THEN

    INSERT INTO xxas_form_field_triggers
      (trigger_name
      ,function_handler
      ,creation_date
      ,created_by
      ,last_update_date
      ,last_updated_by
      ,last_update_login)
    VALUES
      ('OTL_DURATION_CALC_OL_TIMECARDS'
      ,'xxas_otl_timecard_entry_pkg.dur_ol_timecard_handler'
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,fnd_global.login_id);

  END IF;

  OPEN  csr_trigger_count('OTL_TIMES_CAL_ON_DURATION');
  FETCH csr_trigger_count INTO l_trigger_count;
  CLOSE csr_trigger_count;

  IF l_trigger_count = 0 THEN

    INSERT INTO xxas_form_field_triggers
      (trigger_name
      ,function_handler
      ,creation_date
      ,created_by
      ,last_update_date
      ,last_updated_by
      ,last_update_login)
    VALUES
      ('OTL_TIMES_CAL_ON_DURATION'
      ,'xxas_otl_timecard_entry_pkg.times_based_on_dur_handler'
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,fnd_global.login_id);

  END IF;
  
  OPEN  csr_trigger_count('CICO_JOB_PAYMENT');
  FETCH csr_trigger_count INTO l_trigger_count;
  CLOSE csr_trigger_count;
  
  IF l_trigger_count = 0 THEN

    INSERT INTO xxas_form_field_triggers
      (trigger_name
      ,function_handler
      ,creation_date
      ,created_by
      ,last_update_date
      ,last_updated_by
      ,last_update_login)
    VALUES
      ('CICO_JOB_PAYMENT'
      ,'xxas_cico_entry_pkg.dynamic_payment_types'
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,fnd_global.login_id);

  END IF;

  OPEN  csr_trigger_count('TCM_DYNAMIC_WEEKLY_FIELDS_DATA');
  FETCH csr_trigger_count INTO l_trigger_count;
  CLOSE csr_trigger_count;

  IF l_trigger_count = 0 THEN

    INSERT INTO xxas_form_field_triggers
      (trigger_name
      ,function_handler
      ,creation_date
      ,created_by
      ,last_update_date
      ,last_updated_by
      ,last_update_login)
    VALUES
      ('TCM_DYNAMIC_WEEKLY_FIELDS_DATA'
      ,'xxas_timecard_entry_pkg.dynamic_weekly_fields_data'
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,fnd_global.login_id);

  END IF;

  OPEN  csr_trigger_count('TCM_DYNAMIC_INPUT_FIELDS_DATA');
  FETCH csr_trigger_count INTO l_trigger_count;
  CLOSE csr_trigger_count;

  IF l_trigger_count = 0 THEN

    INSERT INTO xxas_form_field_triggers
      (trigger_name
      ,function_handler
      ,creation_date
      ,created_by
      ,last_update_date
      ,last_updated_by
      ,last_update_login)
    VALUES
      ('TCM_DYNAMIC_INPUT_FIELDS_DATA'
      ,'xxas_timecard_entry_pkg.dynamic_input_fields_data'
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,fnd_global.login_id);

  END IF;

  OPEN  csr_trigger_count('TCM_DYNAMIC_ENTRIES_DATA');
  FETCH csr_trigger_count INTO l_trigger_count;
  CLOSE csr_trigger_count;

  IF l_trigger_count = 0 THEN

    INSERT INTO xxas_form_field_triggers
      (trigger_name
      ,function_handler
      ,creation_date
      ,created_by
      ,last_update_date
      ,last_updated_by
      ,last_update_login)
    VALUES
      ('TCM_DYNAMIC_ENTRIES_DATA'
      ,'xxas_timecard_entry_pkg.dynamic_entries_data'
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,fnd_global.login_id);

  END IF;

  OPEN  csr_trigger_count('XXAS_APPL_STATUS_CHANGE');
  FETCH csr_trigger_count INTO l_trigger_count;
  CLOSE csr_trigger_count;
  
  IF l_trigger_count = 0 THEN

    INSERT INTO xxas_form_field_triggers
      (trigger_name
      ,function_handler
      ,creation_date
      ,created_by
      ,last_update_date
      ,last_updated_by
      ,last_update_login)
    VALUES
      ('XXAS_APPL_STATUS_CHANGE'
      ,'xxas_applicant_events_pkg.change_status'
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,fnd_global.login_id);

  END IF;

  OPEN  csr_trigger_count('NEW_HIRE_GET_FIRST_NAME');
  FETCH csr_trigger_count INTO l_trigger_count;
  CLOSE csr_trigger_count;
  
  IF l_trigger_count = 0 THEN

    INSERT INTO xxas_form_field_triggers
      (trigger_name
      ,function_handler
      ,creation_date
      ,created_by
      ,last_update_date
      ,last_updated_by
      ,last_update_login)
    VALUES
      ('NEW_HIRE_GET_FIRST_NAME'
      ,'xxas_new_hire_pkg.get_first_name'
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,fnd_global.login_id);

  END IF;

  OPEN  csr_trigger_count('NEW_HIRE_GET_DOB');
  FETCH csr_trigger_count INTO l_trigger_count;
  CLOSE csr_trigger_count;
  
  IF l_trigger_count = 0 THEN

    INSERT INTO xxas_form_field_triggers
      (trigger_name
      ,function_handler
      ,creation_date
      ,created_by
      ,last_update_date
      ,last_updated_by
      ,last_update_login)
    VALUES
      ('NEW_HIRE_GET_DOB'
      ,'xxas_new_hire_pkg.get_dob'
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,fnd_global.login_id);

  END IF;

  OPEN  csr_trigger_count('NEW_HIRE_GET_LOC_ID');
  FETCH csr_trigger_count INTO l_trigger_count;
  CLOSE csr_trigger_count;
  
  IF l_trigger_count = 0 THEN

    INSERT INTO xxas_form_field_triggers
      (trigger_name
      ,function_handler
      ,creation_date
      ,created_by
      ,last_update_date
      ,last_updated_by
      ,last_update_login)
    VALUES
      ('NEW_HIRE_GET_LOC_ID'
      ,'xxas_new_hire_pkg.get_location_from_org_id'
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,fnd_global.login_id);

  END IF;

  OPEN  csr_trigger_count('MGR_NEW_HIRE_PER_DUP_CHK');
  FETCH csr_trigger_count INTO l_trigger_count;
  CLOSE csr_trigger_count;
  
  IF l_trigger_count = 0 THEN

    INSERT INTO xxas_form_field_triggers
      (trigger_name
      ,function_handler
      ,creation_date
      ,created_by
      ,last_update_date
      ,last_updated_by
      ,last_update_login)
    VALUES
      ('MGR_NEW_HIRE_PER_DUP_CHK'
      ,'xxas_new_hire_pkg.Person_dup_chk_handler'
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,fnd_global.login_id);

  END IF;

  OPEN  csr_trigger_count('MGR_NEW_HIRE_PER_DUP_SEL');
  FETCH csr_trigger_count INTO l_trigger_count;
  CLOSE csr_trigger_count;
  
  IF l_trigger_count = 0 THEN

    INSERT INTO xxas_form_field_triggers
      (trigger_name
      ,function_handler
      ,creation_date
      ,created_by
      ,last_update_date
      ,last_updated_by
      ,last_update_login)
    VALUES
      ('MGR_NEW_HIRE_PER_DUP_SEL'
      ,'xxas_new_hire_pkg.Person_dup_sel_handler'
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,fnd_global.login_id);

  END IF;
  
  OPEN  csr_trigger_count('NEW_HIRE_BUSINESS_GROUP');
  FETCH csr_trigger_count INTO l_trigger_count;
  CLOSE csr_trigger_count;
  
  IF l_trigger_count = 0 THEN

    INSERT INTO xxas_form_field_triggers
      (trigger_name
      ,function_handler
      ,creation_date
      ,created_by
      ,last_update_date
      ,last_updated_by
      ,last_update_login)
    VALUES
      ('NEW_HIRE_BUSINESS_GROUP'
      ,'xxas_new_hire_pkg.get_business_group'
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,fnd_global.login_id);

  END IF;

  OPEN  csr_trigger_count('NEW_HIRE_LAST_NAME');
  FETCH csr_trigger_count INTO l_trigger_count;
  CLOSE csr_trigger_count;
  
  IF l_trigger_count = 0 THEN

    INSERT INTO xxas_form_field_triggers
      (trigger_name
      ,function_handler
      ,creation_date
      ,created_by
      ,last_update_date
      ,last_updated_by
      ,last_update_login)
    VALUES
      ('NEW_HIRE_LAST_NAME'
      ,'xxas_new_hire_pkg.get_last_name'
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,fnd_global.login_id);

  END IF;

  OPEN  csr_trigger_count('NEW_HIRE_START_DATE');
  FETCH csr_trigger_count INTO l_trigger_count;
  CLOSE csr_trigger_count;
  
  IF l_trigger_count = 0 THEN

    INSERT INTO xxas_form_field_triggers
      (trigger_name
      ,function_handler
      ,creation_date
      ,created_by
      ,last_update_date
      ,last_updated_by
      ,last_update_login)
    VALUES
      ('NEW_HIRE_START_DATE'
      ,'xxas_new_hire_pkg.get_start_date'
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,fnd_global.login_id);

  END IF;

  OPEN  csr_trigger_count('MGR_NEW_HIRE_PAY_CHG');
  FETCH csr_trigger_count INTO l_trigger_count;
  CLOSE csr_trigger_count;
  
  IF l_trigger_count = 0 THEN

    INSERT INTO xxas_form_field_triggers
      (trigger_name
      ,function_handler
      ,creation_date
      ,created_by
      ,last_update_date
      ,last_updated_by
      ,last_update_login)
    VALUES
      ('MGR_NEW_HIRE_PAY_CHG'
      ,'xxas_new_hire_pkg.get_salary_details'
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,fnd_global.login_id);

  END IF;

  OPEN  csr_trigger_count('MGR_NEW_HIRE_PAY_COMP_CHG');
  FETCH csr_trigger_count INTO l_trigger_count;
  CLOSE csr_trigger_count;
  
  IF l_trigger_count = 0 THEN

    INSERT INTO xxas_form_field_triggers
      (trigger_name
      ,function_handler
      ,creation_date
      ,created_by
      ,last_update_date
      ,last_updated_by
      ,last_update_login)
    VALUES
      ('MGR_NEW_HIRE_PAY_COMP_CHG'
      ,'xxas_new_hire_pkg.get_change_by_comp'
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,fnd_global.login_id);

  END IF;

  OPEN  csr_trigger_count('MGR_NEW_HIRE_PAY_COMP_CHG_DET');
  FETCH csr_trigger_count INTO l_trigger_count;
  CLOSE csr_trigger_count;
  
  IF l_trigger_count = 0 THEN

    INSERT INTO xxas_form_field_triggers
      (trigger_name
      ,function_handler
      ,creation_date
      ,created_by
      ,last_update_date
      ,last_updated_by
      ,last_update_login)
    VALUES
      ('MGR_NEW_HIRE_PAY_COMP_CHG_DET'
      ,'xxas_new_hire_pkg.get_change_comp_details'
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,fnd_global.login_id);

  END IF;

  OPEN  csr_trigger_count('MGR_NEW_HIRE_NEW_DR_COMP');
  FETCH csr_trigger_count INTO l_trigger_count;
  CLOSE csr_trigger_count;
  
  IF l_trigger_count = 0 THEN

    INSERT INTO xxas_form_field_triggers
      (trigger_name
      ,function_handler
      ,creation_date
      ,created_by
      ,last_update_date
      ,last_updated_by
      ,last_update_login)
    VALUES
      ('MGR_NEW_HIRE_NEW_DR_COMP'
      ,'xxas_new_hire_pkg.get_dr_container'
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,fnd_global.login_id);

  END IF;

  OPEN  csr_trigger_count('MGR_NH_PAY_SAL_COMP_CHG');
  FETCH csr_trigger_count INTO l_trigger_count;
  CLOSE csr_trigger_count;
  
  IF l_trigger_count = 0 THEN

    INSERT INTO xxas_form_field_triggers
      (trigger_name
      ,function_handler
      ,creation_date
      ,created_by
      ,last_update_date
      ,last_updated_by
      ,last_update_login)
    VALUES
      ('MGR_NH_PAY_SAL_COMP_CHG'
      ,'xxas_new_hire_pkg.salary_calc_comp_percent'
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,fnd_global.login_id);

  END IF;

  OPEN  csr_trigger_count('MGR_NH_PHONE_NO_DEFAULT');
  FETCH csr_trigger_count INTO l_trigger_count;
  CLOSE csr_trigger_count;
  
  IF l_trigger_count = 0 THEN

    INSERT INTO xxas_form_field_triggers
      (trigger_name
      ,function_handler
      ,creation_date
      ,created_by
      ,last_update_date
      ,last_updated_by
      ,last_update_login)
    VALUES
      ('MGR_NH_PHONE_NO_DEFAULT'
      ,'xxas_new_hire_pkg.get_default_ph_no'
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,fnd_global.login_id);

  END IF;

  OPEN  csr_trigger_count('COST_ALLOCATION_DETAILS');
  FETCH csr_trigger_count INTO l_trigger_count;
  CLOSE csr_trigger_count;
  
  IF l_trigger_count = 0 THEN

    INSERT INTO xxas_form_field_triggers
      (trigger_name
      ,function_handler
      ,creation_date
      ,created_by
      ,last_update_date
      ,last_updated_by
      ,last_update_login)
    VALUES
      ('COST_ALLOCATION_DETAILS'
      ,'xxas_cost_allocation_pkg.get_cost_details'
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,trunc(sysdate)
      ,fnd_global.user_id
      ,fnd_global.login_id);

  END IF;
  
END;
/
COMMIT;
EXIT;
