RT# 78547 - Flag to disable email/print/fax/etc during tests or reports
[freeside.git] / FS / FS / msg_template / email.pm
index 753fd3d..c2c3707 100644 (file)
@@ -214,14 +214,14 @@ A L<MIME::Entity> (or arrayref of them) to attach to the message.
 
 Set a string containing a comma-separated list.  This list may contain:
 
-- the text "invoice" indicating emails should only be sent to contact_email
-  addresses with the invoice_dest flag set
-- the text "message" indicating emails should only be sent to contact_email
-  addresses with the message_dest flag set
-  - numbers representing classnum id values for email contact classes.
-    If any classnum are present, emails should only be sent to contact_email
-    addresses where contact_email.classnum contains one of these classes.
-    The classnum 0 also includes where contact_email.classnum IS NULL
+- the text "invoice" indicating contacts with invoice_dest flag should
+  be included
+- the text "message" indicating contacts with message_dest flag should
+  be included
+- numbers representing classnum id values for email contact classes.
+  If any classnum are present, emails should only be sent to contact_email
+  addresses where contact_email.classnum contains one of these classes.
+  The classnum 0 also includes where contact_email.classnum IS NULL
 
 If neither 'invoice' nor 'message' has been specified, this method will
 behave as if 'invoice' had been selected
@@ -529,6 +529,11 @@ sub send_prepared {
   my $self = shift;
   my $cust_msg = shift or die "cust_msg required";
 
+  if ( $FS::Misc::DISABLE_ALL_NOTICES ) {
+    warn 'send_prepared() disabled by $FS::Misc::DISABLE_ALL_NOTICES' if $DEBUG;
+    return;
+  }
+
   my $domain = 'example.com';
   if ( $cust_msg->env_from =~ /\@([\w\.\-]+)/ ) {
     $domain = $1;