Merge pull request #13219 from eileenmcnaughton/fix_type
[civicrm-core.git] / CRM / Event / Form / ParticipantView.php
index ea7f269b4075c617eca80c40617057a75f3b0335..6ad31e9c9f0b6426ce0a5d211d32fad776a934e5 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.7                                                |
+ | CiviCRM version 5                                                  |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2018                                |
  +--------------------------------------------------------------------+
@@ -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) ';
     }