<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014 |
+ | Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
* $Id$
*
*/
* The financial batch id, used when editing the field
*
* @var int
- * @access protected
*/
protected $_id;
/**
- * Financial batch ids
+ * Financial batch ids.
*/
protected $_batchIds = array();
/**
- * Export status id
+ * Export status id.
*/
protected $_exportStatusId;
/**
- * Export format
+ * Export format.
*/
protected $_exportFormat;
/**
- * Build all the data structures needed to build the form
+ * Build all the data structures needed to build the form.
*
* @return void
- * @access public
*/
- function preProcess() {
+ public function preProcess() {
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
// this mean it's a batch action
- if (!$this->_id ) {
+ if (!$this->_id) {
if (!empty($_GET['batch_id'])) {
//validate batch ids
$batchIds = explode(',', $_GET['batch_id']);
- foreach($batchIds as $batchId) {
- CRM_Utils_Type::validate($batchId,'Positive');
+ foreach ($batchIds as $batchId) {
+ CRM_Utils_Type::validate($batchId, 'Positive');
}
$this->_batchIds = $_GET['batch_id'];
//check if batch status is valid, do not allow exported batches to export again
$batchStatus = CRM_Batch_BAO_Batch::getBatchStatuses($this->_batchIds);
- foreach( $batchStatus as $batchStatusId ) {
+ foreach ($batchStatus as $batchStatusId) {
if ($batchStatusId == $this->_exportStatusId) {
- CRM_Core_Error::fatal(ts('You cannot exported the batches which were exported earlier.'));
+ CRM_Core_Error::fatal(ts('You cannot exported the batches which were exported earlier.'));
}
}
}
/**
- * Build the form object
+ * Build the form object.
*
- * @access public
* @return void
*/
- function buildQuickForm() {
+ public function buildQuickForm() {
// this mean it's a batch action
if (!empty($this->_batchIds)) {
$batchNames = CRM_Batch_BAO_Batch::getBatchNames($this->_batchIds);
}
/**
- * Process the form after the input has been submitted and validated
+ * Process the form after the input has been submitted and validated.
*
- * @access public
* @return void
*/
- public function postProcess( ) {
+ public function postProcess() {
if (!$this->_exportFormat) {
$params = $this->exportValues();
$this->_exportFormat = $params['export_format'];
if ($this->_id) {
$batchIds = array($this->_id);
}
- else if (!empty($this->_batchIds)) {
+ elseif (!empty($this->_batchIds)) {
$batchIds = explode(',', $this->_batchIds);
}
// Recalculate totals
$batchParams['status_id'] = $this->_exportStatusId;
$ids = array();
- foreach($batchIds as $batchId) {
+ foreach ($batchIds as $batchId) {
$batchParams['id'] = $ids['batchID'] = $batchId;
// Update totals
$batchParams = array_merge($batchParams, $totals[$batchId]);
CRM_Batch_BAO_Batch::exportFinancialBatch($batchIds, $this->_exportFormat);
}
+
}