/*****************************************************************************
*
* Filename         - $Workfile : flight_dests_triggers.sql $
*
* Project Name     - ULTRATRAK(Oracle Database)
*
* Source Code
* Identifier       - FAS/FARFL
*
* Description      - Re-flighting Module
*
* Language         - SQL Script
*
* File History     - For the development history run the Show History report in PVCS
*
* Coptright Ultra Electronics Airport Systems 2004
*
*****************************************************************************/
/****************************************************************************
* Trigger          ti_flight_dests
*
* Description:     Re-flighting module addition.
*                  Before Insert trigger on flight dests so that when a new flight is created
*                  A check is performed on the reflighting data to see if a bag has been re-flighted to it.
*                  If so the bag is copied to the flight under the RUSH passenger. It is done on this table as the 
*                  destination information is required.
*
* CA History
* Date      Name              CA Number               CA Description
* 07/04/04  Jacqui Bruce      FALCP/CA/461       Initial development of the re-flighting module.
*
*****************************************************************************/

CREATE OR REPLACE TRIGGER ti_flight_dests
BEFORE INSERT ON flight_dests
FOR EACH ROW
DECLARE
BEGIN
   IF :new.dest_order = 1
   THEN
      reflighting.ti_flight_dests_trig (:new.flight_id,
                                        :new.flight_destination);
   END IF;
EXCEPTION
WHEN OTHERS
THEN
   RAISE;
END;
/

