$condition = " AND ((ceft1.entity_table IS NOT NULL) OR (cft.payment_instrument_id IS NOT NULL AND ceft1.entity_table IS NULL)) ";
}
$query = "SELECT ceft.id, ceft.financial_trxn_id FROM `civicrm_financial_trxn` cft
-LEFT JOIN civicrm_entity_financial_trxn ceft
+LEFT JOIN civicrm_entity_financial_trxn ceft
ON ceft.financial_trxn_id = cft.id AND ceft.entity_table = 'civicrm_contribution'
LEFT JOIN civicrm_entity_financial_trxn ceft1
ON ceft1.financial_trxn_id = cft.id AND ceft1.entity_table = 'civicrm_financial_item'
WHERE ceft.entity_id = %1 AND (cfi.entity_table <> 'civicrm_financial_trxn' or cfi.entity_table is NULL)
{$condition}
ORDER BY cft.id {$orderBy}
-LIMIT 1;";
-
+LIMIT 1;";
+
$params = array(1 => array($entity_id, 'Integer'));
$dao = CRM_Core_DAO::executeQuery($query, $params);
if ($dao->fetch()) {
static function getFinancialTrxnTotal($entity_id) {
$query = "
SELECT (ft.amount+SUM(ceft.amount)) AS total FROM civicrm_entity_financial_trxn AS ft
-LEFT JOIN civicrm_entity_financial_trxn AS ceft ON ft.financial_trxn_id = ceft.entity_id
+LEFT JOIN civicrm_entity_financial_trxn AS ceft ON ft.financial_trxn_id = ceft.entity_id
WHERE ft.entity_table = 'civicrm_contribution' AND ft.entity_id = %1
";
static function getFinancialTrxnLineTotal($entity_id, $entity_table = 'civicrm_contribution') {
$query = "SELECT lt.price_field_value_id AS id, ft.financial_trxn_id,ft.amount AS amount FROM civicrm_entity_financial_trxn AS ft
LEFT JOIN civicrm_financial_item AS fi ON fi.id = ft.entity_id AND fi.entity_table = 'civicrm_line_item' AND ft.entity_table = 'civicrm_financial_item'
-LEFT JOIN civicrm_line_item AS lt ON lt.id = fi.entity_id AND lt.entity_table = %2
+LEFT JOIN civicrm_line_item AS lt ON lt.id = fi.entity_id AND lt.entity_table = %2
WHERE lt.entity_id = %1 ";
$sqlParams = array(1 => array($entity_id, 'Integer'), 2 => array($entity_table, 'String'));
*/
static function deleteFinancialTrxn($entity_id) {
$query = "DELETE ceft1, cfi, ceft, cft FROM `civicrm_financial_trxn` cft
-LEFT JOIN civicrm_entity_financial_trxn ceft
+LEFT JOIN civicrm_entity_financial_trxn ceft
ON ceft.financial_trxn_id = cft.id AND ceft.entity_table = 'civicrm_contribution'
LEFT JOIN civicrm_entity_financial_trxn ceft1
ON ceft1.financial_trxn_id = cft.id AND ceft1.entity_table = 'civicrm_financial_item'
-LEFT JOIN civicrm_financial_item cfi
+LEFT JOIN civicrm_financial_item cfi
ON ceft1.entity_table = 'civicrm_financial_item' and cfi.id = ceft1.entity_id
WHERE ceft.entity_id = %1";
CRM_Core_DAO::executeQuery($query, array(1 => array($entity_id, 'Integer')));
if ((!CRM_Utils_Array::value('financial_type_id', $params) || !CRM_Utils_Array::value('contributionId', $params)) && !CRM_Utils_Array::value('oldPremium', $params)) {
return;
}
-
+
if (CRM_Utils_Array::value('cost', $params)) {
$contributionStatuses = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
$financialAccountType = CRM_Contribute_PseudoConstant::financialAccountType($params['financial_type_id']);
$params['trxnParams']['from_financial_account_id'] = $params['to_financial_account_id'];
$params['trxnParams']['to_financial_account_id'] = $financialAccount;
$params['trxnParams']['total_amount'] = $amount;
- $params['trxnParams']['fee_amount'] =
+ $params['trxnParams']['fee_amount'] =
$params['trxnParams']['net_amount'] = 0;
$params['trxnParams']['status_id'] = CRM_Core_OptionGroup::getValue('contribution_status','Completed','name');
$params['trxnParams']['contribution_id'] = isset($params['contribution']->id) ? $params['contribution']->id : $params['contribution_id'];
$financialTrxnID = CRM_Core_BAO_FinancialTrxn::getFinancialTrxnId($params['trxnParams']['contribution_id'], 'DESC');
$params['entity_id'] = $financialTrxnID['financialTrxnId'];
}
- $fItemParams =
+ $fItemParams =
array(
'financial_account_id' => $financialAccount,
'contact_id' => CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Domain', $domainId, 'contact_id'),
}
$query = "
-SELECT civicrm_openid.openid, civicrm_location_type.name as locationType, civicrm_openid.is_primary as is_primary,
-civicrm_openid.allowed_to_login as allowed_to_login, civicrm_openid.id as openid_id,
+SELECT civicrm_openid.openid, civicrm_location_type.name as locationType, civicrm_openid.is_primary as is_primary,
+civicrm_openid.allowed_to_login as allowed_to_login, civicrm_openid.id as openid_id,
civicrm_openid.location_type_id as locationTypeId
FROM civicrm_contact
LEFT JOIN civicrm_openid ON ( civicrm_openid.contact_id = civicrm_contact.id )
$queryString = "
SELECT cg.id as cgId
FROM civicrm_custom_group cg
- INNER JOIN civicrm_custom_field cf
+ INNER JOIN civicrm_custom_field cf
ON cg.id = cf.custom_group_id
WHERE cf.id IN (" . $customFieldIds . ") AND is_multiple = 1 LIMIT 0,1";
return TRUE;
}
- /* Function to find out whether given profile group uses $required
+ /* Function to find out whether given profile group uses $required
* and/or $optionalprofile types
- *
+ *
* @param integer $ufGroupId profile id
* @param array $required array of types those are required
* @param array $optional array of types those are optional
*
- * @return boolean $valid
+ * @return boolean $valid
* @static
*/
static function checkValidProfileType($ufGroupId, $required, $optional = NULL) {
}
$query = "
-SELECT id
- From civicrm_uf_field
+SELECT id
+ From civicrm_uf_field
WHERE (in_selector = 1 OR is_searchable = 1)
AND uf_group_id = {$profileID}";
if (empty($params)) {
return FALSE;
}
-
+
$ids = self::allWebsites($contactID);
foreach ($params as $key => $values) {
$websiteId = CRM_Utils_Array::value('id', $values);
is_array($ids) && !empty($ids)
) {
foreach ($ids as $id => $value) {
- if (($value['website_type_id'] == $values['website_type_id'])
+ if (($value['website_type_id'] == $values['website_type_id'])
&& CRM_Utils_Array::value('url', $value)) {
$values['id'] = $id;
unset($ids[$id]);
self::add($values);
}
}
-
+
if ($skipDelete && !empty($ids)) {
self::del(array_keys($ids));
}
abstract class CRM_Core_Component_Info {
/*
- * Name of the class (minus component namespace path)
- * of the component invocation class'es name.
+ * Name of the class (minus component namespace path)
+ * of the component invocation class'es name.
*/
CONST COMPONENT_INVOKE_CLASS = 'Invoke';
/*
- * Name of the class (minus component namespace path)
+ * Name of the class (minus component namespace path)
* of the component configuration class'es name.
*/
CONST COMPONENT_CONFIG_CLASS = 'Config';
/*
- * Name of the class (minus component namespace path)
+ * Name of the class (minus component namespace path)
* of the component BAO Query class'es name.
*/
CONST COMPONENT_BAO_QUERY_CLASS = 'BAO_Query';
/*
- * Name of the class (minus component namespace path)
+ * Name of the class (minus component namespace path)
* of the component user dashboard plugin.
*/
CONST COMPONENT_USERDASHBOARD_CLASS = 'Page_UserDashboard';
/*
- * Name of the class (minus component namespace path)
+ * Name of the class (minus component namespace path)
* of the component tab offered to contact record view.
*/
CONST COMPONENT_TAB_CLASS = 'Page_Tab';
/*
- * Name of the class (minus component namespace path)
+ * Name of the class (minus component namespace path)
* of the component tab offered to contact record view.
*/
CONST COMPONENT_ADVSEARCHPANE_CLASS = 'Form_Search_AdvancedSearchPane';
/*
- * Name of the directory (assumed in component directory)
+ * Name of the directory (assumed in component directory)
* where xml resources used by this component live.
*/
CONST COMPONENT_XML_RESOURCES = 'xml';
/*
- * Name of the directory (assumed in xml resources path)
+ * Name of the directory (assumed in xml resources path)
* containing component menu definition XML file names.
*/
CONST COMPONENT_MENU_XML = 'Menu';
* Class constructor, sets name and namespace (those are stored
* in the component registry (database) and no need to duplicate
* them here, as well as populates the info variable.
- *
+ *
* @param string $name name of the component
* @param string $namespace namespace prefix for component's files
* @access public
- *
+ *
*/
public function __construct($name, $namespace, $componentID) {
$this->name = $name;
/*
* Class constructor
- *
+ *
* @param void
* @access public
- *
+ *
*/
public function __construct() {
$config = CRM_Core_Config::singleton();
}
/*
- *
+ *
* @param void
* @access private
- *
+ *
*/
public function execute($auth = TRUE) {
/*
* Class destructor
- *
+ *
* @param void
* @access public
- *
+ *
*/
public function __destruct() {}
/*
* Retrieves the list of jobs from the database,
* populates class param.
- *
+ *
* @param void
* @return array ($id => CRM_Core_ScheduledJob)
* @access private
- *
+ *
*/
private function _getJobs() {
$jobs = array();
/*
* Retrieves specific job from the database by id
* and creates ScheduledJob object.
- *
+ *
* @param void
* @access private
- *
+ *
*/
private function _getJob($id = NULL, $entity = NULL, $action = NULL) {
if (is_null($id) && is_null($action)) {
$this->singleRunParams[$key] = $params;
$this->singleRunParams[$key]['version'] = 3;
}
-
+
/*
*
* @return array|null collection of permissions, null if none
'result' => $result,
));
throw new Exception('API error: ' . $result['error_message']);
- }
+ }
}
if (CRM_Utils_Array::value('id', $_REQUEST)) {
$id = CRM_Utils_Type::escape($_REQUEST['id'], 'Integer');
}
-
+
if (CRM_Utils_Array::value('context', $_REQUEST)) {
$context = CRM_Utils_Type::escape($_REQUEST['context'], 'String');
}
- // return false if $id is null and
+ // return false if $id is null and
// $context is not civicrm_event or civicrm_contribution_page
if (!$id || !in_array($context, array('civicrm_event', 'civicrm_contribution_page'))) {
return false;
$this->_sort = new CRM_Utils_Sort($this->_sortOrder, $this->_sortID);
/*
- * if we are in transfer mode, do not goto database, use the
+ * if we are in transfer mode, do not goto database, use the
* session values instead
*/
* Version: 0.1
* Date: 2006-16-02
* Author: Thorsten Albrecht <thor_REMOVE.THIS_@wolke7.net>
- * Purpose: "substring" allows you to retrieve a small part (substring) of a string.
- * Notes: The substring is specified by giving the start position and the length.
+ * Purpose: "substring" allows you to retrieve a small part (substring) of a string.
+ * Notes: The substring is specified by giving the start position and the length.
* Unlike the original function substr() in PHP the position of the characters
* in the string starts at 1 (not at 0 as usual in php).
* Example smarty code:
- * {$my_string|substring:2:4}
+ * {$my_string|substring:2:4}
* returns substring from character 2 until character 6
* @link based on substr(): http://www.zend.com/manual/function.substr.php
* @param string