*
* @static
*/
- static function exportComponents($selectAll,
+ static function exportComponents(
+ $selectAll,
$ids,
$params,
$order = NULL,
$queryOperator = 'AND'
) {
$headerRows = $returnProperties = array();
- $primary = $paymentFields = $selectedPaymentFields = FALSE;
+ $primary = $paymentFields = $selectedPaymentFields = FALSE;
$origFields = $fields;
$relationField = NULL;
}
else if (
$exportMode == CRM_Export_Form_Select::EVENT_EXPORT &&
- array_key_exists( $fieldName, self::componentPaymentFields())
+ array_key_exists($fieldName, self::componentPaymentFields())
) {
- $selectedPaymentFields = true;
- $paymentTableId = 'participant_id';
- $returnProperties[$fieldName] = 1;
+ $selectedPaymentFields = TRUE;
+ $paymentTableId = 'participant_id';
+ $returnProperties[$fieldName] = 1;
}
else {
$returnProperties[$fieldName] = 1;
// unset non exportable fields for components
$nonExpoFields = array(
- 'groups', 'tags', 'notes', 'contribution_status_id',
- 'pledge_status_id', 'pledge_payment_status_id',
+ 'groups',
+ 'tags',
+ 'notes',
+ 'contribution_status_id',
+ 'pledge_status_id',
+ 'pledge_payment_status_id',
);
foreach ($nonExpoFields as $value) {
unset($returnProperties[$value]);
{$relationshipJoin} ";
//check for active relationship status only
- $today = date('Ymd');
- $relationActive = " AND (crel.is_active = 1 AND ( crel.end_date is NULL OR crel.end_date >= {$today} ) )";
- $relationWhere = " WHERE contact_a.is_deleted = 0 {$relationshipClause} {$relationActive}";
- $relationGroupBy = " GROUP BY crel.{$contactA}";
- $relationSelect = "{$relationSelect}, {$contactA} as refContact ";
+ $today = date('Ymd');
+ $relationActive = " AND (crel.is_active = 1 AND ( crel.end_date is NULL OR crel.end_date >= {$today} ) )";
+ $relationWhere = " WHERE contact_a.is_deleted = 0 {$relationshipClause} {$relationActive}";
+ $relationGroupBy = " GROUP BY crel.{$contactA}";
+ $relationSelect = "{$relationSelect}, {$contactA} as refContact ";
$relationQueryString = "$relationSelect $relationFrom $relationWhere $relationHaving $relationGroupBy";
$allRelContactDAO = CRM_Core_DAO::executeQuery($relationQueryString);
}
// CRM-13995
elseif (is_object($relDAO) && in_array($relationField, array(
- 'email_greeting', 'postal_greeting', 'addressee'))) {
+ 'email_greeting',
+ 'postal_greeting',
+ 'addressee'
+ ))
+ ) {
//special case for greeting replacement
$fldValue = "{$relationField}_display";
$fieldValue = $relDAO->$fldValue;
}
- elseif ( is_object($relDAO) && $relationField == 'state_province' ) {
+ elseif (is_object($relDAO) && $relationField == 'state_province') {
$fieldValue = CRM_Core_PseudoConstant::stateProvince($relDAO->state_province_id);
}
- elseif ( is_object($relDAO) && $relationField == 'country' ) {
+ elseif (is_object($relDAO) && $relationField == 'country') {
$fieldValue = CRM_Core_PseudoConstant::country($relDAO->country_id);
}
else {
if (is_object($relDAO) && $relationField == 'id') {
$row[$field . $relationField] = $relDAO->contact_id;
}
- elseif (is_array( $relationValue ) && $relationField == 'location') {
+ elseif (is_array($relationValue) && $relationField == 'location') {
foreach ($relationValue as $ltype => $val) {
foreach (array_keys($val) as $fld) {
$type = explode('-', $fld);
// CRM-3157: localise country, region (both have ‘country’ context)
// and state_province (‘province’ context)
switch (TRUE) {
- case (!is_object($relDAO)):
+ case (!is_object($relDAO)):
$row[$field . '_' . $fldValue] = '';
break;
}
elseif (in_array($field, array(
- 'email_greeting', 'postal_greeting', 'addressee'))) {
+ 'email_greeting',
+ 'postal_greeting',
+ 'addressee'
+ ))) {
//special case for greeting replacement
$fldValue = "{$field}_display";
$row[$field] = $iterationDAO->$fldValue;
elseif ($selectedPaymentFields && array_key_exists($field, self::componentPaymentFields())) {
$paymentData = CRM_Utils_Array::value($iterationDAO->$paymentTableId, $paymentDetails);
$payFieldMapper = array(
- 'componentPaymentField_total_amount' => 'total_amount',
+ 'componentPaymentField_total_amount' => 'total_amount',
'componentPaymentField_contribution_status' => 'contribution_status',
- 'componentPaymentField_payment_instrument' => 'pay_instru',
- 'componentPaymentField_transaction_id' => 'trxn_id',
- 'componentPaymentField_received_date' => 'receive_date',
+ 'componentPaymentField_payment_instrument' => 'pay_instru',
+ 'componentPaymentField_transaction_id' => 'trxn_id',
+ 'componentPaymentField_received_date' => 'receive_date',
);
$row[$field] = CRM_Utils_Array::value($payFieldMapper[$field], $paymentData, '');
}
if ($parserClass[0] == 'CRM' &&
count($parserClass) >= 3
) {
- require_once (str_replace('_', DIRECTORY_SEPARATOR, $parserName) . ".php");
+ require_once(str_replace('_', DIRECTORY_SEPARATOR, $parserName) . ".php");
// ensure the functions exists
if (method_exists($parserName, 'errorFileName') &&
method_exists($parserName, 'saveFileName')
public static function exportCustom($customSearchClass, $formValues, $order) {
$ext = CRM_Extension_System::singleton()->getMapper();
if (!$ext->isExtensionClass($customSearchClass)) {
- require_once (str_replace('_', DIRECTORY_SEPARATOR, $customSearchClass) . '.php');
+ require_once(str_replace('_', DIRECTORY_SEPARATOR, $customSearchClass) . '.php');
}
else {
- require_once ($ext->classToPath($customSearchClass));
+ require_once($ext->classToPath($customSearchClass));
}
$search = new $customSearchClass($formValues);
$header = array_keys($columns);
$fields = array_values($columns);
- $rows = array();
- $dao = CRM_Core_DAO::executeQuery($sql);
+ $rows = array();
+ $dao = CRM_Core_DAO::executeQuery($sql);
$alterRow = FALSE;
if (method_exists($search, 'alterRow')) {
$alterRow = TRUE;
// to accomodate different systems - CRM-13739
static $notRealIDFields = NULL;
if ($notRealIDFields == NULL) {
- $notRealIDFields = array( 'trxn_id', 'componentpaymentfield_transaction_id' );
+ $notRealIDFields = array('trxn_id', 'componentpaymentfield_transaction_id');
}
if (in_array($fieldName, $notRealIDFields)) {
SET addressee = %1, postal_greeting = %2, email_greeting = %3
WHERE id = %4
";
- $params = array(1 => array($values['addressee'], 'String'),
+ $params = array(
+ 1 => array($values['addressee'], 'String'),
2 => array($values['postalGreeting'], 'String'),
3 => array($values['emailGreeting'], 'String'),
4 => array($masterID, 'Integer'),
CRM_Core_DAO::executeQuery($sql, $params);
// delete all copies
- $deleteIDs = array_keys($values['copy']);
+ $deleteIDs = array_keys($values['copy']);
$deleteIDString = implode(',', $deleteIDs);
- $sql = "
+ $sql = "
DELETE FROM $tableName
WHERE id IN ( $deleteIDString )
";
* i.e 'Hello Alan' => converted to => 'Alan'
*
*/
- static function _trimNonTokens(&$parsedString, $defaultGreeting,
- $addressMergeGreetings, $greetingType = 'postal_greeting'
+ static function _trimNonTokens(
+ &$parsedString, $defaultGreeting,
+ $addressMergeGreetings, $greetingType = 'postal_greeting'
) {
if (!empty($addressMergeGreetings[$greetingType])) {
$greetingLabel = $addressMergeGreetings[$greetingType];
*/
public static function mergeSameHousehold($exportTempTable, &$headerRows, &$sqlColumns, $prefix) {
$prefixColumn = $prefix . '_';
- $allKeys = array_keys($sqlColumns);
- $replaced = array();
- $headerRows = array_values($headerRows);
+ $allKeys = array_keys($sqlColumns);
+ $replaced = array();
+ $headerRows = array_values($headerRows);
// name map of the non standard fields in header rows & sql columns
$mappingFields = array(
* @param null $saveFile
* @param string $batchItems
*/
- public static function writeCSVFromTable($exportTempTable, $headerRows, $sqlColumns, $exportMode, $saveFile = null, $batchItems = '') {
+ public static function writeCSVFromTable($exportTempTable, $headerRows, $sqlColumns, $exportMode, $saveFile = NULL, $batchItems = '') {
$writeHeader = TRUE;
- $offset = 0;
- $limit = self::EXPORT_ROW_COUNT;
+ $offset = 0;
+ $limit = self::EXPORT_ROW_COUNT;
$query = "SELECT * FROM $exportTempTable";
}
$componentDetails[] = $row;
}
- if ( $exportMode == 'financial' ) {
+ if ($exportMode == 'financial') {
$getExportFileName = 'CiviCRM Contribution Search';
}
else {
- $getExportFileName =self::getExportFileName( 'csv', $exportMode );
+ $getExportFileName = self::getExportFileName('csv', $exportMode);
}
- $csvRows = CRM_Core_Report_Excel::writeCSVFile( $getExportFileName,
+ $csvRows = CRM_Core_Report_Excel::writeCSVFile($getExportFileName,
$headerRows,
$componentDetails,
- null,
+ NULL,
$writeHeader,
- $saveFile );
+ $saveFile);
if ($saveFile && !empty($csvRows)) {
$batchItems .= $csvRows;
}
- $writeHeader = false;
+ $writeHeader = FALSE;
$offset += $limit;
}
}
*/
public static function componentPaymentFields() {
static $componentPaymentFields;
- if (!isset( $componentPaymentFields)) {
+ if (!isset($componentPaymentFields)) {
$componentPaymentFields = array(
- 'componentPaymentField_total_amount' => ts('Total Amount'),
+ 'componentPaymentField_total_amount' => ts('Total Amount'),
'componentPaymentField_contribution_status' => ts('Contribution Status'),
- 'componentPaymentField_received_date' => ts('Received Date'),
- 'componentPaymentField_payment_instrument' => ts('Payment Instrument'),
- 'componentPaymentField_transaction_id' => ts('Transaction ID'),
+ 'componentPaymentField_received_date' => ts('Received Date'),
+ 'componentPaymentField_payment_instrument' => ts('Payment Instrument'),
+ 'componentPaymentField_transaction_id' => ts('Transaction ID'),
);
}
return $componentPaymentFields;