Merge pull request #15820 from seamuslee001/dev_core_183_custom_contribsybnt
[civicrm-core.git] / CRM / Activity / Form / Task / PickOption.php
index 982ce6212d2b3d7bfddbc73ee73af8931a0d5c4d..39676eaa2cec58918ba60231e26a2495aaa61828 100644 (file)
@@ -1,34 +1,18 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 5                                                  |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2018                                |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM.                                    |
- |                                                                    |
- | CiviCRM is free software; you can copy, modify, and distribute it  |
- | under the terms of the GNU Affero General Public License           |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
- |                                                                    |
- | CiviCRM is distributed in the hope that it will be useful, but     |
- | WITHOUT ANY WARRANTY; without even the implied warranty of         |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
- | See the GNU Affero General Public License for more details.        |
+ | Copyright CiviCRM LLC. All rights reserved.                        |
  |                                                                    |
- | You should have received a copy of the GNU Affero General Public   |
- | License and the CiviCRM Licensing Exception along                  |
- | with this program; if not, contact CiviCRM LLC                     |
- | at info[AT]civicrm[DOT]org. If you have questions about the        |
- | GNU Affero General Public License or the licensing of CiviCRM,     |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
+ | This work is published under the GNU AGPLv3 license with some      |
+ | permitted exceptions and without any warranty. For full license    |
+ | and copyright information, see https://civicrm.org/licensing       |
  +--------------------------------------------------------------------+
  */
 
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2018
+ * @copyright CiviCRM LLC https://civicrm.org/licensing
  */
 
 /**
@@ -45,16 +29,19 @@ class CRM_Activity_Form_Task_PickOption extends CRM_Activity_Form_Task {
 
   /**
    * Maximum Activities that should be allowed to update.
+   * @var int
    */
   protected $_maxActivities = 100;
 
   /**
    * Variable to store redirect path.
+   * @var int
    */
   protected $_userContext;
 
   /**
    * Variable to store contact Ids.
+   * @var array
    */
   public $_contacts;
 
@@ -73,10 +60,10 @@ class CRM_Activity_Form_Task_PickOption extends CRM_Activity_Form_Task {
     $validate = FALSE;
     //validations
     if (count($this->_activityHolderIds) > $this->_maxActivities) {
-      CRM_Core_Session::setStatus(ts("The maximum number of Activities you can select to send an email is %1. You have selected %2. Please select fewer Activities from your search results and try again.", array(
+      CRM_Core_Session::setStatus(ts("The maximum number of Activities you can select to send an email is %1. You have selected %2. Please select fewer Activities from your search results and try again.", [
         1 => $this->_maxActivities,
         2 => count($this->_activityHolderIds),
-      )), ts("Maximum Exceeded"), "error");
+      ]), ts("Maximum Exceeded"), "error");
       $validate = TRUE;
     }
     // then redirect
@@ -92,7 +79,7 @@ class CRM_Activity_Form_Task_PickOption extends CRM_Activity_Form_Task {
     $this->addElement('checkbox', 'with_contact', ts('With Contact'));
     $this->addElement('checkbox', 'assigned_to', ts('Assigned to Contact'));
     $this->addElement('checkbox', 'created_by', ts('Created by'));
-    $this->setDefaults(array('with_contact' => 1));
+    $this->setDefaults(['with_contact' => 1]);
     $this->addDefaultButtons(ts('Continue'));
   }
 
@@ -100,7 +87,7 @@ class CRM_Activity_Form_Task_PickOption extends CRM_Activity_Form_Task {
    * Add local and global form rules.
    */
   public function addRules() {
-    $this->addFormRule(array('CRM_Activity_Form_Task_PickOption', 'formRule'));
+    $this->addFormRule(['CRM_Activity_Form_Task_PickOption', 'formRule']);
   }
 
   /**
@@ -117,7 +104,7 @@ class CRM_Activity_Form_Task_PickOption extends CRM_Activity_Form_Task {
       !isset($fields['assigned_to']) &&
       !isset($fields['created_by'])
     ) {
-      return array('with_contact' => ts('You must select at least one email recipient type.'));
+      return ['with_contact' => ts('You must select at least one email recipient type.')];
     }
     return TRUE;
   }
@@ -129,7 +116,7 @@ class CRM_Activity_Form_Task_PickOption extends CRM_Activity_Form_Task {
     // Clear any formRule errors from Email form in case they came back here via Cancel button
     $this->controller->resetPage('Email');
     $params = $this->exportValues();
-    $this->_contacts = array();
+    $this->_contacts = [];
 
     $activityContacts = CRM_Activity_BAO_ActivityContact::buildOptions('record_type_id', 'validate');
     $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);