#!/usr/bin/perl
#
## NAME: change_jobs2bugs.pl
#
## DESC: This trigger changes the text to "Bugs:" in place of "Jobs:" in the change form.
#
#Triggers:
# change_submit_form form-out change "/home/user/triggers/change_jobs2bugs.pl %formtype% %formfile%"
#
my $p4 = "p4 -p localhost:1666";
my $formtype = $ARGV[0]; # from %formtype% in trigger table
my $formfile = $ARGV[1]; # from %formfile% in trigger table
$defaultin = "Jobs:\n";
$defaultout = "Bugs:\n";
open (LOGILE, ">/tmp/triggeroutput");
my $modifiedform = "";
open (FORM, "$formfile") || print LOGFILE "Trigger couldn't read form tempfile\n";
while ( <FORM> )
{ ## Do the substitution as appropriate.
if ( m:$defaultin: ) { $_ = "$defaultout"; }
$modifiedform .= $_;
}
print LOGFILE $modifiedform;
open (MODFORM, ">$formfile") || die "Couldn't write form tempfile";
print MODFORM $modifiedform;
close LOGFILE;
exit 0;