Clarify label and remove help on Create Participant form.
[civicrm-core.git] / CRM / Event / Form / EventFees.php
index ac26d648a3ef8b8da9e7914858bbcaf206caf50a..d68f442226bc48dd97c4ae46ccea3350e88deefd 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.4                                                |
+ | CiviCRM version 4.5                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013                                |
+ | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -29,7 +29,7 @@
  *
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
  * $Id$
  *
  */
@@ -256,7 +256,7 @@ class CRM_Event_Form_EventFees {
    *
    * @return void
    */
-  static function setDefaultPriceSet($participantID, $eventID = NULL) {
+  static function setDefaultPriceSet($participantID, $eventID = NULL, $includeQtyZero = TRUE) {
     $defaults = array();
     if (!$eventID && $participantID) {
       $eventID = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', $participantID, 'event_id');
@@ -272,7 +272,7 @@ class CRM_Event_Form_EventFees {
     }
 
     // use line items for setdefault price set fields, CRM-4090
-    $lineItems[$participantID] = CRM_Price_BAO_LineItem::getLineItems($participantID);
+    $lineItems[$participantID] = CRM_Price_BAO_LineItem::getLineItems($participantID, 'participant', NULL, $includeQtyZero);
 
     if (is_array($lineItems[$participantID]) &&
       !CRM_Utils_System::isNull($lineItems[$participantID])
@@ -424,30 +424,30 @@ SELECT  id, html_type
           $form->assign('showTransactionId', TRUE);
         }
 
-        $allowStatuses = array();
-        $statuses = CRM_Contribute_PseudoConstant::contributionStatus();
-        if ($form->get('onlinePendingContributionId')) {
-          $statusNames = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
-          foreach ($statusNames as $val => $name) {
-            if (in_array($name, array(
-              'In Progress', 'Overdue'))) {
-              continue;
-            }
-            $allowStatuses[$val] = $statuses[$val];
-          }
-        }
-        else {
-          $allowStatuses = $statuses;
+        $status = CRM_Contribute_PseudoConstant::contributionStatus();
+
+        // CRM-14417 suppressing contribution statuses that are NOT relevant to new participant registrations
+        $statusName = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
+        foreach (array(
+                   'Cancelled',
+                   'Failed',
+                   'In Progress',
+                   'Overdue',
+                   'Refunded',
+                   'Pending refund',
+                 ) as $suppress) {
+          unset($status[CRM_Utils_Array::key($suppress, $statusName)]);
         }
+
         $form->add('select', 'contribution_status_id',
-          ts('Payment Status'), $allowStatuses
+          ts('Payment Status'), $status
         );
 
         $form->add('text', 'check_number', ts('Check Number'),
           CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Contribution', 'check_number')
         );
 
-        $form->add('text', 'total_amount', ts('Total Amount'),
+        $form->add('text', 'total_amount', ts('Amount'),
           CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Contribution', 'total_amount')
         );
       }