CRM-15555 remove check for payment processor validity in formRule - checks for this...
[civicrm-core.git] / CRM / Event / Form / Search.php
index aeaaad7a293c6054a093b91ab50a3bf759a2a0e8..f69f4d63b91df1c3656bc90f03290f87fc6d0cbb 100644 (file)
  */
 class CRM_Event_Form_Search extends CRM_Core_Form_Search {
 
-  /**
-   * Are we forced to run a search
-   *
-   * @var int
-   * @access protected
-   */
-  protected $_force;
-
-  /**
-   * name of search button
-   *
-   * @var string
-   * @access protected
-   */
-  protected $_searchButtonName;
-
-  /**
-   * name of action button
-   *
-   * @var string
-   * @access protected
-   */
-  protected $_actionButtonName;
-
-  /**
-   * form values that we will be using
-   *
-   * @var array
-   * @access protected
-   */
-  protected $_formValues;
-
   /**
    * the params that are sent to the query
    *
@@ -82,14 +50,6 @@ class CRM_Event_Form_Search extends CRM_Core_Form_Search {
    */
   protected $_queryParams;
 
-  /**
-   * have we already done this search
-   *
-   * @access protected
-   * @var boolean
-   */
-  protected $_done;
-
   /**
    * are we restricting ourselves to a single contact
    *
@@ -106,14 +66,6 @@ class CRM_Event_Form_Search extends CRM_Core_Form_Search {
    */
   protected $_limit = NULL;
 
-  /**
-   * what context are we being invoked from
-   *
-   * @access protected
-   * @var string
-   */
-  protected $_context = NULL;
-
   /**
    * prefix for the controller
    *
@@ -229,29 +181,14 @@ class CRM_Event_Form_Search extends CRM_Core_Form_Search {
 
     CRM_Event_BAO_Query::buildSearchForm($this);
 
-    /*
-     * add form checkboxes for each row. This is needed out here to conform to QF protocol
-     * of all elements being declared in builQuickForm
-     */
     $rows = $this->get('rows');
     if (is_array($rows)) {
       $lineItems = $eventIds = array();
       if (!$this->_single) {
-        $this->addElement('checkbox',
-          'toggleSelect',
-          NULL,
-          NULL,
-          array('onclick' => "toggleTaskAction( true );", 'class' => 'select-rows')
-        );
+        $this->addRowSelectors($rows);
       }
       foreach ($rows as $row) {
         $eventIds[$row['event_id']] = $row['event_id'];
-        if (!$this->_single) {
-          $this->addElement('checkbox', $row['checkbox'],
-            NULL, NULL,
-            array('onclick' => "toggleTaskAction( true );", 'class' => 'select-row')
-          );
-        }
         if (CRM_Event_BAO_Event::usesPriceSet($row['event_id'])) {
           // add line item details if applicable
           $lineItems[$row['participant_id']] = CRM_Price_BAO_LineItem::getLineItems($row['participant_id']);
@@ -275,6 +212,13 @@ class CRM_Event_Form_Search extends CRM_Core_Form_Search {
           $roles = array_keys($this->_formValues['participant_role_id']);
           $seatClause[] = '( participant.role_id IN ( ' . implode(' , ', $roles) . ' ) )';
         }
+        // CRM-15379
+        if (!empty($this->_formValues['participant_fee_id'])) {
+          $participant_fee_id = $this->_formValues['participant_fee_id'];
+          $feeLabel = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $participant_fee_id, 'label');
+          $feeLabel = CRM_Core_DAO::escapeString(trim($feeLabel));
+          $seatClause[] = "( participant.fee_level LIKE '%$feeLabel%' )";
+        }
         $clause = NULL;
         if (!empty($seatClause)) {
           $clause = implode(' AND ', $seatClause);
@@ -285,8 +229,6 @@ class CRM_Event_Form_Search extends CRM_Core_Form_Search {
       $this->assign('participantCount', $participantCount);
       $this->assign('lineItems', $lineItems);
 
-      $total = $cancel = 0;
-
       $permission = CRM_Core_Permission::getPermission();
 
       $tasks = CRM_Event_Task::permissionedTaskTitles($permission);
@@ -304,14 +246,6 @@ class CRM_Event_Form_Search extends CRM_Core_Form_Search {
       }
 
       $this->addTaskMenu($tasks);
-
-      // need to perform tasks on all or selected items ? using radio_ts(task selection) for it
-      $this->addElement('radio', 'radio_ts', NULL, '', 'ts_sel',
-        array('checked' => 'checked')
-      );
-      $this->addElement('radio', 'radio_ts', NULL, '', 'ts_all',
-        array('class' => 'select-rows', 'onclick' => $this->getName() . ".toggleSelect.checked = false; toggleTaskAction( true );")
-      );
     }
 
   }