#!/bin/sh
#
# RUN_CODE_CHANGE_REPORT.sh
#
# Ask if the user wants to run the CODE_CHANGE report 
# now or not.  Only the VOB owner can run this "expensive"
# report.  The CODE_CHANGE.rpt files can be implemented
# as a unique file_type or not.  I choose to do so to make
# the application of the trigger_type "global" to any file
# named "CODE_CHANGE.rpt" in any directory.  One can be 
# placed in any/all directory(ies) to allow reports to be
# run on any small/large piece of the code.
#
# NOTE: The trigger code relies on the tool CODE_CHANGE_REPORT.sh
#
# NOTE: The trigger code can be implemented to rely on the trigger 
#       INHIBIT.tgr
#
# Author: Charles W. Clarke III (ABS)
# email:  charles@abs-consulting.com
# URL:    http://www.abs-consulting.com
# Date:   Sep. 17, 1996
############################################################
# History: 09/17/96 : Created for A Better Solution, Inc.
############################################################

This trigger script is expected to be called from a post-checkout
trigger.

Either implement by making a element_type "Change_Rpt" in the 
.magic file and use that element_type to attach the triggers:

    cleartool mktrtype -ele -all \
          -postop checkout -eltype Change_Rpt \
          -c "Query to run the change_report when \"Change_Rpt\" element are checked out." \
          -exec {path}/RUN_CODE_CHANGE_REPORT.sh RUN_CODE_CHANGE_REPORT
    
or make a non-global trigger type and apply as needed:

    cleartool mktrtype -ele -post checkout \
       -c "Query to run the change_report when selected elements element are checked out." \
          -exec {path}/RUN_CODE_CHANGE_REPORT.sh RUN_CODE_CHANGE_REPORT

    cleartool mktrigger RUN_CODE_CHANGE_REPORT heart_change brain_change.rpt
    
In either case, when the trigger is applied then a partner trigger that inhibits
checkout of the file by anyone other that the user that can run the report should
also be added.  This insures that the triggers are added in pairs:

    cleartool mktrtype -ele -glo -pre checkin \
       -trtype RUN_CODE_CHANGE_REPORT \
       -c "Limit checking out of the report to thos that can run the report." \
          -exec {path}/INHIBIT.sh INHIBIT_CO_RUN_CODE_CHANGE_REPORT
    

Shortcut using...

If using ClearTriggerTM just add this line in the configuration file
to specified operations like: 

    post_checkout;R;eltype<Change_rpt>0;0;0;D; ;N; ;0;;;RUN_CODE_CHANGE_REPORT.sh;


View Trigger Code.