Merge pull request #3812 from totten/master-envtests
[civicrm-core.git] / CRM / Event / StateMachine / Registration.php
index 32e90661cbfb5acc8c4fe21ffdeea804661bb1e8..85f58ced2b35c6046cd9132e787ece61617a01d7 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.                                    |
  |                                                                    |
@@ -28,7 +28,7 @@
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
  * $Id$
  *
  */
@@ -42,15 +42,17 @@ class CRM_Event_StateMachine_Registration extends CRM_Core_StateMachine {
   /**
    * class constructor
    *
-   * @param object  CRM_Event_Controller
-   * @param int     $action
+   * @param object $controller
+   * @param \const|int $action
    *
-   * @return object CRM_Event_StateMachine
+   * @internal param \CRM_Event_Controller $object
+   * @return \CRM_Event_StateMachine_Registration CRM_Event_StateMachine
    */
   function __construct($controller, $action = CRM_Core_Action::NONE) {
     parent::__construct($controller, $action);
     $id = CRM_Utils_Request::retrieve('id', 'Positive', $controller, TRUE);
     $is_monetary = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $id, 'is_monetary');
+    $is_confirm_enabled = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $id, 'is_confirm_enabled');
 
     $pages = array('CRM_Event_Form_Registration_Register' => NULL);
 
@@ -89,7 +91,8 @@ class CRM_Event_StateMachine_Registration extends CRM_Core_StateMachine {
 
     $pages = array_merge($pages, $additionalPages);
 
-    if (!$is_monetary) {
+    // CRM-11182 - Optional confirmation screen
+    if (!$is_confirm_enabled  && !$is_monetary) {
       unset($pages['CRM_Event_Form_Registration_Confirm']);
     }