Merge pull request #15820 from seamuslee001/dev_core_183_custom_contribsybnt
[civicrm-core.git] / CRM / Activity / Form / Task / PickProfile.php
index d6a0f40fb6ef3843376856853fd499c02a9c15b5..21b09855f85d5816ab5a3bc6bde1b769c5de87fb 100644 (file)
@@ -1,34 +1,18 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 5                                                  |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2019                                |
- +--------------------------------------------------------------------+
- | 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.   |
+ | Copyright CiviCRM LLC. All rights reserved.                        |
  |                                                                    |
- | 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.        |
- |                                                                    |
- | 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-2019
+ * @copyright CiviCRM LLC https://civicrm.org/licensing
  */
 
 /**
@@ -45,11 +29,13 @@ class CRM_Activity_Form_Task_PickProfile extends CRM_Activity_Form_Task {
 
   /**
    * Maximum Activities that should be allowed to update.
+   * @var int
    */
   protected $_maxActivities = 100;
 
   /**
    * Variable to store redirect path.
+   * @var string
    */
   protected $_userContext;
 
@@ -68,10 +54,10 @@ class CRM_Activity_Form_Task_PickProfile 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 for Update multiple activities 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 for Update multiple activities 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;
     }
 
@@ -85,11 +71,11 @@ class CRM_Activity_Form_Task_PickProfile extends CRM_Activity_Form_Task {
    * Build the form object.
    */
   public function buildQuickForm() {
-    $types = array('Activity');
+    $types = ['Activity'];
     $profiles = CRM_Core_BAO_UFGroup::getProfiles($types, TRUE);
 
     $activityTypeIds = array_flip(CRM_Core_PseudoConstant::activityType(TRUE, FALSE, FALSE, 'name'));
-    $nonEditableActivityTypeIds = array(
+    $nonEditableActivityTypeIds = [
       $activityTypeIds['Email'],
       $activityTypeIds['Bulk Email'],
       $activityTypeIds['Contribution'],
@@ -99,7 +85,7 @@ class CRM_Activity_Form_Task_PickProfile extends CRM_Activity_Form_Task {
       $activityTypeIds['Membership Renewal'],
       $activityTypeIds['Event Registration'],
       $activityTypeIds['Pledge Acknowledgment'],
-    );
+    ];
     $notEditable = FALSE;
     foreach ($this->_activityHolderIds as $activityId) {
       $typeId = CRM_Core_DAO::getFieldValue("CRM_Activity_DAO_Activity", $activityId, 'activity_type_id');
@@ -110,7 +96,7 @@ class CRM_Activity_Form_Task_PickProfile extends CRM_Activity_Form_Task {
     }
 
     if (empty($profiles)) {
-      CRM_Core_Session::setStatus(ts("You will need to create a Profile containing the %1 fields you want to edit before you can use Update multiple activities. Navigate to Administer > Customize Data and Screens > Profiles to configure a Profile. Consult the online Administrator documentation for more information.", array(1 => $types[0])), ts("No Profile Configured"), "alert");
+      CRM_Core_Session::setStatus(ts("You will need to create a Profile containing the %1 fields you want to edit before you can use Update multiple activities. Navigate to Administer > Customize Data and Screens > Profiles to configure a Profile. Consult the online Administrator documentation for more information.", [1 => $types[0]]), ts("No Profile Configured"), "alert");
       CRM_Utils_System::redirect($this->_userContext);
     }
     elseif ($notEditable) {
@@ -119,9 +105,9 @@ class CRM_Activity_Form_Task_PickProfile extends CRM_Activity_Form_Task {
     }
 
     $ufGroupElement = $this->add('select', 'uf_group_id', ts('Select Profile'),
-      array(
+      [
         '' => ts('- select profile -'),
-      ) + $profiles, TRUE
+      ] + $profiles, TRUE
     );
     $this->addDefaultButtons(ts('Continue'));
   }
@@ -130,7 +116,7 @@ class CRM_Activity_Form_Task_PickProfile extends CRM_Activity_Form_Task {
    * Add local and global form rules.
    */
   public function addRules() {
-    $this->addFormRule(array('CRM_Activity_Form_Task_PickProfile', 'formRule'));
+    $this->addFormRule(['CRM_Activity_Form_Task_PickProfile', 'formRule']);
   }
 
   /**