Merge pull request #12030 from jitendrapurohit/core-78
[civicrm-core.git] / CRM / Event / Selector / Search.php
index ce7ecfb53037c98e5e30d90ce453ce01a35145e8..aae625b24086151c7679f0ae606f626e4c7cce07 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.7                                                |
+ | CiviCRM version 5                                                  |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2017                                |
+ | Copyright CiviCRM LLC (c) 2004-2018                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -28,7 +28,7 @@
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2017
+ * @copyright CiviCRM LLC (c) 2004-2018
  * $Id$
  *
  */
@@ -395,6 +395,20 @@ class CRM_Event_Selector_Search extends CRM_Core_Selector_Base implements CRM_Co
         );
       }
 
+      // CRM-20879: Show 'Transfer or Cancel' action only if logged in user
+      //  have 'edit event participants' permission and participant status
+      //  is not Cancelled or Transferred
+      if (in_array(CRM_Core_Permission::EDIT, $permissions) &&
+        !in_array($statusTypes[$row['participant_status_id']], array('Cancelled', 'Transferred'))
+      ) {
+        $links[] = array(
+          'name' => ts('Transfer or Cancel'),
+          'url' => 'civicrm/event/selfsvcupdate',
+          'qs' => 'reset=1&pid=%%id%%&is_backoffice=1&cs=' . CRM_Contact_BAO_Contact_Utils::generateChecksum($result->contact_id, NULL, 'inf'),
+          'title' => ts('Transfer or Cancel'),
+        );
+      }
+
       $row['action'] = CRM_Core_Action::formLink($links,
         $mask,
         array(