CRM-12215
authorDeepak Srivastava <deepak.srivastava@webaccess.co.in>
Thu, 28 Mar 2013 08:47:58 +0000 (14:17 +0530)
committerDeepak Srivastava <deepak.srivastava@webaccess.co.in>
Thu, 28 Mar 2013 09:29:42 +0000 (14:59 +0530)
CRM/Mailing/Form/Test.php

index 88793cca9a13c32236be241c8c18827dd2c8c69f..664ecfacebe31307b2a7870f7e96a63282c47c69 100644 (file)
@@ -179,7 +179,7 @@ class CRM_Mailing_Form_Test extends CRM_Core_Form {
    * @return boolean          true on succesful SMTP handoff
    * @access public
    */
-  static function &testMail($testParams, $files, $self) {
+  static function testMail($testParams, $files, $self) {
     $error = NULL;
 
     $urlString = 'civicrm/mailing/send';
@@ -260,6 +260,14 @@ class CRM_Mailing_Form_Test extends CRM_Core_Form {
       }
     }
 
+    if (CRM_Utils_Array::value('_qf_Test_next', $testParams) && 
+      $self->get('count') <= 0) {
+      return array(
+        '_qf_default' =>
+        ts("You can not schedule or send this mailing because there are currently no recipients selected. Click 'Previous' to return to the Select Recipients step, OR click 'Save & Continue Later'."),
+      );
+    }
+
     if (CRM_Utils_Array::value('_qf_Import_refresh', $_POST) ||
       CRM_Utils_Array::value('_qf_Test_next', $testParams) ||
       !CRM_Utils_Array::value('sendtest', $testParams)