Add expiration alerts to freeside-daily routine
authormark <mark>
Fri, 26 Jun 2009 06:55:07 +0000 (06:55 +0000)
committermark <mark>
Fri, 26 Jun 2009 06:55:07 +0000 (06:55 +0000)
FS/FS/Conf.pm
FS/bin/freeside-daily

index ac479da..b45cdd7 100644 (file)
@@ -566,11 +566,19 @@ worry that config_items is freeside-specific and icky.
   },
 
   {
   },
 
   {
+    'key'         => 'alert_expiration',
+    'section'     => 'billing',
+    'description' => 'Enable alerts about billing method expiration.',
+    'type'        => 'checkbox',
+    'per_agent'   => 1,
+  },
+
+  {
     'key'         => 'alerter_template',
     'section'     => 'billing',
     'description' => 'Template file for billing method expiration alerts.  See the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:1.7:Documentation:Administration#Credit_cards_and_Electronic_checks">billing documentation</a> for details.',
     'type'        => 'textarea',
     'key'         => 'alerter_template',
     'section'     => 'billing',
     'description' => 'Template file for billing method expiration alerts.  See the <a href="http://www.freeside.biz/mediawiki/index.php/Freeside:1.7:Documentation:Administration#Credit_cards_and_Electronic_checks">billing documentation</a> for details.',
     'type'        => 'textarea',
-    'per-agent'   => 1,
+    'per_agent'   => 1,
   },
 
   {
   },
 
   {
index acf7950..271c436 100755 (executable)
@@ -3,6 +3,7 @@
 use strict;
 use Getopt::Std;
 use FS::UID qw(adminsuidsetup);
 use strict;
 use Getopt::Std;
 use FS::UID qw(adminsuidsetup);
+use FS::Conf;
 
 &untaint_argv; #what it sounds like  (eww)
 use vars qw(%opt);
 
 &untaint_argv; #what it sounds like  (eww)
 use vars qw(%opt);
@@ -16,7 +17,8 @@ bill(%opt);
 
 # Send alerts about upcoming credit card expiration.
 use FS::Cron::alert_expiration qw(alert_expiration);
 
 # Send alerts about upcoming credit card expiration.
 use FS::Cron::alert_expiration qw(alert_expiration);
-alert_expiration(%opt);
+my $conf = new FS::Conf;
+alert_expiration(%opt) if($conf->exists('alert_expiration'));
 
 #what to do about the below when using -m?  that is the question.
 
 
 #what to do about the below when using -m?  that is the question.