Merge pull request #14103 from jitendrapurohit/core-889
[civicrm-core.git] / CRM / Pledge / Selector / Search.php
index f7548ed4d7a80c8c3089558ff743615abbb66f8e..b2d39ad3b71bcd53bc14f01f986db42b43f0de2a 100644 (file)
@@ -43,21 +43,21 @@ class CRM_Pledge_Selector_Search extends CRM_Core_Selector_Base {
    *
    * @var array
    */
-  static $_links = NULL;
+  public static $_links = NULL;
 
   /**
    * We use desc to remind us what that column is, name is used in the tpl
    *
    * @var array
    */
-  static $_columnHeaders;
+  public static $_columnHeaders;
 
   /**
    * Properties of contact we're interested in displaying
    *
    * @var array
    */
-  static $_properties = array(
+  public static $_properties = [
     'contact_id',
     'sort_name',
     'display_name',
@@ -75,19 +75,19 @@ class CRM_Pledge_Selector_Search extends CRM_Core_Selector_Base {
     'pledge_financial_type',
     'pledge_campaign_id',
     'pledge_currency',
-  );
+  ];
 
   /**
    * Are we restricting ourselves to a single contact
    *
-   * @var boolean
+   * @var bool
    */
   protected $_single = FALSE;
 
   /**
    * Are we restricting ourselves to a single contact
    *
-   * @var boolean
+   * @var bool
    */
   protected $_limit = NULL;
 
@@ -189,33 +189,33 @@ class CRM_Pledge_Selector_Search extends CRM_Core_Selector_Base {
     $extraParams = ($key) ? "&key={$key}" : NULL;
 
     $cancelExtra = ts('Cancelling this pledge will also cancel any scheduled (and not completed) pledge payments.') . ' ' . ts('This action cannot be undone.') . ' ' . ts('Do you want to continue?');
-    self::$_links = array(
-      CRM_Core_Action::VIEW => array(
+    self::$_links = [
+      CRM_Core_Action::VIEW => [
         'name' => ts('View'),
         'url' => 'civicrm/contact/view/pledge',
         'qs' => 'reset=1&id=%%id%%&cid=%%cid%%&action=view&context=%%cxt%%&selectedChild=pledge' . $extraParams,
         'title' => ts('View Pledge'),
-      ),
-      CRM_Core_Action::UPDATE => array(
+      ],
+      CRM_Core_Action::UPDATE => [
         'name' => ts('Edit'),
         'url' => 'civicrm/contact/view/pledge',
         'qs' => 'reset=1&action=update&id=%%id%%&cid=%%cid%%&context=%%cxt%%' . $extraParams,
         'title' => ts('Edit Pledge'),
-      ),
-      CRM_Core_Action::DETACH => array(
+      ],
+      CRM_Core_Action::DETACH => [
         'name' => ts('Cancel'),
         'url' => 'civicrm/contact/view/pledge',
         'qs' => 'reset=1&action=detach&id=%%id%%&cid=%%cid%%&context=%%cxt%%' . $extraParams,
         'extra' => 'onclick = "return confirm(\'' . $cancelExtra . '\');"',
         'title' => ts('Cancel Pledge'),
-      ),
-      CRM_Core_Action::DELETE => array(
+      ],
+      CRM_Core_Action::DELETE => [
         'name' => ts('Delete'),
         'url' => 'civicrm/contact/view/pledge',
         'qs' => 'reset=1&action=delete&id=%%id%%&cid=%%cid%%&context=%%cxt%%' . $extraParams,
         'title' => ts('Delete Pledge'),
-      ),
-    );
+      ],
+    ];
 
     if (in_array('Cancel', $hideOption)) {
       unset(self::$_links[CRM_Core_Action::DETACH]);
@@ -287,7 +287,7 @@ class CRM_Pledge_Selector_Search extends CRM_Core_Selector_Base {
     );
 
     // process the result of the query
-    $rows = array();
+    $rows = [];
 
     // get all pledge status
     $pledgeStatuses = CRM_Pledge_BAO_Pledge::buildOptions('status_id');
@@ -296,7 +296,7 @@ class CRM_Pledge_Selector_Search extends CRM_Core_Selector_Base {
     $allCampaigns = CRM_Campaign_BAO_Campaign::getCampaigns(NULL, NULL, FALSE, FALSE, FALSE, TRUE);
 
     // CRM-4418 check for view, edit and delete
-    $permissions = array(CRM_Core_Permission::VIEW);
+    $permissions = [CRM_Core_Permission::VIEW];
     if (CRM_Core_Permission::check('edit pledges')) {
       $permissions[] = CRM_Core_Permission::EDIT;
     }
@@ -306,7 +306,7 @@ class CRM_Pledge_Selector_Search extends CRM_Core_Selector_Base {
     $mask = CRM_Core_Action::mask($permissions);
 
     while ($result->fetch()) {
-      $row = array();
+      $row = [];
       // the columns we are interested in
       foreach (self::$_properties as $property) {
         if (isset($result->$property)) {
@@ -329,7 +329,7 @@ class CRM_Pledge_Selector_Search extends CRM_Core_Selector_Base {
         $row['pledge_status'] = CRM_Core_TestEntity::appendTestText($row['pledge_status']);
       }
 
-      $hideOption = array();
+      $hideOption = [];
       if (CRM_Utils_Array::key('Cancelled', $row) ||
         CRM_Utils_Array::key('Completed', $row)
       ) {
@@ -340,11 +340,11 @@ class CRM_Pledge_Selector_Search extends CRM_Core_Selector_Base {
 
       $row['action'] = CRM_Core_Action::formLink(self::links($hideOption, $this->_key),
         $mask,
-        array(
+        [
           'id' => $result->pledge_id,
           'cid' => $result->contact_id,
           'cxt' => $this->_context,
-        ),
+        ],
         ts('more'),
         FALSE,
         'pledge.selector.row',
@@ -383,57 +383,57 @@ class CRM_Pledge_Selector_Search extends CRM_Core_Selector_Base {
    */
   public function &getColumnHeaders($action = NULL, $output = NULL) {
     if (!isset(self::$_columnHeaders)) {
-      self::$_columnHeaders = array(
-        array(
+      self::$_columnHeaders = [
+        [
           'name' => ts('Pledged'),
           'sort' => 'pledge_amount',
           'direction' => CRM_Utils_Sort::DONTCARE,
-        ),
-        array(
+        ],
+        [
           'name' => ts('Total Paid'),
           'sort' => 'pledge_total_paid',
           'direction' => CRM_Utils_Sort::DONTCARE,
-        ),
-        array(
+        ],
+        [
           'name' => ts('Balance'),
-        ),
-        array(
+        ],
+        [
           'name' => ts('Pledged For'),
           'sort' => 'pledge_financial_type',
           'direction' => CRM_Utils_Sort::DONTCARE,
-        ),
-        array(
+        ],
+        [
           'name' => ts('Pledge Made'),
           'sort' => 'pledge_create_date',
           'direction' => CRM_Utils_Sort::DESCENDING,
-        ),
-        array(
+        ],
+        [
           'name' => ts('Next Pay Date'),
           'sort' => 'pledge_next_pay_date',
           'direction' => CRM_Utils_Sort::DONTCARE,
-        ),
-        array(
+        ],
+        [
           'name' => ts('Next Amount'),
           'sort' => 'pledge_next_pay_amount',
           'direction' => CRM_Utils_Sort::DONTCARE,
-        ),
-        array(
+        ],
+        [
           'name' => ts('Status'),
           'sort' => 'pledge_status',
           'direction' => CRM_Utils_Sort::DONTCARE,
-        ),
-        array('desc' => ts('Actions')),
-      );
+        ],
+        ['desc' => ts('Actions')],
+      ];
 
       if (!$this->_single) {
-        $pre = array(
-          array('desc' => ts('Contact ID')),
-          array(
+        $pre = [
+          ['desc' => ts('Contact ID')],
+          [
             'name' => ts('Name'),
             'sort' => 'sort_name',
             'direction' => CRM_Utils_Sort::DONTCARE,
-          ),
-        );
+          ],
+        ];
 
         self::$_columnHeaders = array_merge($pre, self::$_columnHeaders);
       }