From: Donald A. Lobo Date: Mon, 8 Apr 2013 23:24:07 +0000 (-0700) Subject: CRM-12298 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=0b0941e2c22029256b993bbfb74310450fc98124;p=civicrm-core.git CRM-12298 ---------------------------------------- * CRM-12298: batch financial export fails in WP http://issues.civicrm.org/jira/browse/CRM-12298 --- diff --git a/CRM/Batch/BAO/Batch.php b/CRM/Batch/BAO/Batch.php index 3f4ffaa98d..2501cc9b57 100644 --- a/CRM/Batch/BAO/Batch.php +++ b/CRM/Batch/BAO/Batch.php @@ -300,7 +300,13 @@ class CRM_Batch_BAO_Batch extends CRM_Batch_DAO_Batch { $newLinks = array(); } elseif ($params['context'] == 'financialBatch') { - $values['check'] = ""; + $values['check'] = + ""; switch ($values['status_id']) { case '1': @@ -325,9 +331,9 @@ class CRM_Batch_BAO_Batch extends CRM_Batch_DAO_Batch { $tokens = array('id' => $object->id, 'status' => $values['status_id']); if ($values['status_id'] == CRM_Core_OptionGroup::getValue('batch_status', 'Exported')) { $aid = CRM_Core_OptionGroup::getValue('activity_type','Export Accounting Batch'); - $activityParams = array('source_record_id' => $object->id, 'activity_type_id' => $aid ); + $activityParams = array('source_record_id' => $object->id, 'activity_type_id' => $aid); $exportActivity = CRM_Activity_BAO_Activity::retrieve($activityParams, $val); - $fid = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_EntityFile', $exportActivity->id, 'file_id', 'entity_id' ); + $fid = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_EntityFile', $exportActivity->id, 'file_id', 'entity_id'); $tokens = array_merge(array('eid' => $exportActivity->id, 'fid' => $fid), $tokens); } $values['action'] = CRM_Core_Action::formLink( @@ -703,9 +709,9 @@ LEFT JOIN civicrm_contribution_soft ON civicrm_contribution_soft.contribution_id } } if (!empty($query->_where[0])) { - $where = implode(' AND ', $query->_where[0])." - AND civicrm_entity_batch.batch_id IS NULL - AND civicrm_entity_financial_trxn.entity_table = 'civicrm_contribution'"; + $where = implode(' AND ', $query->_where[0]) . + "AND civicrm_entity_batch.batch_id IS NULL + AND civicrm_entity_financial_trxn.entity_table = 'civicrm_contribution'"; $searchValue = TRUE; } else { @@ -724,10 +730,11 @@ LEFT JOIN civicrm_contribution_soft ON civicrm_contribution_soft.contribution_id } } - $sql = "SELECT {$select} -FROM {$from} -WHERE {$where} -{$orderBy} + $sql = " +SELECT {$select} +FROM {$from} +WHERE {$where} + {$orderBy} "; if (isset($limit)) { @@ -747,7 +754,7 @@ WHERE {$where} static function getBatchNames($batchIds) { $query = 'SELECT id, title FROM civicrm_batch - WHERE id IN ('.$batchIds.')'; + WHERE id IN ('. $batchIds . ')'; $batches = array(); $dao = CRM_Core_DAO::executeQuery($query); diff --git a/CRM/Batch/Page/AJAX.php b/CRM/Batch/Page/AJAX.php index e74a38cc13..691b8956f4 100644 --- a/CRM/Batch/Page/AJAX.php +++ b/CRM/Batch/Page/AJAX.php @@ -60,16 +60,27 @@ class CRM_Batch_Page_AJAX { */ static function getBatchList() { $sortMapper = array( - 0 => 'batch.title', 1 => 'batch.type_id', 2 => '', - 3 => 'batch.total', 4 => 'batch.status_id', 5 => '', + 0 => 'batch.title', + 1 => 'batch.type_id', + 2 => '', + 3 => 'batch.total', + 4 => 'batch.status_id', + 5 => '', ); $sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer'); - $offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0; - $rowCount = isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25; - $sort = isset($_REQUEST['iSortCol_0']) ? CRM_Utils_Array::value(CRM_Utils_Type::escape($_REQUEST['iSortCol_0'], 'Integer'), $sortMapper) : NULL; - $sortOrder = isset($_REQUEST['sSortDir_0']) ? CRM_Utils_Type::escape($_REQUEST['sSortDir_0'], 'String') : 'asc'; - $context = isset($_REQUEST['context']) ? CRM_Utils_Type::escape($_REQUEST['context'], 'String') : NULL; + $offset = + isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0; + $rowCount = + isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25; + $sort = + isset($_REQUEST['iSortCol_0']) ? + CRM_Utils_Array::value(CRM_Utils_Type::escape($_REQUEST['iSortCol_0'], 'Integer'), $sortMapper) : + NULL; + $sortOrder = + isset($_REQUEST['sSortDir_0']) ? CRM_Utils_Type::escape($_REQUEST['sSortDir_0'], 'String') : 'asc'; + $context = + isset($_REQUEST['context']) ? CRM_Utils_Type::escape($_REQUEST['context'], 'String') : NULL; $params = $_REQUEST; if ($sort && $sortOrder) { @@ -83,7 +94,7 @@ class CRM_Batch_Page_AJAX { // data entry status batches $params['status_id'] = 3; } - + $params['context'] = $context; // get batch list