Merge pull request #12053 from civicrm/5.1
[civicrm-core.git] / CRM / Event / Form / ParticipantView.php
index c7d22619a65cebfafcda7f1c47cd2b493c2e6baf..6ad31e9c9f0b6426ce0a5d211d32fad776a934e5 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$
  *
  */
@@ -100,6 +100,23 @@ class CRM_Event_Form_ParticipantView extends CRM_Core_Form {
     }
     $participantStatuses = CRM_Event_PseudoConstant::participantStatus();
 
+    // CRM-20879: Show 'Transfer or Cancel' option beside 'Change fee selection'
+    //  only if logged in user have 'edit event participants' permission and
+    //  participant status is not Cancelled or Transferred
+    if (CRM_Core_Permission::check('edit event participants') && !in_array($status, array('Cancelled', 'Transferred'))) {
+      $this->assign('transferOrCancelLink',
+        CRM_Utils_System::url(
+          'civicrm/event/selfsvcupdate',
+          array(
+            'reset' => 1,
+            'is_backoffice' => 1,
+            'pid' => $participantID,
+            'cs' => CRM_Contact_BAO_Contact_Utils::generateChecksum($contactID, NULL, 'inf'),
+          )
+        )
+      );
+    }
+
     if ($values[$participantID]['is_test']) {
       $values[$participantID]['status'] .= ' (test) ';
     }