Commit 03e04002 authored by eileen's avatar eileen

CRM-12595 fix formatting in remaing files

parent 366fe2a3
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.3 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2013 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
class CRM_Dedupe_BAO_QueryBuilder_IndividualUnsupervised extends CRM_Dedupe_BAO_QueryBuilder {
static function record($rg) {
......@@ -62,7 +87,7 @@ SELECT contact_id1 as id1, contact_id2 as id2, {$rg->threshold} as weight
FROM emails
JOIN civicrm_contact as contact1 on contact1.id=contact_id1
JOIN civicrm_contact as contact2 on contact2.id=contact_id2
WHERE contact1.contact_type='Individual'
WHERE contact1.contact_type='Individual'
AND contact2.contact_type='Individual'
AND " . self::internalFilters($rg);
......
......@@ -1765,7 +1765,7 @@ WHERE cpf.price_set_id = %1 AND cpfv.label LIKE %2";
*
* CRM-12155
*
* @param integer $contactId contact id
* @param integer $contactId contact id
*
* @access public
* @static
......
......@@ -122,8 +122,8 @@ class CRM_Event_BAO_ParticipantStatusType extends CRM_Event_DAO_ParticipantStatu
LEFT JOIN civicrm_event event ON ( event.id = participant.event_id )
WHERE participant.status_id IN {$statusIds}
AND (event.end_date > now() OR event.end_date IS NULL)
AND event.is_active = 1
ORDER BY participant.register_date, participant.id
AND event.is_active = 1
ORDER BY participant.register_date, participant.id
";
$dao = CRM_Core_DAO::executeQuery($query);
while ($dao->fetch()) {
......
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.3 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2013 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
class CRM_Event_Cart_BAO_MerParticipant extends CRM_Event_BAO_Participant {
public $email = NULL;
public $contribution_id = NULL;
public $cart = NULL;
//XXX
//XXX
function __construct($participant = NULL) {
parent::__construct();
$a = (array)$participant;
......
......@@ -125,7 +125,7 @@ class CRM_Event_Cart_Form_Checkout_Payment extends CRM_Event_Cart_Form_Cart {
foreach ($this->cart->get_main_events_in_carts() as $event_in_cart) {
if ($payment_processor_id == NULL && $event_in_cart->event->payment_processor != NULL) {
$payment_processor_id = $event_in_cart->event->payment_processor;
$this->financial_type_id = $event_in_cart->event->financial_type_id;
$this->financial_type_id = $event_in_cart->event->financial_type_id;
}
else {
if ($event_in_cart->event->payment_processor != NULL && $event_in_cart->event->payment_processor != $payment_processor_id) {
......@@ -559,7 +559,7 @@ class CRM_Event_Cart_Form_Checkout_Payment extends CRM_Event_Cart_Form_Cart {
'payment_processor' => $this->_paymentProcessor['payment_processor_type'],
'trxn_id' => $result['trxn_id'],
);
$trxn = new CRM_Financial_DAO_FinancialTrxn();
$trxn = new CRM_Financial_DAO_FinancialTrxn();
$trxn->copyValues($trxnParams);
if (!CRM_Utils_Rule::currencyCode($trxn->currency)) {
$config = CRM_Core_Config::singleton();
......@@ -618,7 +618,7 @@ class CRM_Event_Cart_Form_Checkout_Payment extends CRM_Event_Cart_Form_Cart {
'amount' => $params['amount'],
'currency' => CRM_Utils_Array::value('currencyID', $params),
);
$entity_trxn =& new CRM_Financial_DAO_EntityFinancialTrxn();
$entity_trxn =& new CRM_Financial_DAO_EntityFinancialTrxn();
$entity_trxn->copyValues($entity_financial_trxn_params);
$entity_trxn->save();
}
......
......@@ -348,7 +348,7 @@ class CRM_Event_Form_ManageEvent_EventInfo extends CRM_Event_Form_ManageEvent {
CRM_Price_BAO_Set::addTo('civicrm_event', $event->id, $priceSetId);
}
}
$this->set('id', $event->id);
if ($this->_action & CRM_Core_Action::ADD) {
......@@ -380,7 +380,7 @@ class CRM_Event_Form_ManageEvent_EventInfo extends CRM_Event_Form_ManageEvent {
return ts('Event Information and Settings');
}
/* Retrieve event template custom data values
/* Retrieve event template custom data values
* and set as default values for current new event.
*
* @params int $tempId event template id.
......
......@@ -257,8 +257,8 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent {
NULL, NULL, NULL, NULL,
array('&nbsp;&nbsp;', '&nbsp;&nbsp;', '&nbsp;&nbsp;', '<br/>')
);
// financial type
// financial type
$financialType = CRM_Financial_BAO_FinancialType::getIncomeFinancialType();
$this->add('select', 'financial_type_id', ts('Financial Type'),
array('' => ts('- select -')) + $financialType
......@@ -476,7 +476,7 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent {
}
}
}
if ($values['is_monetary']) {
if ($values['is_monetary']) {
//check if financial type is selected
if (!$values['financial_type_id']) {
$errors['financial_type_id'] = ts("Please select financial type.");
......
......@@ -120,7 +120,7 @@ class CRM_Event_Form_ManageEvent_Location extends CRM_Event_Form_ManageEvent {
if (!isset($defaults['address'][1]['country_id'])) {
$defaults['address'][1]['country_id'] = $config->defaultContactCountry;
}
if (!isset($defaults['address'][1]['state_province_id'])) {
$defaults['address'][1]['state_province_id'] = $config->defaultContactStateProvince;
}
......@@ -197,7 +197,7 @@ class CRM_Event_Form_ManageEvent_Location extends CRM_Event_Form_ManageEvent {
}
// get the list of location blocks being used by other events
$locationEvents = CRM_Event_BAO_Event::getLocationEvents();
// remove duplicates and make sure that the duplicate entry with key as
// loc_block_id of this event (this->_id) is preserved
......
......@@ -104,7 +104,7 @@ class CRM_Event_Form_ManageEvent_ScheduleReminders extends CRM_Event_Form_Manage
* @access public
*/
public function buildQuickForm() {
$field = 'civicrm_event';
$field = 'civicrm_event';
if ($this->_isTemplate) {
$field = 'event_template';
}
......
......@@ -1173,10 +1173,10 @@ loadCampaign( {$this->_eID}, {$eventCampaigns} );
// set source if not set
if (empty($params['source'])) {
$this->_params['participant_source'] = ts('Offline Registration for Event: %2 by: %1', array(1 => $userName, 2 => $eventTitle));
$this->_params['participant_source'] = ts('Offline Registration for Event: %2 by: %1', array(1 => $userName, 2 => $eventTitle));
}
else {
$this->_params['participant_source'] = $params['source'];
$this->_params['participant_source'] = $params['source'];
}
$this->_params['description'] = $this->_params['participant_source'];
......@@ -1253,7 +1253,7 @@ loadCampaign( {$this->_eID}, {$eventCampaigns} );
if (($this->_lineItem || !isset($params['proceSetId'])) && !$this->_paymentId && $this->_id) {
CRM_Price_BAO_LineItem::deleteLineItems($this->_id, 'civicrm_participant');
}
if ($this->_mode) {
// add all the additioanl payment params we need
$this->_params["state_province-{$this->_bltID}"] = $this->_params["billing_state_province-{$this->_bltID}"] = CRM_Core_PseudoConstant::stateProvinceAbbreviation($this->_params["billing_state_province_id-{$this->_bltID}"]);
......
......@@ -98,7 +98,7 @@ class CRM_Event_Form_Registration_ThankYou extends CRM_Event_Form_Registration {
$this->assign('email', $email);
}
$this->assignToTemplate();
if ($this->_priceSetId && !CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', $this->_priceSetId, 'is_quick_config')) {
$lineItemForTemplate = array();
foreach ($this->_lineItem as $key => $value) {
......
......@@ -68,7 +68,7 @@ class CRM_Event_Form_Task_Batch extends CRM_Event_Form_Task {
*
* @return void
* @access public
*/
*/
function preProcess() {
/*
* initialize the task and row fields
......
......@@ -62,7 +62,7 @@ class CRM_Event_Form_Task_PickProfile extends CRM_Event_Form_Task {
*
* @return void
* @access public
*/
*/
function preProcess() {
/*
* initialize the task and row fields
......
......@@ -53,7 +53,7 @@ class CRM_Event_Form_Task_SearchTaskHookSample extends CRM_Event_Form_Task {
$query = "
SELECT p.fee_amount as amount,
p.register_date as register_date,
p.source as source,
p.source as source,
ct.display_name as display_name
FROM civicrm_participant p
INNER JOIN civicrm_contact ct ON ( p.contact_id = ct.id )
......
......@@ -451,7 +451,7 @@ abstract class CRM_Event_Import_Parser {
$this->_activeFields[$i]->_hasLocationType = $elements[$i];
}
}
function setActiveFieldPhoneTypes( $elements )
{
for ($i = 0; $i < count( $elements ); $i++) {
......
......@@ -78,7 +78,7 @@ ORDER BY title
SELECT v.label ,v.value
FROM civicrm_option_value v,
civicrm_option_group g
WHERE v.option_group_id = g.id
WHERE v.option_group_id = g.id
AND g.name = 'event_type'
AND v.is_active = 1
AND {$whereClause}
......@@ -102,14 +102,14 @@ ORDER by v.weight";
}
$whereClause = "cv.label LIKE '$name%' ";
$query = "SELECT DISTINCT (
cv.label
), cv.id
FROM civicrm_price_field_value cv
LEFT JOIN civicrm_price_field cf ON cv.price_field_id = cf.id
LEFT JOIN civicrm_price_set_entity ce ON ce.price_set_id = cf.price_set_id
WHERE ce.entity_table = 'civicrm_event' AND {$whereClause}
WHERE ce.entity_table = 'civicrm_event' AND {$whereClause}
GROUP BY cv.label";
$dao = CRM_Core_DAO::executeQuery($query);
while ($dao->fetch()) {
......
......@@ -59,8 +59,8 @@ class CRM_Event_Page_ParticipantListing_Simple extends CRM_Core_Page {
$fromClause = "
FROM civicrm_contact
INNER JOIN civicrm_participant ON ( civicrm_contact.id = civicrm_participant.contact_id
AND civicrm_contact.is_deleted = 0 )
INNER JOIN civicrm_participant ON ( civicrm_contact.id = civicrm_participant.contact_id
AND civicrm_contact.is_deleted = 0 )
INNER JOIN civicrm_event ON civicrm_participant.event_id = civicrm_event.id
LEFT JOIN civicrm_email ON ( civicrm_contact.id = civicrm_email.contact_id AND civicrm_email.is_primary = 1 )
";
......
......@@ -149,7 +149,7 @@ class CRM_Export_Form_Select extends CRM_Core_Form {
CRM_Case_Form_Task::preProcessCommon($this, TRUE);
$this->_exportMode = self::CASE_EXPORT;
$componentName = array('', 'Case');
break;
break;
}
$this->_task = $values['task'];
......
......@@ -44,7 +44,7 @@ interface CRM_Extension_Manager_Interface {
/**
* Perform type-specific removal logic (before updating the extension
* row in the "civicrm_extension" table).
*
*
* @param CRM_Extension_Info $info may be generated from xml or DB (which is lossy)
* @see CRM_Extension_Manager::createInfoFromDB
*/
......
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.3 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2013 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| 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-2013
* $Id$
*
*/
/**
* Base class for Export Formats
* Create a subclass for a specific format.
* @see http://wiki.civicrm.org/confluence/display/CRM/CiviAccounts+Specifications+-++Batches#CiviAccountsSpecifications-Batches-%C2%A0Overviewofimplementation
*/
class CRM_Financial_BAO_ExportFormat {
/*
* Array of data which the individual export formats will output in the desired format
*/
protected $_exportParams;
/*
* smarty template
*/
static protected $_template;
/**
* class constructor
*/
function __construct() {
if ( !isset( self::$_template ) ) {
self::$_template = CRM_Core_Smarty::singleton();
}
}
// Override to assemble the appropriate subset of financial data for the specific export format
function export($exportParams) {
$this->_exportParams = $exportParams;
return $exportParams;
}
function output($fileName = NULL) {
switch ($this->getFileExtension()) {
case 'csv':
self::createActivityExport($this->_batchIds, $fileName);
break;
case 'iif':
$tplFile = $this->getTemplateFileName();
$out = self::getTemplate()->fetch( $tplFile );
$fileName = $this->putFile($out);
self::createActivityExport($this->_batchIds, $fileName);
break;
}
}
function getMimeType() {
return 'text/plain';
}
function getFileExtension() {
return 'txt';
}
// Override this if appropriate
function getTemplateFileName() {
return null;
}
static function &getTemplate() {
return self::$_template;
}
function assign($var, $value = NULL) {
self::$_template->assign($var, $value);
}
/*
* This gets called for every item of data being compiled before being sent to the exporter for output.
*
* Depending on the output format might want to override this, e.g. for IIF tabs need to be escaped etc,
* but for CSV it doesn't make sense because php has built in csv output functions.
*/
static function format($s, $type = 'string') {
if (!empty($s)) {
return $s;
}
else {
return NULL;
}
}
function initiateDownload() {
$config = CRM_Core_Config::singleton();
//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);
if ($result) {
header('Content-Type: application/zip');
header('Content-Disposition: attachment; filename='.CRM_Utils_File::cleanFileName(basename($zip)));
header('Content-Length: ' . filesize($zip));
ob_clean();
flush();
readfile($config->customFileUploadDir.CRM_Utils_File::cleanFileName(basename($zip)));
unlink($zip); //delete the zip to avoid clutter.
CRM_Utils_System::civiExit();
}
}
else {
header('Content-Type: '.mime_content_type($this->_downloadFile[0]));
header('Content-Disposition: attachment; filename='.CRM_Utils_File::cleanFileName(basename($this->_downloadFile[0])));
header('Content-Length: ' . filesize($this->_downloadFile[0]));
ob_clean();
flush();
readfile($config->customFileUploadDir.CRM_Utils_File::cleanFileName(basename($this->_downloadFile[0])));
CRM_Utils_System::civiExit();
}
}
static function createActivityExport($batchIds, $fileName) {
$session = CRM_Core_Session::singleton();
$values = array();
$params = array('id' => $batchIds);
CRM_Batch_BAO_Batch::retrieve($params, $values);
$createdBy = CRM_Contact_BAO_Contact::displayName($values['created_id']);
$modifiedBy = CRM_Contact_BAO_Contact::displayName($values['modified_id']);
$values['payment_instrument_id'] = '';
if (isset($values['payment_instrument_id'])) {
$paymentInstrument = array_flip(CRM_Contribute_PseudoConstant::paymentInstrument('label'));
$values['payment_instrument_id'] = array_search($values['payment_instrument_id'], $paymentInstrument);
}
$details = '<p>' . ts('Record: ') . $values['title'] . '</p><p>' . ts('Description: ') . '</p><p>' . ts('Created By: ') . $createdBy . '</p><p>' . ts('Created Date: ') . $values['created_date'] . '</p><p>' . ts('Last Modified By: ') . $modifiedBy . '</p><p>' . ts('Payment Instrument: ') . $values['payment_instrument_id'] . '</p>';
$subject = '';
if (CRM_Utils_Array::value('total', $values)) {
$subject .= ts('Total') . '['. CRM_Utils_Money::format($values['total']) .'],';
}
if (CRM_Utils_Array::value('item_count', $values)) {
$subject .= ' ' . ts('Count') . '['. $values['item_count'] .'],';
}
//create activity.
$subject .= ' ' . ts('Batch') . '['. $values['title'] .']';
$activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, FALSE, FALSE, 'name');
$activityParams = array(
'activity_type_id' => array_search('Export Accounting Batch', $activityTypes),
'subject' => $subject,
'status_id' => 2,
'activity_date_time' => date('YmdHis'),
'source_contact_id' => $session->get('userID'),
'source_record_id' => $values['id'],
'target_contact_id' => $session->get('userID'),
'details' => $details,
'attachFile_1' => array (
'uri' => $fileName,
'type' => 'text/csv',
'location' => $fileName,
'upload_date' => date('YmdHis'),
),
);
CRM_Activity_BAO_Activity::create($activityParams);
}
function createZip($files = array(), $destination = NULL, $overwrite = 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
if (file_exists($file)) {
$validFiles[] = $file;
}
}
}
if (count($validFiles)) {
$zip = new ZipArchive();
if ($zip->open($destination,$overwrite ? ZIPARCHIVE::OVERWRITE : ZIPARCHIVE::CREATE) !== TRUE) {
return FALSE;
}
foreach ($validFiles as $file) {
$zip->addFile($file, CRM_Utils_File::cleanFileName(basename($file)));
}
$zip->close();
return file_exists($destination);
}
else {
return FALSE;
}
}
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.3 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2013 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| 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-2013
* $Id$
*
*/
/**
* Base class for Export Formats
* Create a subclass for a specific format.
* @see http://wiki.civicrm.org/confluence/display/CRM/CiviAccounts+Specifications+-++Batches#CiviAccountsSpecifications-Batches-%C2%A0Overviewofimplementation