* @param $groupIDs
* Of group that we are checking against.
*
- * @return boolean
+ * @return bool
* TRUE if we did not regenerate, FALSE if we did
*/
public static function check($groupIDs) {
* Check to see if we have cache entries for this group
* if not, regenerate, else return
*
- * @param int /array $groupID groupID of group that we are checking against
+ * @param int /array $groupIDs groupIDs of group that we are checking against
* if empty, all groups are checked
* @param int $limit
* Limits the number of groups we evaluate.
*
- * @return boolean
+ * @return bool
* TRUE if we did not regenerate, FALSE if we did
*/
public static function loadAll($groupIDs = NULL, $limit = 0) {
CRM_Contact_BAO_ProximityQuery::fixInputParams($ssParams);
}
-
$returnProperties = array();
if (CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_SavedSearch', $savedSearchID, 'mapping_id')) {
$fv = CRM_Contact_BAO_SavedSearch::getFormValues($savedSearchID);
// we split it up and store custom class
// so temp tables are not destroyed if they are used
// hence customClass is defined above at top of function
- $customClass =
- CRM_Contact_BAO_SearchCustom::customClass($ssParams['customSearchID'], $savedSearchID);
+ $customClass = CRM_Contact_BAO_SearchCustom::customClass($ssParams['customSearchID'], $savedSearchID);
$searchSQL = $customClass->contactIDs();
$searchSQL = str_replace('ORDER BY contact_a.id ASC', '', $searchSQL);
$idName = 'contact_id';
else {
$formValues = CRM_Contact_BAO_SavedSearch::getFormValues($savedSearchID);
- $query =
- new CRM_Contact_BAO_Query(
+ $query
+ = new CRM_Contact_BAO_Query(
$ssParams, $returnProperties, NULL,
FALSE, FALSE, 1,
TRUE, TRUE,
);
$query->_useDistinct = FALSE;
$query->_useGroupBy = FALSE;
- $searchSQL =
- $query->searchQuery(
+ $searchSQL
+ = $query->searchQuery(
0, 0, NULL,
FALSE, FALSE,
FALSE, TRUE,
*/
public static function contactGroup($contactID, $showHidden = FALSE) {
if (empty($contactID)) {
- return;
+ return NULL;
}
if (is_array($contactID)) {
}
$prevContactID = $dao->contact_id;
if (!array_key_exists($dao->contact_id, $contactGroup)) {
- $contactGroup[$dao->contact_id] =
- array('group' => array(), 'groupTitle' => array());
+ $contactGroup[$dao->contact_id]
+ = array('group' => array(), 'groupTitle' => array());
}
- $contactGroup[$dao->contact_id]['group'][] =
- array(
+ $contactGroup[$dao->contact_id]['group'][]
+ = array(
'id' => $dao->group_id,
'title' => $dao->title,
'description' => $dao->description,
*/
public static function format(&$params, &$contact) {
if (!self::dataExists($params)) {
- return;
+ return NULL;
}
// "null" value for example is passed by dedupe merge in order to empty.
if ($date = CRM_Utils_Array::value('birth_date', $params)) {
if (in_array($format, array(
'dd-mm',
- 'mm/dd'
+ 'mm/dd',
))) {
$separator = '/';
if ($format == 'dd-mm') {
$date = $date . $separator . '1902';
}
elseif (in_array($format, array(
- 'yy-mm'
+ 'yy-mm',
))) {
$date = $date . '-01';
}
elseif (in_array($format, array(
- 'M yy'
+ 'M yy',
))) {
$date = $date . '-01';
}
elseif (in_array($format, array(
- 'yy'
+ 'yy',
))) {
$date = $date . '-01-01';
}
if ($date = CRM_Utils_Array::value('deceased_date', $params)) {
if (in_array($format, array(
'dd-mm',
- 'mm/dd'
+ 'mm/dd',
))) {
$separator = '/';
if ($format == 'dd-mm') {
$date = $date . $separator . '1902';
}
elseif (in_array($format, array(
- 'yy-mm'
+ 'yy-mm',
))) {
$date = $date . '-01';
}
elseif (in_array($format, array(
- 'M yy'
+ 'M yy',
))) {
$date = $date . '-01';
}
elseif (in_array($format, array(
- 'yy'
+ 'yy',
))) {
$date = $date . '-01-01';
}
* @param array $params
* (reference ) an assoc array of name/value pairs.
*
- * @return boolean
+ * @return bool
*/
public static function dataExists(&$params) {
if ($params['contact_type'] == 'Individual') {
*
* @return array
*/
- static function getEvents(
+ public static function getEvents(
$all = 0,
$id = FALSE,
$isActive = TRUE,
* Get participant count
*
* @param int $eventId
- * @param bool $considerStatusConsider status for participant count.
+ * @param bool $considerStatus consider status for participant count.
* Consider status for participant count.
- * @param bool $statusConsider counted participant.
+ * @param bool $status counted participant.
* Consider counted participant.
- * @param bool $considerRoleConsider role for participant count.
+ * @param bool $considerRole consider role for participant count.
* Consider role for participant count.
- * @param bool $roleConsider counted( is filter role) participant.
+ * @param bool $role consider counted( is filter role) participant.
* Consider counted( is filter role) participant.
*
*
*
* @param date $start
* Get events with start date >= this date.
- * @param int $typeGet events on the a specific event type (by event_type_id).
+ * @param int $type Get events on the a specific event type (by event_type_id).
* Get events on the a specific event type (by event_type_id).
- * @param int $eventIdReturn a single event - by event id.
+ * @param int $eventId Return a single event - by event id.
* Return a single event - by event id.
* @param date $end
* Also get events with end date >= this date.
- * @param bool $onlyPublicInclude public events only, default TRUE.
+ * @param bool $onlyPublic Include public events only, default TRUE.
* Include public events only, default TRUE.
*
* @return array
* array of all the events that are searched
*/
- static function &getCompleteInfo(
+ public static function &getCompleteInfo(
$start = NULL,
$type = NULL,
$eventId = NULL,
array('id' => $id),
array(
'loc_block_id' =>
- ($locBlockId) ? $locBlockId : NULL,
+ ($locBlockId) ? $locBlockId : NULL,
),
$fieldsFix
);
*
* @return void
*/
- static function buildCustomDisplay(
+ public static function buildCustomDisplay(
$id,
$name,
$cid,
* @return array
* array of Additional participant's info OR array of Ids.
*/
- static function buildCustomProfile(
+ public static function buildCustomProfile(
$participantId,
$values,
$contactId = NULL,
*
* @param array $values
* @param int $eventID
- * @return boolean
+ * @return bool
*/
public static function validRegistrationRequest($values, $eventID) {
// check that the user has permission to register for this event
// Fixme - this is going to ignore context, better to get conditions, add params, and call PseudoConstant::get
return CRM_Financial_BAO_FinancialType::getIncomeFinancialType();
- break;
+ break;
}
return CRM_Core_PseudoConstant::get(__CLASS__, $fieldName, $params, $context);
}
$message .= '<br/>' . ts('%3. There are some contacts who have this membership type assigned to them. Search for contacts with this membership type from <a href=\'%1\'>Find Members</a>. If you are still getting this message after deleting these memberships, there may be contacts in the Trash (deleted) with this membership type. Try using <a href="%2">Advanced Search</a> and checking "Search in Trash".', array(
1 => $findMembersURL,
2 => $deleteURL,
- 3 => $cnt
+ 3 => $cnt,
));
$cnt++;
}
$deleteURL = CRM_Utils_System::url('civicrm/admin/contribute', 'reset=1');
$message .= ts('%2. This Membership Type is used in an <a href=\'%1\'>Online Contribution page</a>. Uncheck this membership type in the Memberships tab.', array(
1 => $deleteURL,
- 2 => $cnt
+ 2 => $cnt,
));
throw new CRM_Core_Exception($message);
}
foreach (array(
'joinDate',
'startDate',
- 'endDate'
+ 'endDate',
) as $dateParam) {
if (!empty($$dateParam)) {
$$dateParam = CRM_Utils_Date::processDate($$dateParam, NULL, FALSE, 'Y-m-d');
*
* CRM-7297 Membership Upsell - Added $membershipTypeID param to facilitate calculations of dates when membership type changes
*
- * @return Array
+ * @return array
* array fo the start date, end date and join date of the membership
*/
public static function getRenewalDatesForMembershipType($membershipId, $changeToday = NULL, $membershipTypeID = NULL, $numRenewTerms = 1) {
* @param int $orgID
* Id of Organization.
*
- * @return Array
+ * @return array
* array of the details of membership types
*/
public static function getMembershipTypesByOrg($orgID) {
/**
* Retrieve all Membership Types with Member of Contact id
*
- * @param array membership types
- *
- * @return Array
+ * @param array $membershipTypes
+ * array of membership type ids
+ * @return array
* array of the details of membership types with Member of Contact id
*/
public static function getMemberOfContactByMemTypes($membershipTypes) {
}
}
- /** This function updates all price field value for quick config
+ /** * This function updates all price field value for quick config
* price set which has membership type
*
- * @param integer membership type id
+ * @param int $membershipTypeId membership type id
*
- * @param integer financial type id
+ * @param array $params
*/
public static function updateAllPriceFieldValue($membershipTypeId, $params) {
if (!empty($params['minimum_fee'])) {
'type' => CRM_Utils_Type::T_MONEY,
'default' => TRUE,
'required' => TRUE,
- 'clause' => '
-contribution_civireport1.total_amount_count as contribution1_total_amount_count,
-contribution_civireport1.total_amount_sum as contribution1_total_amount_sum',
+ 'clause' => 'contribution_civireport1.total_amount_count as contribution1_total_amount_count, contribution_civireport1.total_amount_sum as contribution1_total_amount_sum',
),
'total_amount2' => array(
'name' => 'total_amount',
'type' => CRM_Utils_Type::T_MONEY,
'default' => TRUE,
'required' => TRUE,
- 'clause' => '
-contribution_civireport2.total_amount_count as contribution2_total_amount_count,
-contribution_civireport2.total_amount_sum as contribution2_total_amount_sum',
+ 'clause' => 'contribution_civireport2.total_amount_count as contribution2_total_amount_count, contribution_civireport2.total_amount_sum as contribution2_total_amount_sum',
),
),
'grouping' => 'contri-fields',
public function where() {
if (!$this->_amountClauseWithAND) {
- $this->_amountClauseWithAND =
- "!({$this->_aliases['civicrm_contribution']}1.total_amount_count IS NULL AND {$this->_aliases['civicrm_contribution']}2.total_amount_count IS NULL)";
+ $this->_amountClauseWithAND
+ = "!({$this->_aliases['civicrm_contribution']}1.total_amount_count IS NULL AND {$this->_aliases['civicrm_contribution']}2.total_amount_count IS NULL)";
}
$clauses = array("atleast_one_amount" => $this->_amountClauseWithAND);
//store contributions in array 'contact_sums' for comparison
$contact_sums = array();
while ($dao->fetch()) {
- $contact_sums[$dao->contact_id] =
- array(
+ $contact_sums[$dao->contact_id]
+ = array(
'contribution1_total_amount_sum' => $dao->contribution1_total_amount_sum,
'contribution2_total_amount_sum' => $dao->contribution2_total_amount_sum,
);
$count = $count2 = 0;
while ($dao->fetch()) {
if ($dao->amount) {
- $amount[] =
- CRM_Utils_Money::format($dao->amount, $dao->currency) . "(" .
+ $amount[]
+ = CRM_Utils_Money::format($dao->amount, $dao->currency) . "(" .
$dao->count . ")";
$average[] = CRM_Utils_Money::format($dao->avg, $dao->currency);
}
$count += $dao->count;
if ($dao->amount2) {
- $amount2[] =
- CRM_Utils_Money::format($dao->amount2, $dao->currency) . "(" .
+ $amount2[]
+ = CRM_Utils_Money::format($dao->amount2, $dao->currency) . "(" .
$dao->count . ")";
$average2[] = CRM_Utils_Money::format($dao->avg2, $dao->currency);
}
$rows[$uid]['change'] = ts('New Donor');
}
if ($row['contribution1_total_amount_count']) {
- $rows[$uid]['contribution1_total_amount_sum'] =
- $row['contribution1_total_amount_sum'] .
+ $rows[$uid]['contribution1_total_amount_sum']
+ = $row['contribution1_total_amount_sum'] .
" ({$row['contribution1_total_amount_count']})";
}
if ($row['contribution2_total_amount_count']) {
- $rows[$uid]['contribution2_total_amount_sum'] =
- $row['contribution2_total_amount_sum'] .
+ $rows[$uid]['contribution2_total_amount_sum']
+ = $row['contribution2_total_amount_sum'] .
" ({$row['contribution2_total_amount_count']})";
}
}
* @return array
* Information about operation results
*
- * On success, the return array will be structured as follows:
- * <code>array(
+ * On success, the return array will be structured as follows:
+ * <code>array(
* "is_error" => 0,
* "version" => 3,
* "count" => 3,
* "added" => integer,
* "total_count" => integer
* )
- * )</code>
+ * )</code>
*
- * On failure, the return array will be structured as follows:
- * <code>array(
+ * On failure, the return array will be structured as follows:
+ * <code>array(
* 'is_error' => 1,
* 'error_message' = string,
* 'error_data' = mixed or undefined
- * )</code>
- * {@getfields GroupContact_create}
+ * )</code>
+ * {@getfields GroupContact_create}
*/
function civicrm_api3_group_contact_create($params) {
// Nonstandard bao - doesn't accept ID as a param, so convert id to group_id + contact_id
* @param array $params
* @param string $op
*
- * @return Array
+ * @return array
* @todo behaviour is highly non-standard - need to figure out how to make this 'behave'
* & at the very least return IDs & details of the groups created / changed
*/
$extraReturnValues['not_removed'] += $nr;
}
}
- $dao = null;// can't pass this by reference
- return civicrm_api3_create_success(1,$params,'group_contact','create',$dao,$extraReturnValues);
+ $dao = NULL;// can't pass this by reference
+ return civicrm_api3_create_success(1, $params, 'group_contact', 'create', $dao, $extraReturnValues);
}
/**
* In addition, there are several additional classes that inherit
* civicrm_cli to do more precise functions.
*
- **/
+ */
/**
* base class for doing all command line operations via civicrm
* used by cli.php
- **/
+ */
class civicrm_cli {
// required values that must be passed
// via the command line
/**
* class used by csv/export.php to export records from
* the database in a csv file format.
- **/
+ */
class civicrm_cli_csv_exporter extends civicrm_cli {
var $separator = ',';
/**
*/
- function __construct() {
+ public function __construct() {
$this->_required_arguments = array('entity');
parent::initialize();
}
- function run() {
+ public function run() {
$out = fopen("php://output", 'w');
fputcsv($out, $this->columns, $this->separator, '"');
* and civicrm_cli_csv_deleter to add or delete
* records based on those found in a csv file
* passed to the script.
- **/
+ */
class civicrm_cli_csv_file extends civicrm_cli {
var $header;
var $separator = ',';
/**
*/
- function __construct() {
+ public function __construct() {
$this->_required_arguments = array('entity', 'file');
$this->_additional_arguments = array('f' => 'file');
parent::initialize();
}
- function run() {
+ public function run() {
$this->row = 1;
$handle = fopen($this->_file, "r");
$this->processLine($params);
}
fclose($handle);
- return;
+ return NULL;
}
/* return a params as expected */
*
* @return array
*/
- function convertLine($data) {
+ public function convertLine($data) {
$params = array();
foreach ($this->header as $i => $field) {
//split any multiselect data, denoted with CRM_Core_DAO::VALUE_SEPARATOR
* class for processing records to add
* used by csv/import.php
*
- **/
+ */
class civicrm_cli_csv_importer extends civicrm_cli_csv_file {
/**
* @param array $params
*/
- function processline($params) {
+ public function processline($params) {
$result = civicrm_api($this->_entity, 'Create', $params);
if ($result['is_error']) {
echo "\nERROR line " . $this->row . ": " . $result['error_message'] . "\n";
* class for processing records to delete
* used by csv/delete.php
*
- **/
+ */
class civicrm_cli_csv_deleter extends civicrm_cli_csv_file {
/**
* @param array $params
*/
- function processline($params) {
+ public function processline($params) {
$result = civicrm_api($this->_entity, 'Delete', $params);
if ($result['is_error']) {
echo "\nERROR line " . $this->row . ": " . $result['error_message'] . "\n";
array(
"log_type" => "Relationship",
"altered_contact" => "{$firstName} {$lastName} [Employee of]",
- "action" => "Update"
+ "action" => "Update",
),
array(
"log_type" => "Relationship",
"altered_contact" => "{$firstName} {$lastName} [Employee of]",
- "action" => "Insert"
+ "action" => "Insert",
),
array(
"log_type" => "Relationship",
"altered_contact" => "{$firstName} {$lastName} [Employee of]",
- "action" => "Delete"
+ "action" => "Delete",
),
//group data check
array(
"log_type" => "Group",
"altered_contact" => "{$firstName} {$lastName} [Case Resources]",
- "action" => "Added"
+ "action" => "Added",
),
array(
"log_type" => "Group",
"altered_contact" => "{$firstName} {$lastName} [Case Resources]",
- "action" => "Removed"
+ "action" => "Removed",
),
//note data check
array("log_type" => "Note", "altered_contact" => "{$firstName} {$lastName}", "action" => "Update"),
array(
"log_type" => "Tag",
"altered_contact" => "{$firstName} {$lastName} [Government Entity]",
- "action" => "Insert"
+ "action" => "Insert",
),
array("log_type" => "Tag", "altered_contact" => "{$firstName} {$lastName} [Company]", "action" => "Delete"),
//case data check
array(
"log_type" => "Case",
"altered_contact" => "{$firstName} {$lastName} [Housing Support]",
- "action" => "Update"
+ "action" => "Update",
),
array(
"log_type" => "Case",
"altered_contact" => "{$firstName} {$lastName} [Housing Support]",
- "action" => "Insert"
+ "action" => "Insert",
),
//case activity check
array(
"log_type" => "Activity",
"altered_contact" => "{$firstName} {$lastName} [Interview]",
- "action" => "Update"
+ "action" => "Update",
),
array(
"log_type" => "Activity",
"altered_contact" => "{$firstName} {$lastName} [Interview]",
- "action" => "Insert"
+ "action" => "Insert",
),
);
$this->verifyReportData($data);
array(
'field' => 'Sort Name',
'changed_from' => "{$lastName}, {$originalFirstName}",
- 'changed_to' => "{$lastName}, {$firstName}"
+ 'changed_to' => "{$lastName}, {$firstName}",
),
array(
'field' => 'Display Name',
'changed_from' => "{$originalFirstName} {$lastName}",
- 'changed_to' => "{$firstName} {$lastName}"
+ 'changed_to' => "{$firstName} {$lastName}",
),
array('field' => 'First Name', 'changed_from' => $originalFirstName, 'changed_to' => $firstName),
// array('field' => 'Email Greeting', 'changed_from' => "Dear {$originalFirstName}", 'changed_to' => "Dear {$firstName}"),
array(
"log_type" => "Contact",
"altered_contact" => "{$firstName} {$lastName}",
- "action" => "Delete (to trash)"
- )
+ "action" => "Delete (to trash)",
+ ),
);
$this->verifyReportData($contactDataDelete);
$contactIDs['a'] = $this->individualCreate(array(
'email' => 'include.me@example.org',
'first_name' => 'Includer',
- 'last_name' => 'Person'
+ 'last_name' => 'Person',
));
$contactIDs['b'] = $this->individualCreate(array(
'email' => 'exclude.me@example.org',
- 'last_name' => 'Excluder'
+ 'last_name' => 'Excluder',
));
$this->callAPISuccess('GroupContact', 'create', array(
'group_id' => $groupIDs['a'],
- 'contact_id' => $contactIDs['a']
+ 'contact_id' => $contactIDs['a'],
));
$this->callAPISuccess('GroupContact', 'create', array(
'group_id' => $groupIDs['b'],
- 'contact_id' => $contactIDs['b']
+ 'contact_id' => $contactIDs['b'],
));
// END SAMPLE DATA
$contactIDs['include_me'] = $this->individualCreate(array(
'email' => 'include.me@example.org',
'first_name' => 'Includer',
- 'last_name' => 'Person'
+ 'last_name' => 'Person',
));
$contactIDs['exclude_me'] = $this->individualCreate(array(
'email' => 'exclude.me@example.org',
));
$this->callAPISuccess('GroupContact', 'create', array(
'group_id' => $groupIDs['inc'],
- 'contact_id' => $contactIDs['include_me']
+ 'contact_id' => $contactIDs['include_me'],
));
$this->callAPISuccess('GroupContact', 'create', array(
'group_id' => $groupIDs['inc'],
- 'contact_id' => $contactIDs['exclude_me']
+ 'contact_id' => $contactIDs['exclude_me'],
));
$this->callAPISuccess('GroupContact', 'create', array(
'group_id' => $groupIDs['exc'],
- 'contact_id' => $contactIDs['exclude_me']
+ 'contact_id' => $contactIDs['exclude_me'],
));
$params = $this->_params;
$contactIDs['alice'] = $this->individualCreate(array(
'email' => 'alice@example.org',
'first_name' => 'Alice',
- 'last_name' => 'Person'
+ 'last_name' => 'Person',
));
$mail = $this->callAPISuccess('mailing', 'create', $this->_params);
$contactIDs['alice'] = $this->individualCreate(array(
'email' => 'alice@example.org',
'first_name' => 'Alice',
- 'last_name' => 'Person'
+ 'last_name' => 'Person',
));
$contactIDs['bob'] = $this->individualCreate(array(
'email' => 'bob@example.org',
'first_name' => 'Bob',
- 'last_name' => 'Person'
+ 'last_name' => 'Person',
));
$contactIDs['carol'] = $this->individualCreate(array(
'email' => 'carol@example.org',
'first_name' => 'Carol',
- 'last_name' => 'Person'
+ 'last_name' => 'Person',
));
$this->callAPISuccess('GroupContact', 'create', array(
'group_id' => $groupIDs['inc'],
- 'contact_id' => $contactIDs['alice']
+ 'contact_id' => $contactIDs['alice'],
));
$this->callAPISuccess('GroupContact', 'create', array(
'group_id' => $groupIDs['inc'],
- 'contact_id' => $contactIDs['bob']
+ 'contact_id' => $contactIDs['bob'],
));
$this->callAPISuccess('GroupContact', 'create', array(
'group_id' => $groupIDs['inc'],
- 'contact_id' => $contactIDs['carol']
+ 'contact_id' => $contactIDs['carol'],
));
// END SAMPLE DATA