← Back to team overview

mvhub-dev team mailing list archive

[Branch ~mvhub-commit/mvhub/trunk] Rev 380: merged fix_notification_email_execute

 

Merge authors:
  Lee Goodrich (leegoodrich)
Related merge proposals:
  https://code.launchpad.net/~leegoodrich/mvhub/fix_notification_email_execute/+merge/24601
  proposed by: Lee Goodrich (leegoodrich)
  review: Approve - Dan MacNeil (omacneil)
------------------------------------------------------------
revno: 380 [merge]
committer: Lee Goodrich <lgoodrich@xxxxxxxxxx>
branch nick: trunk
timestamp: Tue 2010-05-04 09:41:22 -0400
message:
  merged fix_notification_email_execute
modified:
  app-mvhub/bin/notification_email.pl


--
lp:mvhub
https://code.launchpad.net/~mvhub-commit/mvhub/trunk

Your team MVHub Developers is subscribed to branch lp:mvhub.
To unsubscribe from this branch go to https://code.launchpad.net/~mvhub-commit/mvhub/trunk/+edit-subscription
=== modified file 'app-mvhub/bin/notification_email.pl'
--- app-mvhub/bin/notification_email.pl	2010-04-16 14:20:33 +0000
+++ app-mvhub/bin/notification_email.pl	2010-05-04 13:34:32 +0000
@@ -33,17 +33,20 @@
     shift_off_notifications_with_reminder_count
     /;
 
+# Command Line option handling
+my $CFG_FILENAME = $ENV{MV_CONFIG_FILE};
+my $EXECUTE = 0;
+Getopt::Long::GetOptions( 'config=s' => \$CFG_FILENAME,
+						  'execute' => \$EXECUTE )
+    or die "GetOptions failed";
+
 # Config File Variables
-my $cfg_filename = $ENV{MV_CONFIG_FILE};
-Getopt::Long::GetOptions( 'config=s' => \$cfg_filename )
-    or die "GetOptions failed";
-
-my $CFG = MVHub::Utils::ConfigSimple::create_config_from($cfg_filename);
+my $CFG = MVHub::Utils::ConfigSimple::create_config_from($CFG_FILENAME);
 
 my $MAX_NOTIFICATIONS = $CFG->param('NOTIFICATION.max_notifications');
 my $EXPIRE_MONTHS     = $CFG->param('NOTIFICATION.expire_months');
 
-my $DBH = MVHub::Utils::DB::get_dbh($cfg_filename);
+my $DBH = MVHub::Utils::DB::get_dbh($CFG_FILENAME);
 
 # Email Template Paths
 my $TEMPLATE_PATH = $CFG->param('ABSOLUTE_PATH.template_text_dir');
@@ -60,10 +63,6 @@
     = "$TEMPLATE_PATH/reminder_email_05.tmpl";
 
 {    # Main
-    my $execute = 0;
-    Getopt::Long::GetOptions( 'execute' => \$execute )
-        or die "GetOptions failed";
-
     my @date = Date::Calc::Add_Delta_YM( Date::Calc::Today(), 0,
         -($EXPIRE_MONTHS) );
     my $expire_date = join '-', @date;
@@ -132,7 +131,7 @@
         $FINAL_NOTIFICATION_TEMPLATE_FILE,
         $email_constants_href, %final_notifications );
 
-    if ($execute) {
+    if ($EXECUTE) {
         send_emails_contained_in(@emails);
         %all_notifications = (
             %first_notifications, %second_notifications,