static $_importableFields = NULL;
/**
- * Check if there is absolute minimum of data to add the object
+ * Check if there is absolute minimum of data to add the object.
*
* @param array $params
* (reference ) an assoc array of name/value pairs.
* @param int $toID
* The contact id of the recipient.
* @param $tokenText
- * @param $tokenHtml
* @param array $smsParams
* The params used for sending sms.
* @param int $activityID
}
/**
- * Combine all the importable fields from the lower levels object
+ * Combine all the importable fields from the lower levels object.
*
* The ordering is important, since currently we do not have a weight
* scheme. Adding weight is super important and should be done in the
}
/**
- * Get all prior activities of currently viewed activity
+ * Get all prior activities of currently viewed activity.
*
* @param $activityID
* Current activity id.
}
/**
- * Find the latest revision of a given activity
+ * Find the latest revision of a given activity.
*
* @param int $activityID
* Prior activity id.
}
/**
- * Create a follow up a given activity
+ * Create a follow up a given activity.
*
* @param int $activityId
* activity id of parent activity.
}
/**
- * Get the exportable fields for Activities
+ * Get the exportable fields for Activities.
*
* @param string $name
* If it is called by case $name = Case else $name = Activity.
}
/**
- * wrapper for ajax activity selector
+ * Wrapper for ajax activity selector.
*
* @param array $params
* Associated array for params record id.
*
* @return array
- * associated array of contact activities
+ * Associated array of contact activities
*/
public static function getContactActivitySelector(&$params) {
// format the params
/**
* This class generates form components generic to CiviCRM settings
- *
*/
class CRM_Admin_Form_Setting extends CRM_Core_Form {
/**
* Build the form object
- *
- * @return void
*/
public function buildQuickForm() {
$session = CRM_Core_Session::singleton();
protected $_searchVoterFor;
/**
- * Processing needed for buildForm and later
- *
- * @return void
+ * Processing needed for buildForm and later.
*/
- function preProcess() {
+ public function preProcess() {
$this->_search = CRM_Utils_Array::value('search', $_GET);
$this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE);
$this->_surveyId = CRM_Utils_Request::retrieve('sid', 'Positive', $this);
$returnProperties = self::makeHierReturnProperties($fields, $contactId);
- // we dont know the contents of return properties, but we need the lower level ids of the contact
- // so add a few fields
+ // 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'] =
}
/**
- * Given a set of flat profile style field names, create a hierarchy
- * for query to use and crete the right sql
+ * Given a set of flat profile style field names, create a hierarchy.
+ *
+ * This is for the query to use, create the right sql.
*
* @param $fields
* @param int $contactId
* Contact id.
*
* @return array
- * a hierarchical property tree if appropriate
+ * A hierarchical property tree if appropriate
*/
public static function &makeHierReturnProperties($fields, $contactId = NULL) {
$locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id');
}
/**
- * Given the component name and returns
- * the count of participation of contact
+ * Given the component name and returns the count of participation of contact.
*
* @param string $component
* Input component name.
* Contact object after save.
* @param bool $useDefaults
* Use default greeting values.
- *
- * @return void
*/
public static function processGreetings(&$contact, $useDefaults = FALSE) {
if ($useDefaults) {
}
/**
- * Get a list of triggers for the contact table
+ * Get a list of triggers for the contact table.
*
* @see hook_civicrm_triggerInfo
* @see CRM_Core_DAO::triggerRebuild
}
/**
- * Check if contact is being used in civicrm_domain
- * based on $contactId
+ * Check if contact is being used in civicrm_domain based on $contactId.
*
* @param int $contactId
* Contact id.
* true if present else false.
*/
public static function checkDomainContact($contactId) {
- if (!$contactId)
+ if (!$contactId) {
return FALSE;
+ }
$domainId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Domain', $contactId, 'id', 'contact_id');
if ($domainId) {
/**
* Get options for a given contact field.
+ *
* @see CRM_Core_DAO::buildOptions
*
* TODO: Should we always assume chainselect? What fn should be responsible for controlling that flow?
}
/**
- * Delete a contact-related object that has an 'is_primary' field
+ * Delete a contact-related object that has an 'is_primary' field.
+ *
* Ensures that is_primary gets assigned to another object if available
* Also calls pre/post hooks
*
- * @var $type : object type
- * @var $id : object id
+ * @var object $type
+ * @var int $id
* @return bool
*/
public static function deleteObjectWithPrimary($type, $id) {
* It delegates the work to lower level subclasses and integrates the changes
* back in. It also uses a lot of functionality with the CRM API's, so any change
* made here could potentially affect the API etc. Be careful, be aware, use unit tests.
- *
*/
class CRM_Contact_Form_RelatedContact extends CRM_Core_Form {
foreach (array(
'phone',
'email',
- 'address'
+ 'address',
) as $locFld) {
if (!empty($this->_defaults[$locFld]) && $this->_defaults[$locFld][1]['location_type_id']) {
$params[$locFld][1]['is_primary'] = $this->_defaults[$locFld][1]['is_primary'];
}
}
-
if (CRM_Utils_Array::value('radio_ts', self::$_searchFormValues) == 'ts_sel'
&& ($form->_action != CRM_Core_Action::COPY)
) {
*
* @return \CRM_Contact_Selector_Custom
*/
- function __construct(
+ public function __construct(
$customSearchClass,
$formValues = NULL,
$params = NULL,
/**
* This method returns the links that are given for each search row.
- * currently the links added for each row are
*
+ * Currently the links added for each row are
* - View
* - Edit
*
}
/**
- * Returns the column headers as an array of tuples:
- * (name, sortName (key to the sort array))
+ * Returns the column headers as an array of tuples.
+ *
+ * Keys are name, sortName, key to the sort array.
*
* @param string $action
* The action being performed.
* Constructor.
*
* @param null $path
+ * The class Path of the form being implemented
* @param bool $title
- * @param string path the class Path of the form being implemented
+ * @param string $mode
* @param bool $imageUpload
* @param bool $addSequence
* Should we add a unique sequence number to the end of the key.
* Should we not set a qfKey for this controller (for standalone forms).
* @param bool $attachUpload
*
- *
* @return \CRM_Core_Controller_Simple
*/
function __construct(
}
/**
+ * Set parent.
+ *
* @param $parent
*/
public function setParent($parent) {
class CRM_Dedupe_BAO_QueryBuilder_IndividualSupervised extends CRM_Dedupe_BAO_QueryBuilder {
/**
- * Record - what do I do?
+ * Record - what do I do.
*
* @param object $rg
*
}
/**
- * This virtual function is used to set the default values of
- * various form elements
+ * Set the default values of various form elements
*
- * access public
- *
- * @return array
- * reference to the array of default values
- */
- /**
* @return array
*/
public function setDefaultValues() {
$dao = new CRM_SMS_DAO_Provider();
$dao->id = $this->_id;
- if ($name)
+ if ($name) {
$dao->name = $name;
+ }
if (!$dao->find(TRUE)) {
return $defaults;
}
/**
- * Test case for resolveDefaults( )
- * test all pseudoConstant, stateProvince, country.
+ * Test case for resolveDefaults( ).
+ *
+ * Test all pseudoConstant, stateProvince, country.
*/
public function testResolveDefaults() {
$params = array(
'is_override' => 'NULL',
);
- $this->fixtures['phonecall'] = array(// createTestObject
+ $this->fixtures['phonecall'] = array(
'status_id' => 1,
'activity_type_id' => 2,
'activity_date_time' => '20120615100000',
'is_current_revision' => 1,
'is_deleted' => 0,
);
- $this->fixtures['contact'] = array(// API
+ $this->fixtures['contact'] = array(
'is_deceased' => 0,
'contact_type' => 'Individual',
'email' => 'test-member@example.com',
);
- $this->fixtures['contact_birthdate'] = array(// API
+ $this->fixtures['contact_birthdate'] = array(
'is_deceased' => 0,
'contact_type' => 'Individual',
'email' => 'test-bday@example.com',
'birth_date' => '20050707',
);
- $this->fixtures['sched_activity_1day'] = array(// create()
+ $this->fixtures['sched_activity_1day'] = array(
'name' => 'One_Day_Phone_Call_Notice',
'title' => 'One Day Phone Call Notice',
'limit_to' => '1',
*/
private static function getInstance() {
if (is_null(self::$instance)) {
- self::$instance = new self;
+ self::$instance = new self();
}
return self::$instance;
}
/**
- * Build test suite dynamically
+ * Build test suite dynamically.
*/
public static function suite() {
$inst = self::getInstance();
return $inst->implSuite(__FILE__);
}
}
-// class CRM_Core_AllTests
-
// -- set Emacs parameters --
// Local variables:
// mode: php;
class CRM_Utils_QueryFormatterTest extends CiviUnitTestCase {
public function dataProvider() {
- $cases = array(); // array(0=>$inputText, 1=>$language, 2=>$options, 3=>$expectedText)
+ // Array(0=>$inputText, 1=>$language, 2=>$options, 3=>$expectedText).
+ $cases = array();
$cases[] = array(
'first second',
'first second',
CRM_Utils_QueryFormatter::LANG_SOLR,
CRM_Utils_QueryFormatter::MODE_WILDWORDS,
- '*first* *second*'
+ '*first* *second*',
);
$cases[] = array(
'first second',
CRM_Utils_QueryFormatter::LANG_SOLR,
CRM_Utils_QueryFormatter::MODE_WILDWORDS_SUFFIX,
- 'first* second*'
+ 'first* second*',
);
// if user supplies wildcards, then ignore mode
CRM_Utils_QueryFormatter::MODE_NONE,
CRM_Utils_QueryFormatter::MODE_WILDPHRASE,
CRM_Utils_QueryFormatter::MODE_WILDWORDS,
- CRM_Utils_QueryFormatter::MODE_WILDWORDS_SUFFIX
+ CRM_Utils_QueryFormatter::MODE_WILDWORDS_SUFFIX,
) as $mode) {
$cases[] = array('first% second', CRM_Utils_QueryFormatter::LANG_SQL_LIKE, $mode, 'first% second');
$cases[] = array('first% second', CRM_Utils_QueryFormatter::LANG_SQL_FTS, $mode, 'first* second');
}
/**
- * @param $profilefield
+ * Test profile creation.
+ *
+*@param $profileField
* @param int $location
* @param $type
*
* @return null
*/
- public function _testCreateProfile($profilefield, $location = 0, $type) {
- $locationfields = array(
+ public function _testCreateProfile($profileField, $location = 0, $type) {
+ $locationFields = array(
'supplemental_address_1',
'supplemental_address_2',
'city',
);
// Add new profile.
- $profilename = "Profile_" . substr(sha1(rand()), 0, 7);
+ $profileName = "Profile_" . substr(sha1(rand()), 0, 7);
$this->openCiviPage("admin/uf/group", "reset=1");
$this->click('newCiviCRMProfile-top');
$this->waitForElementPresent('_qf_Group_next-top');
//Name of profile
- $this->type('title', $profilename);
+ $this->type('title', $profileName);
$this->click('uf_group_type_Profile');
$this->click('_qf_Group_next-top');
$this->waitForPageToLoad($this->getTimeoutMsec());
$profileId = $this->urlArg('gid');
//Add field to profile_testCreateProfile
- foreach ($profilefield as $key => $value) {
+ foreach ($profileField as $key => $value) {
$this->openCiviPage("admin/uf/group/field/add", "reset=1&action=add&gid=$profileId");
- if (in_array($value, $locationfields)) {
+ if (in_array($value, $locationFields)) {
$this->select("field_name[0]", "value={$type}");
$this->select("field_name[1]", "value={$value}");
$this->select("field_name[2]", "value={$location}");
);
/* they are two types of missing APIs:
- - Those that are to be implemented
- (in some future version when someone steps in -hint hint-). List the entities in toBeImplemented[ {$action} ]
+ - Those that are to be implemented
+ (in some future version when someone steps in -hint hint-). List the entities in toBeImplemented[ {$action} ]
Those that don't exist
and that will never exist (eg an obsoleted Entity
they need to be returned by the function toBeSkipped_{$action} (because it has to be a static method and therefore couldn't access a this->toBeSkipped)
'Extension',
'ReportTemplate',
'System',
- 'Setting'
+ 'Setting',
);
$this->toBeImplemented['create'] = array(
'SurveyRespondant',
'CustomSearch',
'Extension',
'ReportTemplate',
- 'System'
+ 'System',
);
$this->toBeImplemented['delete'] = array(
'MembershipPayment',
'UFMatch',
'Extension',
'LocationType',
- 'System'
+ 'System',
);
$this->onlyIDNonZeroCount['get'] = array('ActivityType', 'Entity', 'Domain', 'Setting');
$this->deprecatedAPI = array('Location', 'ActivityType', 'SurveyRespondant');
}
/**
- * @param null $skip
+ * Generate list of all entities.
+ *
+ * @param array $skip
+ * Entities to skip.
*
* @return array
*/
- public static function entities($skip = NULL) {
+ public static function entities($skip = array()) {
// The order of operations in here is screwy. In the case where SYNTAX_CONFORMANCE_ENTITIES is
// defined, we should be able to parse+return it immediately. However, some weird dependency
// crept into the system where civicrm_api('Entity','get') must be called as part of entities()
}
/**
+ * Get list of entities for get test.
+ *
* @return array
*/
public static function entities_get() {