*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
/**
return 'txt';
}
- /**
- * Override this if appropriate.
- * @return null
- */
- public function getTemplateFileName() {
- return NULL;
- }
-
/**
* @return object
*/
public function initiateDownload() {
$config = CRM_Core_Config::singleton();
- //zip files if more than one.
+ // zip files if more than one.
if (count($this->_downloadFile) > 1) {
$zip = $config->customFileUploadDir . 'Financial_Transactions_' . date('YmdHis') . '.zip';
$result = $this->createZip($this->_downloadFile, $zip, TRUE);
$subject .= ' ' . ts('Count') . '[' . $values['item_count'] . '],';
}
- //create activity.
+ // create activity.
$subject .= ' ' . ts('Batch') . '[' . $values['title'] . ']';
$activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, FALSE, FALSE, 'name');
$activityParams = array(
* @return bool
*/
public function createZip($files = array(), $destination = NULL, $overwrite = FALSE) {
- //if the zip file already exists and overwrite is false, return false
+ // if the zip file already exists and overwrite is false, return false
if (file_exists($destination) && !$overwrite) {
return FALSE;
}
$valid_files = array();
if (is_array($files)) {
foreach ($files as $file) {
- //make sure the file exists
+ // make sure the file exists
if (file_exists($file)) {
$validFiles[] = $file;
}
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
/**
*/
class CRM_Financial_BAO_ExportFormat_CSV extends CRM_Financial_BAO_ExportFormat {
- // For this phase, we always output these records too so that there isn't data referenced in the journal entries that isn't defined anywhere.
- // Possibly in the future this could be selected by the user.
+ /**
+ * For this phase, we always output these records too so that there isn't data
+ * referenced in the journal entries that isn't defined anywhere.
+ *
+ * Possibly in the future this could be selected by the user.
+ */
public static $complementaryTables = array(
'ACCNT',
'CUST',
public function export($exportParams) {
$export = parent::export($exportParams);
- // Save the file in the public directory
+ // Save the file in the public directory.
$fileName = self::putFile($export);
foreach (self::$complementaryTables as $rct) {
$this->$func();
}
- // now do general journal entries
- $this->exportTRANS();
-
$this->output($fileName);
}
return 'csv';
}
- public function exportACCNT() {
- }
-
- public function exportCUST() {
- }
-
- public function exportTRANS() {
- }
-
}
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
/**
*/
class CRM_Financial_BAO_ExportFormat_IIF extends CRM_Financial_BAO_ExportFormat {
- // Tab character. Some people's editors replace tabs with spaces so I'm scared to use actual tabs.
- // Can't set it here using chr() because static. Same thing if a const. So it's set in constructor.
+ /**
+ * Tab character. Some people's editors replace tabs with spaces so I'm scared to use actual tabs.
+ * Can't set it here using chr() because static. Same thing if a const. So it's set in constructor.
+ */
static $SEPARATOR;
- // For this phase, we always output these records too so that there isn't data referenced in the journal entries that isn't defined anywhere.
- // Possibly in the future this could be selected by the user.
+ /**
+ * For this phase, we always output these records too so that there isn't data
+ * referenced in the journal entries that isn't defined anywhere.
+ *
+ * Possibly in the future this could be selected by the user.
+ */
public static $complementaryTables = array(
'ACCNT',
'CUST',
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
class CRM_Financial_BAO_FinancialAccount extends CRM_Financial_DAO_FinancialAccount {
* @param int $financialAccountId
*/
public static function del($financialAccountId) {
- //checking if financial type is present
+ // checking if financial type is present
$check = FALSE;
//check dependencies
return CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/admin/financial/financialAccount', "reset=1&action=browse"));
}
- //delete from financial Type table
+ // delete from financial Type table
$financialAccount = new CRM_Financial_DAO_FinancialAccount();
$financialAccount->id = $financialAccountId;
$financialAccount->delete();
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
class CRM_Financial_BAO_FinancialItem extends CRM_Financial_DAO_FinancialItem {
public static function retrieveEntityFinancialTrxn($params, $maxId = FALSE) {
$financialItem = new CRM_Financial_DAO_EntityFinancialTrxn();
$financialItem->copyValues($params);
- //retrieve last entry from civicrm_entity_financial_trxn
+ // retrieve last entry from civicrm_entity_financial_trxn
if ($maxId) {
$financialItem->orderBy('id DESC');
$financialItem->limit(1);
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
class CRM_Financial_BAO_FinancialType extends CRM_Financial_DAO_FinancialType {
// tables to ingore checks for financial_type_id
$ignoreTables = array('CRM_Financial_DAO_EntityFinancialAccount');
- //TODO: if (!$financialType->find(true)) {
+ // TODO: if (!$financialType->find(true)) {
// ensure that we have no objects that have an FK to this financial type id TODO: that cannot be null
$occurrences = $financialType->findReferences();
}
}
- //delete from financial Type table
+ // delete from financial Type table
$financialType->delete();
$entityFinancialType = new CRM_Financial_DAO_EntityFinancialAccount();
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
class CRM_Financial_BAO_FinancialTypeAccount extends CRM_Financial_DAO_EntityFinancialAccount {
*
*/
public static function del($financialTypeAccountId, $accountId = NULL) {
- //checking if financial type is present
+ // check if financial type is present
$check = FALSE;
$relationValues = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship');
$financialTypeId = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_EntityFinancialAccount', $financialTypeAccountId, 'entity_id');
- //check dependencies
+ // check dependencies
// FIXME more table containing financial_type_id to come
$dependency = array(
array('Contribute', 'Contribution'),
return CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/admin/financial/financialType/accounts', "reset=1&action=browse&aid={$accountId}"));
}
- //delete from financial Type table
+ // delete from financial Type table
$financialType = new CRM_Financial_DAO_EntityFinancialAccount();
$financialType->id = $financialTypeAccountId;
$financialType->find(TRUE);
) {
return $result;
}
- //FIXME:
+
if ($component == 'membership') {
$sql = "
SELECT cr.payment_processor_id as ppID1, cp.payment_processor as ppID2, con.is_test
WHERE cr.id = %1";
}
- //we are interesting in single record.
+ // We are interested in a single record.
$sql .= ' LIMIT 1';
$params = array(1 => array($entityID, 'Integer'));
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
class CRM_Financial_BAO_PaymentProcessorType extends CRM_Financial_DAO_PaymentProcessorType {
* @param array $defaults
* (reference ) an assoc array to hold the flattened values.
*
- * @return CRM_Core_BAO_LocaationType|null
+ * @return CRM_Core_BAO_LocationType|null
* object on success, null otherwise
*/
public static function retrieve(&$params, &$defaults) {
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
/**
* This class generates form components for Financial Type
- *
*/
class CRM_Financial_Form_BatchTransaction extends CRM_Contribute_Form {
static $_links = NULL;
/**
* Build the form object.
- *
- * @return void
*/
public function buildQuickForm() {
if ($this->_batchStatusId == 2) {
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
/**
/**
* Build all the data structures needed to build the form.
- *
- * @return void
*/
public function preProcess() {
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
// this mean it's a batch action
if (!$this->_id) {
if (!empty($_GET['batch_id'])) {
- //validate batch ids
+ // validate batch ids
$batchIds = explode(',', $_GET['batch_id']);
foreach ($batchIds as $batchId) {
CRM_Utils_Type::validate($batchId, 'Positive');
$allBatchStatus = CRM_Core_PseudoConstant::get('CRM_Batch_DAO_Batch', 'status_id');
$this->_exportStatusId = CRM_Utils_Array::key('Exported', $allBatchStatus);
- //check if batch status is valid, do not allow exported batches to export again
+ // 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) {
/**
* Build the form object.
- *
- * @return void
*/
public function buildQuickForm() {
// this mean it's a batch action
/**
* Process the form after the input has been submitted and validated.
- *
- * @return void
*/
public function postProcess() {
if (!$this->_exportFormat) {
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
/**
* This class generates form components for Financial Account
- *
*/
class CRM_Financial_Form_FinancialAccount extends CRM_Contribute_Form {
/**
* Set variables up before form is built.
- *
- * @return void
*/
public function preProcess() {
parent::preProcess();
/**
* Build the form object.
- *
- * @return void
*/
public function buildQuickForm() {
parent::buildQuickForm();
/**
* Set default values for the form.
- * the default values are retrieved from the database
- *
- *
- * @return void
+ * the default values are retrieved from the database.
*/
public function setDefaultValues() {
$defaults = parent::setDefaultValues();
/**
* Process the form submission.
- *
- * @return void
*/
public function postProcess() {
if ($this->_action & CRM_Core_Action::DELETE) {
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
/**
* This class generates form components for Accounting Batch
- *
*/
class CRM_Financial_Form_FinancialBatch extends CRM_Contribute_Form {
/**
* Set variables up before form is built.
- *
- * @return void
*/
public function preProcess() {
$context = CRM_Utils_Request::retrieve('context', 'String', $this);
/**
* Build the form object.
- *
- * @return void
*/
public function buildQuickForm() {
parent::buildQuickForm();
if ($this->_action & CRM_Core_Action::UPDATE && $this->_id) {
$batchStatus = CRM_Core_PseudoConstant::get('CRM_Batch_DAO_Batch', 'status_id');
- //unset exported status
+ // unset exported status
$exportedStatusId = CRM_Utils_Array::key('Exported', $batchStatus);
unset($batchStatus[$exportedStatusId]);
$this->add('select', 'status_id', ts('Batch Status'), array('' => ts('- select -')) + $batchStatus, TRUE);
/**
* Set default values for the form. Note that in edit/view mode
- * the default values are retrieved from the database
- *
- *
- * @return void
+ * the default values are retrieved from the database.
*/
public function setDefaultValues() {
$defaults = parent::setDefaultValues();
/**
* Process the form submission.
- *
- * @return void
*/
public function postProcess() {
$session = CRM_Core_Session::singleton();
$activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, FALSE, FALSE, 'name');
- //create activity.
+ // create activity.
$activityParams = array(
'activity_type_id' => array_search($activityTypeName, $activityTypes),
'subject' => $batch->title . "- Batch",
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
/**
* This class generates form components for Financial Type
- *
*/
class CRM_Financial_Form_FinancialType extends CRM_Contribute_Form {
/**
* Build the form object.
- *
- * @return void
*/
public function buildQuickForm() {
parent::buildQuickForm();
/**
* Process the form submission.
- *
- * @return void
*/
public function postProcess() {
if ($this->_action & CRM_Core_Action::DELETE) {
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
/**
* This class generates form components for Financial Type Account
- *
*/
class CRM_Financial_Form_FinancialTypeAccount extends CRM_Contribute_Form {
/**
* Set variables up before form is built.
- *
- * @return void
*/
public function preProcess() {
$this->_aid = CRM_Utils_Request::retrieve('aid', 'Positive', $this);
/**
* Build the form object.
- *
- * @return void
*/
public function buildQuickForm() {
parent::buildQuickForm();
if ($this->_action == CRM_Core_Action::UPDATE) {
$this->assign('aid', $this->_id);
- //hidden field to catch the group id in profile
+ // hidden field to catch the group id in profile
$this->add('hidden', 'financial_type_id', $this->_aid);
- //hidden field to catch the field id in profile
+ // hidden field to catch the field id in profile
$this->add('hidden', 'account_type_id', $this->_id);
}
$AccountTypeRelationship = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship');
/**
* Process the form submission.
- *
- * @return void
*/
public function postProcess() {
if ($this->_action & CRM_Core_Action::DELETE) {
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
+ */
+
+/**
+ * @todo Add comments if possible.
*/
class CRM_Financial_Form_Search extends CRM_Core_Form {
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
/**
}
else {
$financialAccountType = array(
- '5' => 5, //expense
- '3' => 1, //AR relation
- '1' => 3, //revenue
+ '5' => 5, // expense
+ '3' => 1, // AR relation
+ '1' => 3, // revenue
'6' => 1, // asset
- '7' => 4, //cost of sales
- '8' => 1, //premium inventory
- '9' => 3, //discount account is
- '10' => 2, //sales tax liability
+ '7' => 4, // cost of sales
+ '8' => 1, // premium inventory
+ '9' => 3, // discount account is
+ '10' => 2, // sales tax liability
);
$financialAccountType = CRM_Utils_Array::value($_GET['_value'], $financialAccountType);
$result = CRM_Contribute_PseudoConstant::financialAccount(NULL, $financialAccountType);
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
/**
return 'CRM_Batch_BAO_Batch';
}
- /**
- * Get action Links.
- *
- */
- public function &links() {
- }
-
/**
* Get name of edit form.
*
/**
* Browse all entities.
- *
- * @return void
*/
public function browse() {
$status = CRM_Utils_Request::retrieve('status', 'Positive', CRM_Core_DAO::$_nullObject, FALSE, 1);
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
* This method is called after the page is created. It checks for the
* type of action and executes that action.
* Finally it calls the parent's run method.
- *
- * @return void
*/
public function run() {
// get the requested action
return parent::run();
}
- /**
- * Browse all financial batch transactions.
- *
- *
- * @return void
- */
- public function browse() {
- }
-
/**
* Get name of edit form.
*
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
/**
* This method is called after the page is created. It checks for the
* type of action and executes that action.
* Finally it calls the parent's run method.
- *
- * @return void
*/
public function run() {
// get the requested action
/**
* Browse all custom data groups.
- *
- *
- * @return void
*/
public function browse() {
// get all custom groups sorted by weight
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
/**
* This method is called after the page is created. It checks for the
* type of action and executes that action.
* Finally it calls the parent's run method.
- *
- * @return void
*/
public function run() {
$context = CRM_Utils_Request::retrieve('context', 'String', $this);
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
/**
* This method is called after the page is created. It checks for the
* type of action and executes that action.
* Finally it calls the parent's run method.
- *
- * @return void
*/
public function run() {
// get the requested action
/**
* Browse all financial types.
- *
- *
- * @return void
*/
public function browse() {
// get all financial types sorted by weight
$action -= CRM_Core_Action::ENABLE;
$action -= CRM_Core_Action::DISABLE;
$action -= CRM_Core_Action::DELETE;
- //continue;
}
else {
if ($dao->is_active) {
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
/**
* This method is called after the page is created. It checks for the
* type of action and executes that action.
* Finally it calls the parent's run method.
- *
- * @return void
*/
public function run() {
// get the requested action
/**
* Browse all Financial Type Account data.
- *
- * @return void
*/
public function browse() {
// get all Financial Type Account data sorted by weight
$action = array_sum(array_keys($this->links()));
$links = self::links();
- //CRM-12492
+ // CRM-12492
if ($dao->account_relationship == $relationTypeId) {
unset($links[CRM_Core_Action::DELETE]);
}
*
* @param string $action
* The action to be invoked.
- *
- * @return void
*/
public function edit($action) {
// create a simple controller for editing CiviCRM Profile data