CRM-15917 - CiviReport - fix bug number in comment
[civicrm-core.git] / CRM / Contribute / Page / ContributionPage.php
index d0b0dbaf683c266f5e07658bb35f69688a7e0227..d432da34a8be4d31605f90648904cd78e2560a77 100644 (file)
@@ -23,7 +23,7 @@
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  *
@@ -71,7 +71,7 @@ class CRM_Contribute_Page_ContributionPage extends CRM_Core_Page {
    *
    * @return array
    */
-  function &actionLinks() {
+  public function &actionLinks() {
     // check if variable _actionsLinks is populated
     if (!isset(self::$_actionLinks)) {
       // helper variable for nicer formatting
@@ -288,18 +288,21 @@ class CRM_Contribute_Page_ContributionPage extends CRM_Core_Page {
     );
 
     // set breadcrumb to append to 2nd layer pages
-    $breadCrumb = array(array('title' => ts('Manage Contribution Pages'),
+    $breadCrumb = array(
+      array(
+        'title' => ts('Manage Contribution Pages'),
         'url' => CRM_Utils_System::url(CRM_Utils_System::currentPath(),
           'reset=1'
         ),
-      ));
+      ),
+    );
 
     // what action to take ?
     if ($action & CRM_Core_Action::ADD) {
       $session = CRM_Core_Session::singleton();
       $session->pushUserContext(CRM_Utils_System::url(CRM_Utils_System::currentPath(),
-          'action=browse&reset=1'
-        ));
+        'action=browse&reset=1'
+      ));
 
       $controller = new CRM_Contribute_Controller_ContributionPage(NULL, $action);
       CRM_Utils_System::setTitle(ts('Manage Contribution Page'));
@@ -330,8 +333,8 @@ class CRM_Contribute_Page_ContributionPage extends CRM_Core_Page {
 
       $session = CRM_Core_Session::singleton();
       $session->pushUserContext(CRM_Utils_System::url(CRM_Utils_System::currentPath(),
-          'reset=1&action=browse'
-        ));
+        'reset=1&action=browse'
+      ));
 
       $id = CRM_Utils_Request::retrieve('id', 'Positive',
         $this, FALSE, 0
@@ -369,7 +372,7 @@ AND         cp.page_type = 'contribute'
   }
 
   /**
-   * This function is to make a copy of a contribution page, including
+   * make a copy of a contribution page, including
    * all the fields in the page
    *
    * @return void
@@ -389,7 +392,6 @@ AND         cp.page_type = 'contribute'
    *
    * @param mixed $action
    *   Unused parameter.
-   * @static
    */
   public function browse($action = NULL) {
     $this->_sortByCharacter = CRM_Utils_Request::retrieve('sortByCharacter',
@@ -471,15 +473,15 @@ ORDER BY title asc
       $action += array_sum(array_keys(self::contributionLinks()));
 
       if ($dao->is_active) {
-        $action -= (int)CRM_Core_Action::ENABLE;
+        $action -= (int) CRM_Core_Action::ENABLE;
       }
       else {
-        $action -= (int)CRM_Core_Action::DISABLE;
+        $action -= (int) CRM_Core_Action::DISABLE;
       }
 
       //CRM-4418
       if (!$allowToDelete) {
-        $action -= (int)CRM_Core_Action::DELETE;
+        $action -= (int) CRM_Core_Action::DELETE;
       }
 
       //build the configure links.
@@ -537,8 +539,7 @@ ORDER BY title asc
   }
 
   public function search() {
-    if (isset($this->_action) &
-      (CRM_Core_Action::ADD |
+    if (isset($this->_action) & (CRM_Core_Action::ADD |
         CRM_Core_Action::UPDATE |
         CRM_Core_Action::DELETE
       )
@@ -564,8 +565,8 @@ ORDER BY title asc
    */
   public function whereClause(&$params, $sortBy = TRUE) {
     // @todo Unused local variable can be safely removed.
-    $values    = $clauses = array();
-    $title     = $this->get('title');
+    $values = $clauses = array();
+    $title = $this->get('title');
     $createdId = $this->get('cid');
 
     if ($createdId) {
@@ -582,7 +583,7 @@ ORDER BY title asc
       }
     }
 
-    $value = $this->get( 'financial_type_id' );
+    $value = $this->get('financial_type_id');
     $val = array();
     if ($value) {
       if (is_array($value)) {
@@ -602,12 +603,9 @@ ORDER BY title asc
     }
 
     $campaignIds = $this->getCampaignIds();
-    if (count($campaignIds) > 1) {
+    if (count($campaignIds) >= 1) {
       $clauses[] = '( campaign_id IN ( ' . implode(' , ', $campaignIds) . ' ) )';
     }
-    elseif (count($campaignIds) > 1) {
-      $clauses[] = '( campaign_id = ' . $campaignIds[0] . ')';
-    }
 
     if (empty($clauses)) {
       // Let template know if user has run a search or not
@@ -626,12 +624,12 @@ ORDER BY title asc
    *
    * @return int[]
    */
-  function getCampaignIds() {
+  public function getCampaignIds() {
     // The unfiltered value from the session cannot be trusted, it needs to be
     // processed to get a clean array of positive integers.
     $ids = array();
-    foreach ((array)$this->get('campaign_id') as $id) {
-      if ((string)(int)$id === (string)$id && $id > 0) {
+    foreach ((array) $this->get('campaign_id') as $id) {
+      if ((string) (int) $id === (string) $id && $id > 0) {
         $ids[] = $id;
       }
     }
@@ -642,7 +640,7 @@ ORDER BY title asc
    * @param $whereClause
    * @param array $whereParams
    */
-  function pager($whereClause, $whereParams) {
+  public function pager($whereClause, $whereParams) {
 
     $params['status'] = ts('Contribution %%StatusMessage%%');
     $params['csvString'] = NULL;
@@ -707,4 +705,5 @@ ORDER BY LEFT(title, 1)
 
     return $formattedConfLinks;
   }
+
 }