$attachments = NULL,
$cc = NULL,
$bcc = NULL,
- // FIXME a param with no default shouldn't be last
- $contactIds,
+ $contactIds = NULL,
$additionalDetails = NULL
) {
// get the contact details of logged in contact, which we set as from email
// figure out the file name for activity type, if any
if ($this->_activityTypeId &&
- $this->_activityTypeFile =
- CRM_Activity_BAO_Activity::getFileForActivityTypeId($this->_activityTypeId, $this->_crmDir)
+ $this->_activityTypeFile = CRM_Activity_BAO_Activity::getFileForActivityTypeId($this->_activityTypeId, $this->_crmDir)
) {
$this->assign('activityTypeFile', $this->_activityTypeFile);
$this->assign('crmDir', $this->_crmDir);
$defaults['source_contact_id'] = $this->_sourceContactId;
$defaults['target_contact_id'] = $this->_targetContactId;
- list($defaults['activity_date_time'], $defaults['activity_date_time_time']) =
- CRM_Utils_Date::setDateDefaults(NULL, 'activityDateTime');
+ list($defaults['activity_date_time'], $defaults['activity_date_time_time'])
+ = CRM_Utils_Date::setDateDefaults(NULL, 'activityDateTime');
}
if ($this->_activityTypeId) {
* @param array $params
* Associated array of submitted values.
*
- * @return $this|null|object
+ * @return self|null|object
*/
protected function processActivity(&$params) {
$activityAssigned = array();
* Given a list of the importable field keys that the user has selected
* set the active fields array to this list
*
- * @param array mapped array of values
+ * @param array $fieldKeys
*
* @return void
*/
$newLinks = array();
}
elseif ($params['context'] == 'financialBatch') {
- $values['check'] =
- "<input type='checkbox' id='check_" .
+ $values['check'] = "<input type='checkbox' id='check_" .
$object->id .
"' name='check_" .
$object->id .
LEFT JOIN civicrm_contribution_soft ON civicrm_contribution_soft.contribution_id = civicrm_contribution.id
";
- $searchFields =
- array(
- 'sort_name',
- 'financial_type_id',
- 'contribution_page_id',
- 'contribution_payment_instrument_id',
- 'contribution_transaction_id',
- 'contribution_source',
- 'contribution_currency_type',
- 'contribution_pay_later',
- 'contribution_recurring',
- 'contribution_test',
- 'contribution_thankyou_date_is_not_null',
- 'contribution_receipt_date_is_not_null',
- 'contribution_pcp_made_through_id',
- 'contribution_pcp_display_in_roll',
- 'contribution_date_relative',
- 'contribution_amount_low',
- 'contribution_amount_high',
- 'contribution_in_honor_of',
- 'contact_tags',
- 'group',
- 'contribution_date_relative',
- 'contribution_date_high',
- 'contribution_date_low',
- 'contribution_check_number',
- 'contribution_status_id',
- );
+ $searchFields = array(
+ 'sort_name',
+ 'financial_type_id',
+ 'contribution_page_id',
+ 'contribution_payment_instrument_id',
+ 'contribution_transaction_id',
+ 'contribution_source',
+ 'contribution_currency_type',
+ 'contribution_pay_later',
+ 'contribution_recurring',
+ 'contribution_test',
+ 'contribution_thankyou_date_is_not_null',
+ 'contribution_receipt_date_is_not_null',
+ 'contribution_pcp_made_through_id',
+ 'contribution_pcp_display_in_roll',
+ 'contribution_date_relative',
+ 'contribution_amount_low',
+ 'contribution_amount_high',
+ 'contribution_in_honor_of',
+ 'contact_tags',
+ 'group',
+ 'contribution_date_relative',
+ 'contribution_date_high',
+ 'contribution_date_low',
+ 'contribution_check_number',
+ 'contribution_status_id',
+ );
$values = array();
foreach ($searchFields as $field) {
if (isset($params[$field])) {
*/
public static function getNextTab(&$form) {
static $next = FALSE;
- if ($next)
+ if ($next) {
return $next;
+ }
$tabs = $form->get('tabHeader');
if (is_array($tabs)) {
public function createDefaultCrudLink($crudLinkSpec) {
switch ($crudLinkSpec['action']) {
case CRM_Core_Action::VIEW:
-
- return array(
+ $result = array(
'title' => $this->display_name,
'path' => 'civicrm/contact/view',
'query' => array(
'cid' => $this->id,
),
);
+ return $result;
case CRM_Core_Action::UPDATE:
- return array(
+ $result = array(
'title' => $this->display_name,
'path' => 'civicrm/contact/add',
'query' => array(
'cid' => $this->id,
),
);
+ return $result;
}
return NULL;
}
// We don't know the contents of return properties, but we need the lower
// level ids of the contact so add a few fields.
- $returnProperties['first_name'] =
- $returnProperties['organization_name'] =
- $returnProperties['household_name'] =
- $returnProperties['contact_type'] =
+ $returnProperties['first_name'] = 1;
+ $returnProperties['organization_name'] = 1;
+ $returnProperties['household_name'] = 1;
+ $returnProperties['contact_type'] = 1;
$returnProperties['contact_sub_type'] = 1;
return list($query, $options) = CRM_Contact_BAO_Query::apiQuery($params, $returnProperties, $options);
}
return CRM_Core_BAO_EntityTag::getContactTags($contactId, TRUE);
case 'rel':
-
- return CRM_Contact_BAO_Relationship::getRelationship($contactId,
+ $result = CRM_Contact_BAO_Relationship::getRelationship($contactId,
CRM_Contact_BAO_Relationship::CURRENT,
0, 1
);
+ return $result;
case 'group':
$this->where_tables = serialize($whereTables);
}
}
-
- return;
}
/**
// make we require one primary block, CRM-5505
if ($updateMode) {
if (!$hasPrimary) {
- $hasPrimary =
- CRM_Utils_Array::value(
- 'is_primary',
- CRM_Utils_Array::value($instance, $defaults[$name])
- );
+ $hasPrimary = CRM_Utils_Array::value(
+ 'is_primary',
+ CRM_Utils_Array::value($instance, $defaults[$name])
+ );
}
continue;
}
/**
* Set default values for the form.
*
- * @param null
- *
* @return array
* array of default values
*/
if (isset($tokens[$entity]) && is_array($tokens[$entity])) {
foreach ($tokens[$entity] as $token) {
if (!self::isHtmlTokenInTableCell($token, $entity, $html)) {
- ;
return FALSE;
}
}
CRM_Utils_Address_USPS::checkAddress($params);
// do street parsing again if enabled, since street address might have changed
- $parseStreetAddress =
- CRM_Utils_Array::value(
- 'street_address_parsing',
- CRM_Core_BAO_Setting::valueOptions(
- CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
- 'address_options'
- ),
- FALSE
- );
+ $parseStreetAddress = CRM_Utils_Array::value(
+ 'street_address_parsing',
+ CRM_Core_BAO_Setting::valueOptions(
+ CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
+ 'address_options'
+ ),
+ FALSE
+ );
if ($parseStreetAddress && !empty($params['street_address'])) {
foreach (array(
* NB: civic street formats for en_CA and fr_CA used by default if those locales are active
* otherwise en_US format is default action
*
- * @param string Street address including number and apt
- * @param string Locale - to set locale used to parse address
+ * @param string $streetAddress
+ * Street address including number and apt.
+ * @param string $locale
+ * Locale used to parse address.
*
* @return array
* parsed fields values.
public static function validateAddressOptions($fields) {
static $addressOptions = NULL;
if (!$addressOptions) {
- $addressOptions =
- CRM_Core_BAO_Setting::valueOptions(
- CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
- 'address_options'
- );
+ $addressOptions = CRM_Core_BAO_Setting::valueOptions(
+ CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
+ 'address_options'
+ );
}
if (is_array($fields) && !empty($fields)) {
$uniqueAddress = array();
foreach (array_keys($rows) as $rowID) {
// load complete address as array key
- $address =
- trim($rows[$rowID]['street_address']) . trim($rows[$rowID]['city']) . trim($rows[$rowID]['state_province']) . trim($rows[$rowID]['postal_code']) . trim($rows[$rowID]['country']);
+ $address = trim($rows[$rowID]['street_address'])
+ . trim($rows[$rowID]['city'])
+ . trim($rows[$rowID]['state_province'])
+ . trim($rows[$rowID]['postal_code'])
+ . trim($rows[$rowID]['country']);
if (isset($rows[$rowID]['last_name'])) {
$name = $rows[$rowID]['last_name'];
}
/**
* Build and retrieve the list of data types and descriptions
*
- * @param NULL
- *
* @return array
* Data type => Description
*/
);
if (!array_key_exists($customFieldId, $customFields)) {
- return;
+ return NULL;
}
// return if field is a 'code' field
$params['extends'][0] == 'ParticipantEventName' ||
$params['extends'][0] == 'ParticipantEventType'
) {
- $group->extends_entity_column_id =
- CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionValue', $params['extends'][0], 'value', 'name');
+ $group->extends_entity_column_id = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionValue', $params['extends'][0], 'value', 'name');
}
//this is format when form get submit.
$dao = new CRM_Core_DAO_CustomGroup();
$dao->extends = $extends;
$dao->extends_entity_column_id = $columnId;
- $escapedValue =
- CRM_Core_DAO::VALUE_SEPARATOR . CRM_Core_DAO::escapeString($columnValue) .
- CRM_Core_DAO::VALUE_SEPARATOR;
+ $escapedValue = CRM_Core_DAO::VALUE_SEPARATOR . CRM_Core_DAO::escapeString($columnValue) . CRM_Core_DAO::VALUE_SEPARATOR;
$dao->whereAdd("extends_entity_column_value LIKE \"%$escapedValue%\"");
//$dao->extends_entity_column_value = $columnValue;
return $dao->find() ? TRUE : FALSE;
}
$cacheKey = "CRM_Core_DAO_CustomGroup_Query " . md5($cacheString);
- $multipleFieldGroupCacheKey =
- "CRM_Core_DAO_CustomGroup_QueryMultipleFields " . md5($cacheString);
+ $multipleFieldGroupCacheKey = "CRM_Core_DAO_CustomGroup_QueryMultipleFields " . md5($cacheString);
$cache = CRM_Utils_Cache::singleton();
$tablesWithEntityData = array();
if ($fromCache) {
'entity_id',
'file_id'
);
- $customValue['imageURL'] =
- str_replace('persist/contribute', 'custom', $config->imageUploadURL) .
+ $customValue['imageURL'] = str_replace('persist/contribute', 'custom', $config->imageUploadURL) .
$fileDAO->uri;
- list($path) = CRM_Core_BAO_File::path($fileDAO->id, $entityId,
- NULL, NULL
- );
+ list($path) = CRM_Core_BAO_File::path($fileDAO->id, $entityId, NULL, NULL);
if ($path && file_exists($path)) {
list($imageWidth, $imageHeight) = getimagesize($path);
list($imageThumbWidth, $imageThumbHeight) = CRM_Contact_BAO_Contact::getThumbSize($imageWidth, $imageHeight);
* Add the whereAdd clause for the DAO depending on the type of entity
* the custom group is extending.
*
- * @param $customGroupDAO
+ * @param object $customGroupDAO
* @param string $entityType
* What entity are we extending here ?.
*
- * @param object CRM_Core_DAO_CustomGroup (reference) - Custom Group DAO.
+ * @param int $entityID
* @param bool $allSubtypes
*
* @return void
case 'CheckBox':
if (!empty($v)) {
$customValue = array_keys($v);
- $groupTree[$groupID]['fields'][$fieldId]['customValue']['data'] =
- CRM_Core_DAO::VALUE_SEPARATOR .
- implode(CRM_Core_DAO::VALUE_SEPARATOR, $customValue) .
- CRM_Core_DAO::VALUE_SEPARATOR;
+ $groupTree[$groupID]['fields'][$fieldId]['customValue']['data'] = CRM_Core_DAO::VALUE_SEPARATOR
+ . implode(CRM_Core_DAO::VALUE_SEPARATOR, $customValue)
+ . CRM_Core_DAO::VALUE_SEPARATOR;
}
else {
$groupTree[$groupID]['fields'][$fieldId]['customValue']['data'] = NULL;
//added for Multi-Select
case 'Multi-Select':
if (!empty($v)) {
- $groupTree[$groupID]['fields'][$fieldId]['customValue']['data'] =
- CRM_Core_DAO::VALUE_SEPARATOR .
- implode(CRM_Core_DAO::VALUE_SEPARATOR, $v) .
- CRM_Core_DAO::VALUE_SEPARATOR;
+ $groupTree[$groupID]['fields'][$fieldId]['customValue']['data'] = CRM_Core_DAO::VALUE_SEPARATOR
+ . implode(CRM_Core_DAO::VALUE_SEPARATOR, $v)
+ . CRM_Core_DAO::VALUE_SEPARATOR;
}
else {
$groupTree[$groupID]['fields'][$fieldId]['customValue']['data'] = NULL;
* @param array $groupTree
* @param int $groupCount
* Group count by default 1, but can varry for multiple value custom data.
- * @param object form object
+ * @param object $form
*
* @return array
*/
* Given the list of params in the params array, fetch the object
* and store the values in the values array
*
- * @param array entityBlock input parameters to find object
+ * @param array $entityBlock
*
* @return array
* array of phone objects
}
}
else {
- $setting =
- CRM_Core_BAO_Setting::getItem(
- $fields['values'][$name]['group_name'],
- $name,
- CRM_Utils_Array::value('component_id', $params),
- NULL,
- CRM_Utils_Array::value('contact_id', $params),
- $domainID
- );
+ $setting = CRM_Core_BAO_Setting::getItem(
+ $fields['values'][$name]['group_name'],
+ $name,
+ CRM_Utils_Array::value('component_id', $params),
+ NULL,
+ CRM_Utils_Array::value('contact_id', $params),
+ $domainID
+ );
}
if (!is_null($setting)) {
// we won't return if not set - helps in return all scenario - otherwise we can't indentify the missing ones
/**
* Add default Next / Back buttons
*
- * @param array array of associative arrays in the order in which the buttons should be
- * displayed. The associate array has 3 fields: 'type', 'name' and 'isDefault'
- * The base form class will define a bunch of static arrays for commonly used
- * formats
+ * @param array $params
+ * Array of associative arrays in the order in which the buttons should be
+ * displayed. The associate array has 3 fields: 'type', 'name' and 'isDefault'
+ * The base form class will define a bunch of static arrays for commonly used
+ * formats.
*
* @return void
*/
/**
* Setter function for options
*
- * @param mixed
+ * @param mixed $options
*
* @return void
*/
/**
* Setter function for Form Action
*
- * @param string
+ * @param string $action
*
* @return void
*/
/**
* Store the variable with the value in the form scope
*
- * @param string name : name of the variable
- * @param mixed value : value of the variable
- *
+ * @param string $name
+ * Name of the variable.
+ * @param mixed $value
+ * Value of the variable.
*
* @return void
*/
/**
* Get the variable from the form scope
*
- * @param string name : name of the variable
- *
+ * @param string $name
+ * Name of the variable
*
* @return mixed
*/
if ($optionGroupIdExists) {
CRM_Core_BAO_OptionGroup::del($optionGroupIdExists);
}
- $optionGroupParams =
- array(
- 'name' => $type . '_repeat_exclude_dates_' . $actionScheduleObj->entity_value,
- 'title' => $type . ' recursion',
- 'is_reserved' => 0,
- 'is_active' => 1,
- );
+ $optionGroupParams = array(
+ 'name' => $type . '_repeat_exclude_dates_' . $actionScheduleObj->entity_value,
+ 'title' => $type . ' recursion',
+ 'is_reserved' => 0,
+ 'is_active' => 1,
+ );
$opGroup = CRM_Core_BAO_OptionGroup::add($optionGroupParams);
if ($opGroup->id) {
$oldWeight = 0;
$fieldValues = array('option_group_id' => $opGroup->id);
foreach ($excludeDates as $val) {
- $optionGroupValue =
- array(
- 'option_group_id' => $opGroup->id,
- 'label' => CRM_Utils_Date::processDate($val),
- 'value' => CRM_Utils_Date::processDate($val),
- 'name' => $opGroup->name,
- 'description' => 'Used for recurring ' . $type,
- 'weight' => CRM_Utils_Weight::updateOtherWeights('CRM_Core_DAO_OptionValue', $oldWeight, CRM_Utils_Array::value('weight', $params), $fieldValues),
- 'is_active' => 1,
- );
+ $optionGroupValue = array(
+ 'option_group_id' => $opGroup->id,
+ 'label' => CRM_Utils_Date::processDate($val),
+ 'value' => CRM_Utils_Date::processDate($val),
+ 'name' => $opGroup->name,
+ 'description' => 'Used for recurring ' . $type,
+ 'weight' => CRM_Utils_Weight::updateOtherWeights('CRM_Core_DAO_OptionValue', $oldWeight, CRM_Utils_Array::value('weight', $params), $fieldValues),
+ 'is_active' => 1,
+ );
$excludeDateList[] = $optionGroupValue['value'];
CRM_Core_BAO_OptionValue::add($optionGroupValue);
}
CRM_Core_Error::debug_log_message($e->getMessage());
}
if (!empty($error_handling['echo_error'])) {
- echo($e->getMessage());
+ echo $e->getMessage();
}
if (!empty($error_handling['return_error'])) {
return array(
//$args['desc'] = 'Recurring Contribution';
$args['totalbillingcycles'] = $params['installments'];
$args['version'] = '56.0';
- $args['profilereference'] =
- "i={$params['invoiceID']}" .
+ $args['profilereference'] = "i={$params['invoiceID']}" .
"&m=$component" .
"&c={$params['contactID']}" .
"&r={$params['contributionRecurID']}" .
$args['billingfrequency'] = $params['frequency_interval'];
$args['method'] = "CreateRecurringPaymentsProfile";
$args['profilestartdate'] = $start_date;
- $args['desc'] =
+ $args['desc'] = "" .
$params['description'] . ": " .
$params['amount'] . " Per " .
$params['frequency_interval'] . " " .
$args['amt'] = $params['amount'];
$args['totalbillingcycles'] = $params['installments'];
$args['version'] = 56.0;
- $args['PROFILEREFERENCE'] =
+ $args['PROFILEREFERENCE'] = "" .
"i=" . $params['invoiceID'] . "&m=" . $component .
"&c=" . $params['contactID'] . "&r=" . $params['contributionRecurID'] .
"&b=" . $params['contributionID'] . "&p=" . $params['contributionPageID'];
*
* @param array $params
* Assoc array of input parameters for this transaction.
- *
- * @return array|NULL
- * the result in an nice formatted array (or an error object)
- * @abstract
*/
public function doDirectPayment(&$params) {
CRM_Core_Error::fatal(ts('This function is not implemented'));
* @inheritDoc
*/
public function upgradePermissions($permissions) {
- return;
}
}
* csvString - The html string to display for export as csv
* rowCount - the number of rows to be included
*
- * @param string action the action being performed
- * @param array params the array that the pagerParams will be inserted into
+ * @param string $action
+ * The action being performed.
+ * @param array $params
+ * The array that the pagerParams will be inserted into.
*
* @return void
*/
/**
* Returns the sort order array for the given action
*
- * @param string action the action being performed
+ * @param string $action
+ * The action being performed.
*
* @return array
* the elements that can be sorted along with their properties
/**
* Returns the number of rows for this action
*
- * @param string action the action being performed
+ * @param string $action
+ * The action being performed.
*
* @return int
* the total number of rows for this action
/**
* Return the filename for the exported CSV
*
- * @param string type the type of export required: csv/xml/foaf etc
+ * @param string $type
+ * The type of export required: csv/xml/foaf etc.
*
* @return string
* the fileName which we will munge to skip spaces and
* {$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
- * @param position: startposition of the substring, beginning with 0
- * @param length: length of substring
+ * @param string $string
+ * @param int $position
+ * startposition of the substring, beginning with 0
+ * @param int $length
+ * length of substring
* @return string
- *
- * -------------------------------------------------------------
*/
function smarty_modifier_substring($string, $position, $length) {
return substr($string, $position, $length);
$extIdentifier = CRM_Utils_Array::value('external_identifier', $contactFields);
if ($extIdentifier) {
$tmpContactField['external_identifier'] = $extIdentifier;
- $tmpContactField['external_identifier']['title'] =
- CRM_Utils_Array::value('title', $extIdentifier) . ' (match to contact)';
+ $tmpContactField['external_identifier']['title'] = CRM_Utils_Array::value('title', $extIdentifier) . ' (match to contact)';
}
- $tmpFields['participant_contact_id']['title'] =
- $tmpFields['participant_contact_id']['title'] . ' (match to contact)';
+ $tmpFields['participant_contact_id']['title'] = $tmpFields['participant_contact_id']['title'] . ' (match to contact)';
$fields = array_merge($fields, $tmpContactField);
$fields = array_merge($fields, $tmpFields);
$contributionParams['contribution']->financial_type_id, $relationTypeId);
if (!empty($contributionParams['trxnParams']['from_financial_account_id'])) {
$contributionParams['trxnParams']['total_amount'] = $mainAmount - $contributionParams['total_amount'];
- $contributionParams['trxnParams']['payment_processor_id'] = $contributionParams['trxnParams']['payment_instrument_id'] =
- $contributionParams['trxnParams']['check_number'] = $contributionParams['trxnParams']['trxn_id'] =
- $contributionParams['trxnParams']['net_amount'] = $contributionParams['trxnParams']['fee_amount'] = NULL;
+ $contributionParams['trxnParams']['payment_processor_id'] = NULL;
+ $contributionParams['trxnParams']['payment_instrument_id'] = NULL;
+ $contributionParams['trxnParams']['check_number'] = NULL;
+ $contributionParams['trxnParams']['trxn_id'] = NULL;
+ $contributionParams['trxnParams']['net_amount'] = NULL;
+ $contributionParams['trxnParams']['fee_amount'] = NULL;
CRM_Core_BAO_FinancialTrxn::create($contributionParams['trxnParams']);
}
}
- return;
}
/**
$ftDetail = CRM_Core_BAO_FinancialTrxn::getBalanceTrxnAmt($contributionId);
// adjusted amount financial_trxn creation
if (empty($ftDetail['trxn_id'])) {
- $updatedContribution =
- CRM_Contribute_BAO_Contribution::getValues(array('id' => $contributionId), CRM_Core_DAO::$_nullArray, CRM_Core_DAO::$_nullArray);
+ $updatedContribution = CRM_Contribute_BAO_Contribution::getValues(
+ array('id' => $contributionId),
+ CRM_Core_DAO::$_nullArray,
+ CRM_Core_DAO::$_nullArray
+ );
$relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Accounts Receivable Account is' "));
$toFinancialAccount = CRM_Contribute_PseudoConstant::financialAccountType($updatedContribution->financial_type_id, $relationTypeId);
}
/**
- * @return $this|bool|CRM_Event_Cart_BAO_Cart
+ * @return self|bool|CRM_Event_Cart_BAO_Cart
*/
public static function find_or_create_for_current_session() {
$session = CRM_Core_Session::singleton();
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
$this->_grantType = NULL;
if ($this->_id) {
- $this->_grantType =
- CRM_Core_DAO::getFieldValue('CRM_Grant_DAO_Grant', $this->_id, 'grant_type_id');
+ $this->_grantType = CRM_Core_DAO::getFieldValue('CRM_Grant_DAO_Grant', $this->_id, 'grant_type_id');
}
$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
$query->_element['mailing_id'] = 1;
// base table is contact, so join recipients to it
- $query->_tables['civicrm_mailing_recipients'] = $query->_whereTables['civicrm_mailing_recipients'] =
- " INNER JOIN civicrm_mailing_recipients ON civicrm_mailing_recipients.contact_id = contact_a.id ";
+ $query->_tables['civicrm_mailing_recipients'] = $query->_whereTables['civicrm_mailing_recipients']
+ = " INNER JOIN civicrm_mailing_recipients ON civicrm_mailing_recipients.contact_id = contact_a.id ";
$query->_tables['civicrm_mailing'] = $query->_whereTables['civicrm_mailing'] = 1;
// get mailing status
if (!empty($query->_returnProperties['mailing_job_status'])) {
- $query->_tables['civicrm_mailing_job'] = $query->_whereTables['civicrm_mailing_job'] =
- " LEFT JOIN civicrm_mailing_job ON civicrm_mailing_job.mailing_id = civicrm_mailing.id AND civicrm_mailing_job.parent_id IS NULL AND civicrm_mailing_job.is_test != 1 ";
+ $query->_tables['civicrm_mailing_job'] = $query->_whereTables['civicrm_mailing_job']
+ = " LEFT JOIN civicrm_mailing_job ON civicrm_mailing_job.mailing_id = civicrm_mailing.id AND civicrm_mailing_job.parent_id IS NULL AND civicrm_mailing_job.is_test != 1 ";
$query->_select['mailing_job_status'] = "civicrm_mailing_job.status as mailing_job_status";
$query->_element['mailing_job_status'] = 1;
}
// mailing job end date / completed date
if (!empty($query->_returnProperties['mailing_job_end_date'])) {
- $query->_tables['civicrm_mailing_job'] = $query->_whereTables['civicrm_mailing_job'] =
- " LEFT JOIN civicrm_mailing_job ON civicrm_mailing_job.mailing_id = civicrm_mailing.id AND civicrm_mailing_job.parent_id IS NULL AND civicrm_mailing_job.is_test != 1 ";
+ $query->_tables['civicrm_mailing_job'] = $query->_whereTables['civicrm_mailing_job']
+ = " LEFT JOIN civicrm_mailing_job ON civicrm_mailing_job.mailing_id = civicrm_mailing.id AND civicrm_mailing_job.parent_id IS NULL AND civicrm_mailing_job.is_test != 1 ";
$query->_select['mailing_job_end_date'] = "civicrm_mailing_job.end_date as mailing_job_end_date";
$query->_element['mailing_job_end_date'] = 1;
}
/**
* Set default values for the form.
*
- * @param null
- *
* @return array
* array of default values
*/
/**
* Get the action links for this page.
*
- * @param null
- *
* @return array
* array of action links that we need to display for the browse screen
*/
/**
* Browse all price fields.
*
- * @param null
- *
* @return void
*/
public function browse() {
* This method is called after the page is created. It checks for the
* type of action and executes that action.
*
- * @param null
- *
* @return void
*/
public function run() {
-
// get the field id
$this->_fid = CRM_Utils_Request::retrieve('fid', 'Positive',
$this, FALSE, 0
case CRM_Report_Form::OP_INT:
case CRM_Report_Form::OP_FLOAT:
- return array(
+ $result = array(
'lte' => ts('Is less than or equal to'),
'gte' => ts('Is greater than or equal to'),
'bw' => ts('Is between'),
'nll' => ts('Is empty (Null)'),
'nnll' => ts('Is not empty (Null)'),
);
+ return $result;
case CRM_Report_Form::OP_SELECT:
- return array(
+ $result = array(
'eq' => ts('Is equal to'),
);
+ return $result;
case CRM_Report_Form::OP_MONTH:
case CRM_Report_Form::OP_MULTISELECT:
case CRM_Report_Form::OP_ENTITYREF:
- return array(
+ $result = array(
'in' => ts('Is one of'),
'notin' => ts('Is not one of'),
);
+ return $result;
case CRM_Report_Form::OP_DATE:
- return array(
+ $result = array(
'nll' => ts('Is empty (Null)'),
'nnll' => ts('Is not empty (Null)'),
);
+ return $result;
case CRM_Report_Form::OP_MULTISELECT_SEPARATOR:
// use this operator for the values, concatenated with separator. For e.g if
// multiple options for a column is stored as ^A{val1}^A{val2}^A
- return array(
+ $result = array(
'mhas' => ts('Is one of'),
'mnot' => ts('Is not one of'),
);
+ return $result;
default:
// type is string
- return array(
+ $result = array(
'has' => ts('Contains'),
'sw' => ts('Starts with'),
'ew' => ts('Ends with'),
'nll' => ts('Is empty (Null)'),
'nnll' => ts('Is not empty (Null)'),
);
+ return $result;
}
}
empty($this->_params['activity_type_id_value'])
) {
$actTypes = array_flip(CRM_Core_PseudoConstant::activityType(TRUE, FALSE, FALSE, 'label', TRUE));
- $clause =
- "( {$this->_aliases['civicrm_activity']}.activity_type_id IN (" .
+ $clause = "( {$this->_aliases['civicrm_activity']}.activity_type_id IN (" .
implode(',', $actTypes) . ") )";
}
}
$dao = CRM_Core_DAO::executeQuery($sql);
while ($dao->fetch()) {
- $totalAmount[] =
- CRM_Utils_Money::format($dao->amount, $dao->currency) . " (" .
+ $totalAmount[] = CRM_Utils_Money::format($dao->amount, $dao->currency) . " (" .
$dao->count . ")";
$average[] = CRM_Utils_Money::format($dao->avg, $dao->currency);
$count += $dao->count;
GROUP BY {$this->_aliases['civicrm_contribution']}.currency";
$dao = CRM_Core_DAO::executeQuery($sql);
while ($dao->fetch()) {
- $totalAmount[] =
- CRM_Utils_Money::format($dao->amount, $dao->currency) . " (" .
+ $totalAmount[] = CRM_Utils_Money::format($dao->amount, $dao->currency) . " (" .
$dao->count . ")";
$average[] = CRM_Utils_Money::format($dao->avg, $dao->currency);
$count += $dao->count;
// 1. use main contribution query to build temp table 1
$sql = $this->buildQuery();
- $tempQuery =
- 'CREATE TEMPORARY TABLE civireport_contribution_detail_temp1 AS ' . $sql;
+ $tempQuery = 'CREATE TEMPORARY TABLE civireport_contribution_detail_temp1 AS ' . $sql;
CRM_Core_DAO::executeQuery($tempQuery);
$this->setPager();
$select = str_ireplace("'Contribution' as", "'Soft Credit' as", $select);
// we inner join with temp1 to restrict soft contributions to those in temp1 table
$sql = "{$select} {$this->_from} {$this->_where} {$this->_groupBy}";
- $tempQuery =
- 'CREATE TEMPORARY TABLE civireport_contribution_detail_temp2 AS ' . $sql;
+ $tempQuery = 'CREATE TEMPORARY TABLE civireport_contribution_detail_temp2 AS ' . $sql;
CRM_Core_DAO::executeQuery($tempQuery);
if (CRM_Utils_Array::value('contribution_or_soft_value', $this->_params) ==
'soft_credits_only'
}
if (!empty($this->_params['group_bys_freq'][$fieldName])) {
$this->_interval = $field['title'];
- $this->_columnHeaders["{$tableName}_{$fieldName}_start"]['title'] =
- $field['title'] . ' Beginning';
+ $this->_columnHeaders["{$tableName}_{$fieldName}_start"]['title'] = $field['title'] . ' Beginning';
$this->_columnHeaders["{$tableName}_{$fieldName}_start"]['type'] = $field['type'];
$this->_columnHeaders["{$tableName}_{$fieldName}_start"]['group_by'] = $this->_params['group_bys_freq'][$fieldName];
$totalAmount = $average = $softTotalAmount = $softAverage = array();
$count = $softCount = 0;
while ($dao->fetch()) {
- $totalAmount[] =
- CRM_Utils_Money::format($dao->civicrm_contribution_total_amount_sum, $dao->currency) .
+ $totalAmount[]
+ = CRM_Utils_Money::format($dao->civicrm_contribution_total_amount_sum, $dao->currency) .
" (" . $dao->civicrm_contribution_total_amount_count . ")";
$average[] = CRM_Utils_Money::format($dao->civicrm_contribution_total_amount_avg, $dao->currency);
$count += $dao->civicrm_contribution_total_amount_count;
if ($softCredit) {
- $softTotalAmount[] =
- CRM_Utils_Money::format($dao->civicrm_contribution_soft_soft_amount_sum, $dao->currency) .
+ $softTotalAmount[]
+ = CRM_Utils_Money::format($dao->civicrm_contribution_soft_soft_amount_sum, $dao->currency) .
" (" . $dao->civicrm_contribution_soft_soft_amount_count . ")";
$softAverage[] = CRM_Utils_Money::format($dao->civicrm_contribution_soft_soft_amount_avg, $dao->currency);
$softCount += $dao->civicrm_contribution_soft_soft_amount_count;
public function groupBy() {
$this->assign('chartSupported', TRUE);
- $this->_groupBy =
- "Group BY {$this->_aliases['civicrm_contribution']}.contact_id, " .
+ $this->_groupBy = "Group BY {$this->_aliases['civicrm_contribution']}.contact_id, " .
self::fiscalYearOffset($this->_aliases['civicrm_contribution'] .
'.receive_date') . " WITH ROLLUP ";
}
$sql = "{$this->_select} {$this->_from} {$this->_where} {$this->_groupBy}";
}
else {
- $sql =
+ $sql = "" .
"{$this->_select} {$this->_from} WHERE {$this->_aliases['civicrm_contact']}.id IN (" .
implode(',', $contactIds) .
") AND {$this->_aliases['civicrm_contribution']}.is_test = 0 {$this->_statusClause} {$this->_groupBy} ";
$rows[$dao->civicrm_contribution_contact_id]['civicrm_life_time_total'] = $dao->civicrm_contribution_total_amount;
if (($dao->civicrm_contribution_total_amount - $contributionSum) > 0
) {
- $rows[$dao->civicrm_contribution_contact_id]["civicrm_upto_{$upTo_year}"] =
- $dao->civicrm_contribution_total_amount - $contributionSum;
+ $rows[$dao->civicrm_contribution_contact_id]["civicrm_upto_{$upTo_year}"]
+ = $dao->civicrm_contribution_total_amount - $contributionSum;
}
$contributionSum = 0;
}
$interval["upto_{$upto}"] = "Up To {$upto}";
foreach ($rows as $key => $row) {
- $display["upto_{$upto}"] =
- CRM_Utils_Array::value("upto_{$upto}", $display) +
- CRM_Utils_Array::value("civicrm_upto_{$upto}", $row);
- $display[$previous_year] =
- CRM_Utils_Array::value($previous_year, $display) +
- CRM_Utils_Array::value($previous_year, $row);
- $display[$previous_two_year] =
- CRM_Utils_Array::value($previous_two_year, $display) +
- CRM_Utils_Array::value($previous_two_year, $row);
- $display[$previous_three_year] =
- CRM_Utils_Array::value($previous_three_year, $display) +
- CRM_Utils_Array::value($previous_three_year, $row);
+ $display["upto_{$upto}"]
+ = CRM_Utils_Array::value("upto_{$upto}", $display)
+ + CRM_Utils_Array::value("civicrm_upto_{$upto}", $row);
+ $display[$previous_year]
+ = CRM_Utils_Array::value($previous_year, $display)
+ + CRM_Utils_Array::value($previous_year, $row);
+ $display[$previous_two_year]
+ = CRM_Utils_Array::value($previous_two_year, $display)
+ + CRM_Utils_Array::value($previous_two_year, $row);
+ $display[$previous_three_year]
+ = CRM_Utils_Array::value($previous_three_year, $display)
+ + CRM_Utils_Array::value($previous_three_year, $row);
}
$graphRows['value'] = $display;
//handle the Financial Type Ids
if (array_key_exists('civicrm_pledge_financial_type_id', $row)) {
if ($value = $row['civicrm_pledge_financial_type_id']) {
- $rows[$rowNum]['civicrm_pledge_financial_type_id'] =
- CRM_Contribute_PseudoConstant::financialType($value, FALSE);
+ $rows[$rowNum]['civicrm_pledge_financial_type_id'] = CRM_Contribute_PseudoConstant::financialType($value, FALSE);
}
$entryFound = TRUE;
}
* @param int $jobID
* @param int $userID
*
- * @return $this|null|object
+ * @return self|null|object
* @throws CRM_Core_Exception
*/
public function createActivity($apiMsgID, $message, $headers = array(), $jobID = NULL, $userID = NULL) {
* @param null $to
* @param int $trackID
*
- * @return $this|null|object
+ * @return self|null|object
* @throws CRM_Core_Exception
*/
public function processInbound($from, $body, $to = NULL, $trackID = NULL) {
foreach ($keys as $key) {
$name = $key['info'];
- if ($prefix == substr($name, 0, $lp)) {
+ if ($prefix == substr($name, 0, $lp)) {
// Ours?
apc_delete($this->_prefix . $name);
}
* The heart of the callback processing is done by this method.
* forms are of different type and have different operations.
*
- * @param string formName name of the form processing this action
- * @param string formLabel label for the above form
- * @param int mode mode of operation.
- * @param bool addSequence should we add a unique sequence number to the end of the key
- * @param bool ignoreKey should we not set a qfKey for this controller (for standalone forms)
+ * @param string $formName name of the form processing this action
+ * @param string $formLabel label for the above form
+ * @param array $arguments
+ * - int mode: mode of operation.
+ * - bool addSequence: should we add a unique sequence number to the end of the key
+ * - bool ignoreKey: should we not set a qfKey for this controller (for standalone forms)
*
* @return void
*/
* Retrieve one or more addresses on address_id, contact_id, street_name, city
* or a combination of those
*
- * @param mixed[] (reference ) input parameters
- *
* @param array $params
* An associative array of name/value pairs.
*
/**
* Open a new case, add client and manager roles, and add standard timeline
*
- * @param array (
+ * @param array $params
* //REQUIRED:
* 'case_type_id' => int OR
* 'case_type' => str (provide one or the other)
*
* Please provide one (and only one) of the four get/search parameters:
*
- * @param array (
- * 'id' => if set, will get all available info about a case, including contacts and activities
- *
- * // if no case_id provided, this function will use one of the following search parameters:
- * 'client_id' => finds all cases with a specific client
- * 'activity_id' => returns the case containing a specific activity
- * 'contact_id' => finds all cases associated with a contact (in any role, not just client)
+ * @param array $params
+ * 'id' => if set, will get all available info about a case, including contacts and activities
*
+ * // if no case_id provided, this function will use one of the following search parameters:
+ * 'client_id' => finds all cases with a specific client
+ * 'activity_id' => returns the case containing a specific activity
+ * 'contact_id' => finds all cases associated with a contact (in any role, not just client)
*
* @throws API_Exception
* @return array
/**
* Update a specified case.
*
- * @param array (
- * //REQUIRED:
- * 'case_id' => int
+ * @param array $params
+ * //REQUIRED:
+ * 'case_id' => int
*
- * //OPTIONAL
- * 'status_id' => int
- * 'start_date' => str datestamp
- * 'contact_id' => int // case client
+ * //OPTIONAL
+ * 'status_id' => int
+ * 'start_date' => str datestamp
+ * 'contact_id' => int // case client
*
* @throws API_Exception
* @return array
/**
* Delete a specified case.
*
- * @param array (
- * //REQUIRED:
- * 'id' => int
+ * @param array $params
+ * //REQUIRED:
+ * 'id' => int
*
- * //OPTIONAL
- * 'move_to_trash' => bool (defaults to false)
+ * //OPTIONAL
+ * 'move_to_trash' => bool (defaults to false)
*
* @throws API_Exception
* @return bool
/**
* Retrieve one or more emails
*
- * @param array input parameters
- *
- *
- * @example EmailGet.php Standard Get Example
- *
* @param array $params
* An associative array of name/value pairs.
*
* @example ExtensionDownload.php
*/
function civicrm_api3_extension_download($params) {
- if (! array_key_exists('key', $params)) {
+ if (!array_key_exists('key', $params)) {
throw new API_Exception('Missing required parameter: key');
}
- if (! array_key_exists('url', $params)) {
- if (! CRM_Extension_System::singleton()->getBrowser()->isEnabled()) {
+ if (!array_key_exists('url', $params)) {
+ if (!CRM_Extension_System::singleton()->getBrowser()->isEnabled()) {
throw new API_Exception('Automatic downloading is diabled. Try adding parameter "url"');
}
if ($reqs = CRM_Extension_System::singleton()->getBrowser()->checkRequirements()) {
}
}
- if (! array_key_exists('url', $params)) {
+ if (!array_key_exists('url', $params)) {
throw new API_Exception('Cannot resolve download url for extension. Try adding parameter "url"');
}
return civicrm_api3_create_error($requirement['message']);
}
- if (! CRM_Extension_System::singleton()->getDownloader()->download($params['key'], $params['url'])) {
+ if (!CRM_Extension_System::singleton()->getDownloader()->download($params['key'], $params['url'])) {
return civicrm_api3_create_error('Download failed - ZIP file is unavailable or malformed');
}
CRM_Extension_System::singleton()->getCache()->flush();
$fields = civicrm_api($entity, 'getFields', array('version' => 3, 'action' => 'create', "sequential"));
// getfields error, shouldn't happen.
- if ($fields['is_error'])
- return $fields;
+ if ($fields['is_error']) {
+ return $fields;
+ }
$fields = $fields['values'];
$isCustom = strpos($field, 'custom_') === 0;
case CRM_Utils_Type::T_DATE:
$value = CRM_Utils_Type::escape($value, "Date", FALSE);
- if (!$value)
+ if (!$value) {
return civicrm_api3_create_error("Param '$field' is not a date. format YYYYMMDD or YYYYMMDDHHMMSS");
+ }
break;
case CRM_Utils_Type::T_BOOLEAN: