Commit b5c2afd0 authored by Eileen McNaughton's avatar Eileen McNaughton

Add missing comments in CRM/Core

parent ffd93213
......@@ -39,6 +39,11 @@
*/
class CRM_Core_BAO_ActionSchedule extends CRM_Core_DAO_ActionSchedule {
/**
* @param null $id
*
* @return array
*/
static function getMapping($id = NULL) {
static $_action_mapping;
......@@ -225,6 +230,11 @@ class CRM_Core_BAO_ActionSchedule extends CRM_Core_DAO_ActionSchedule {
);
}
/**
* @param null $id
*
* @return array
*/
static function getSelection1($id = NULL) {
$mapping = self::getMapping($id);
$sel4 = $sel5 = array();
......@@ -370,6 +380,16 @@ WHERE cas.entity_value = $id AND
return $list;
}
/**
* @param $contactId
* @param $to
* @param $scheduleID
* @param $from
* @param $tokenParams
*
* @return bool|null
* @throws CRM_Core_Exception
*/
static function sendReminder($contactId, $to, $scheduleID, $from, $tokenParams) {
$email = $to['email'];
$phoneNumber = $to['phone'];
......@@ -601,6 +621,12 @@ WHERE cas.entity_value = $id AND
return CRM_Core_DAO::setFieldValue('CRM_Core_DAO_ActionSchedule', $id, 'is_active', $is_active);
}
/**
* @param $mappingID
* @param $now
*
* @throws CRM_Core_Exception
*/
static function sendMailings($mappingID, $now) {
$domainValues = CRM_Core_BAO_Domain::getNameAndEmail();
$fromEmailAddress = "$domainValues[0] <$domainValues[1]>";
......@@ -814,6 +840,13 @@ WHERE reminder.action_schedule_id = %1 AND reminder.action_date_time IS NULL
}
}
/**
* @param $mappingID
* @param $now
* @param array $params
*
* @throws API_Exception
*/
static function buildRecipientContacts($mappingID, $now, $params = array()) {
$actionSchedule = new CRM_Core_DAO_ActionSchedule();
$actionSchedule->mapping_id = $mappingID;
......@@ -1195,6 +1228,11 @@ GROUP BY reminder.contact_id
}
}
/**
* @param $field
*
* @return null|string
*/
static function permissionedRelationships($field) {
$query = '
SELECT cm.id AS owner_id, cm.contact_id AS owner_contact, m.id AS slave_id, m.contact_id AS slave_contact, cmt.relationship_type_id AS relation_type, rel.contact_id_a, rel.contact_id_b, rel.is_permission_a_b, rel.is_permission_b_a
......@@ -1225,6 +1263,12 @@ WHERE m.owner_membership_id IS NOT NULL AND
return NULL;
}
/**
* @param null $now
* @param array $params
*
* @return array
*/
static function processQueue($now = NULL, $params = array()) {
$now = $now ? CRM_Utils_Time::setTime($now) : CRM_Utils_Time::getTime();
......@@ -1259,6 +1303,12 @@ WHERE m.owner_membership_id IS NOT NULL AND
return CRM_Core_DAO::singleValueQuery($queryString, $params);
}
/**
* @param $mappingID
* @param $recipientType
*
* @return array
*/
static function getRecipientListing($mappingID, $recipientType) {
$options = array();
if (!$mappingID || !$recipientType) {
......
......@@ -655,6 +655,10 @@ ORDER BY civicrm_address.is_primary DESC, civicrm_address.location_type_id DESC,
return $addresses;
}
/**
* @param $stateCountryMap
* @param null $defaults
*/
static function addStateCountryMap(&$stateCountryMap, $defaults = NULL) {
// first fix the statecountry map if needed
if (empty($stateCountryMap)) {
......@@ -669,6 +673,11 @@ ORDER BY civicrm_address.is_primary DESC, civicrm_address.location_type_id DESC,
$config->stateCountryMap = array_merge($config->stateCountryMap, $stateCountryMap);
}
/**
* @param $form
* @param $defaults
* @param bool $batchFieldNames
*/
static function fixAllStateSelects(&$form, $defaults, $batchFieldNames = false) {
$config = CRM_Core_Config::singleton();
$map = null;
......
......@@ -38,6 +38,10 @@
*/
require_once 'DB.php';
/**
* Class CRM_Core_BAO_CMSUser
*/
class CRM_Core_BAO_CMSUser {
/**
......@@ -344,6 +348,13 @@ class CRM_Core_BAO_CMSUser {
* @param array $self reference to form object
*
*/
/**
* @param $fields
* @param $files
* @param $self
*
* @return array|bool
*/
static function formRule($fields, $files, $self) {
if (empty($fields['cms_create_account'])) {
return TRUE;
......@@ -480,6 +491,11 @@ class CRM_Core_BAO_CMSUser {
return $result;
}
/**
* @param $config
*
* @return object
*/
static function &dbHandle(&$config) {
$errorScope = CRM_Core_TemporaryErrorScope::ignoreException();
$db_uf = DB::connect($config->userFrameworkDSN);
......
......@@ -278,6 +278,9 @@ class CRM_Core_BAO_Cache extends CRM_Core_DAO_Cache {
* @access private
*/
/**
* @param $names
*/
static function restoreSessionFromCache($names) {
foreach ($names as $key => $sessionName) {
if (is_array($sessionName)) {
......
......@@ -366,6 +366,9 @@ class CRM_Core_BAO_ConfigSetting {
}
}
/**
* @return array
*/
static function getConfigSettings() {
$config = CRM_Core_Config::singleton();
......@@ -469,6 +472,12 @@ class CRM_Core_BAO_ConfigSetting {
return array($url, $dir, $siteName, $siteRoot);
}
/**
* @param array $defaultValues
*
* @return string
* @throws Exception
*/
static function doSiteMove($defaultValues = array() ) {
$moveStatus = ts('Beginning site move process...') . '<br />';
// get the current and guessed values
......@@ -648,6 +657,9 @@ WHERE option_group_id = (
return TRUE;
}
/**
* @return array
*/
static function skipVars() {
return array(
'dsn', 'templateCompileDir',
......
......@@ -92,6 +92,9 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField {
return self::$_dataType;
}
/**
* @return array
*/
static function dataToHtml() {
if (!self::$_dataToHtml) {
self::$_dataToHtml = array(
......@@ -1177,6 +1180,17 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField {
);
}
/**
* @param $value
* @param $option
* @param $html_type
* @param $data_type
* @param null $format
* @param null $contactID
* @param null $fieldID
*
* @return array|mixed|null|string
*/
static function getDisplayValueCommon($value,
&$option,
$html_type,
......@@ -1492,6 +1506,22 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField {
}
}
/**
* @param $contactID
* @param $cfID
* @param null $fileID
* @param bool $absolute
*
* @return array
*/
/**
* @param $contactID
* @param $cfID
* @param null $fileID
* @param bool $absolute
*
* @return array
*/
static function getFileURL($contactID, $cfID, $fileID = NULL, $absolute = FALSE) {
if ($contactID) {
if (!$fileID) {
......@@ -1802,6 +1832,11 @@ SELECT $columnName
return $customFormatted;
}
/**
* @param $params
*
* @return array
*/
static function &defaultCustomTableSchema(&$params) {
// add the id and extends_id
$table = array(
......@@ -1840,6 +1875,12 @@ SELECT $columnName
return $table;
}
/**
* @param $field
* @param $operation
* @param bool $indexExist
* @param bool $triggerRebuild
*/
static function createField($field, $operation, $indexExist = FALSE, $triggerRebuild = TRUE) {
$tableName = CRM_Core_DAO::getFieldValue(
'CRM_Core_DAO_CustomGroup',
......@@ -2166,6 +2207,12 @@ WHERE option_group_id = {$optionGroupId}";
}
}
/**
* @param $optionGroupId
* @param $htmlType
*
* @return null|string
*/
static function getOptionGroupDefault($optionGroupId, $htmlType) {
$query = "
SELECT default_value, html_type
......@@ -2207,6 +2254,15 @@ ORDER BY html_type";
return $defaultValue;
}
/**
* @param $params
* @param $customFields
* @param $entityID
* @param $customFieldExtends
* @param bool $inline
*
* @return array
*/
static function postProcess(&$params,
&$customFields,
$entityID,
......@@ -2241,6 +2297,12 @@ ORDER BY html_type";
return $customData;
}
/**
* @param $field
* @param $options
*
* @throws Exception
*/
static function buildOption($field, &$options) {
// Fixme - adding anything but options to the $options array is a bad idea
// What if an option had the key 'attributes'?
......@@ -2289,6 +2351,12 @@ SELECT label, value
}
}
/**
* @param $fieldLabel
* @param null $groupTitle
*
* @return null
*/
static function getCustomFieldID($fieldLabel, $groupTitle = NULL) {
$params = array(1 => array($fieldLabel, 'String'));
if ($groupTitle) {
......
......@@ -995,6 +995,13 @@ ORDER BY civicrm_custom_group.weight,
return $groupTree;
}
/**
* @param $entityType
* @param $path
* @param string $cidToken
*
* @return array
*/
public static function &getActiveGroups($entityType, $path, $cidToken = '%%cid%%') {
// for Group's
$customGroupDAO = new CRM_Core_DAO_CustomGroup();
......@@ -1212,6 +1219,13 @@ ORDER BY civicrm_custom_group.weight,
return TRUE;
}
/**
* @param $groupTree
* @param $defaults
* @param bool $viewMode
* @param bool $inactiveNeeded
* @param int $action
*/
static function setDefaults(&$groupTree, &$defaults, $viewMode = FALSE, $inactiveNeeded = FALSE, $action = CRM_Core_Action::NONE) {
foreach ($groupTree as $id => $group) {
if (!isset($group['fields'])) {
......@@ -1349,6 +1363,11 @@ ORDER BY civicrm_custom_group.weight,
}
}
/**
* @param $groupTree
* @param $params
* @param bool $skipFile
*/
static function postProcess(&$groupTree, &$params, $skipFile = FALSE) {
// Get the Custom form values and groupTree
// first reset all checkbox and radio data
......@@ -1626,6 +1645,12 @@ ORDER BY civicrm_custom_group.weight,
return TRUE;
}
/**
* @param $table
*
* @return string
* @throws Exception
*/
static function mapTableName($table) {
switch ($table) {
case 'Contact':
......@@ -1689,6 +1714,9 @@ SELECT IF( EXISTS(SELECT name FROM civicrm_contact_type WHERE name like %1), 1,
}
}
/**
* @param $group
*/
static function createTable($group) {
$params = array(
'name' => $group->table_name,
......@@ -2202,6 +2230,12 @@ SELECT civicrm_custom_group.id as groupID, civicrm_custom_group.title as groupT
return $objTypes;
}
/**
* @param $customGroupId
* @param $entityId
*
* @return bool
*/
static function hasReachedMaxLimit($customGroupId, $entityId) {
//check whether the group is multiple
$isMultiple = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $customGroupId, 'is_multiple');
......@@ -2226,6 +2260,9 @@ SELECT civicrm_custom_group.id as groupID, civicrm_custom_group.title as groupT
return $hasReachedMax;
}
/**
* @return array
*/
static function getMultipleFieldGroup() {
$multipleGroup = array();
$dao = new CRM_Core_DAO_CustomGroup();
......
......@@ -212,6 +212,11 @@ WHERE id = %1";
}
}
/**
* @param $params
*
* @throws Exception
*/
static function updateCustomValues($params) {
$optionDAO = new CRM_Core_DAO_OptionValue();
$optionDAO->id = $params['optionId'];
......@@ -279,6 +284,12 @@ SET {$dao->columnName} = REPLACE( {$dao->columnName}, %1, %2 )";
}
}
/**
* @param $customFieldID
* @param null $optionGroupID
*
* @return array
*/
static function valuesByID($customFieldID, $optionGroupID = NULL) {
if (!$optionGroupID) {
$optionGroupID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField',
......
......@@ -625,6 +625,14 @@ SELECT label, value
);
}
/**
* @param $id
* @param $label
* @param $type
* @param $fieldName
* @param $value
* @param $grouping
*/
function searchRange(&$id, &$label, $type, $fieldName, &$value, &$grouping) {
$qill = array();
......
......@@ -160,6 +160,9 @@ class CRM_Core_BAO_CustomValue extends CRM_Core_DAO {
}
/**
* @param $formValues
*/
public static function fixFieldValueOfTypeMemo(&$formValues) {
if (empty($formValues)) {
return NULL;
......
......@@ -34,6 +34,11 @@
*/
class CRM_Core_BAO_CustomValueTable {
/**
* @param $customParams
*
* @throws Exception
*/
static function create(&$customParams) {
if (empty($customParams) ||
!is_array($customParams)
......@@ -300,6 +305,11 @@ class CRM_Core_BAO_CustomValueTable {
}
}
/**
* @param $params
* @param $entityTable
* @param $entityID
*/
static function store(&$params, $entityTable, $entityID) {
$cvParams = array();
foreach ($params as $fieldID => $param) {
......@@ -341,6 +351,13 @@ class CRM_Core_BAO_CustomValueTable {
}
}
/**
* @param $params
* @param $customFields
* @param $entityTable
* @param $entityID
* @param $customFieldExtends
*/
static function postProcess(&$params, &$customFields, $entityTable, $entityID, $customFieldExtends) {
$customData = CRM_Core_BAO_CustomField::postProcess($params,
$customFields,
......
......@@ -120,6 +120,12 @@ class CRM_Core_BAO_Dashboard extends CRM_Core_DAO_Dashboard {
return $defaultDashlet ? $defaultDashlet : $dashlets;
}
/**
* @param $hasDashlets
*
* @return bool
* @throws CiviCRM_API3_Exception
*/
static function initializeDashlets($hasDashlets) {
$getDashlets = civicrm_api3("Dashboard", "get", array('domain_id' => CRM_Core_Config::domainID()));
$contactID = CRM_Core_Session::singleton()->get('userID');
......@@ -421,6 +427,11 @@ class CRM_Core_BAO_Dashboard extends CRM_Core_DAO_Dashboard {
return $dashlet;
}
/**
* @param $url
*
* @return string
*/
static function getDashletName($url) {
$urlElements = explode('/', $url);
if ($urlElements[1] == 'dashlet') {
......
......@@ -120,6 +120,11 @@ class CRM_Core_BAO_Domain extends CRM_Core_DAO_Domain {
CRM_Core_Config::singleton(TRUE, TRUE);
}
/**
* @param bool $skipUsingCache
*
* @return null|string
*/
static function version( $skipUsingCache = false ) {
return CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Domain',
CRM_Core_Config::domainID(),
......@@ -184,6 +189,9 @@ class CRM_Core_BAO_Domain extends CRM_Core_DAO_Domain {
return $domain;
}
/**
* @return bool
*/
static function multipleDomains() {
$session = CRM_Core_Session::singleton();
......@@ -196,6 +204,11 @@ class CRM_Core_BAO_Domain extends CRM_Core_DAO_Domain {
return $numberDomains > 1 ? TRUE : FALSE;
}
/**
* @param bool $skipFatal
*
* @throws Exception
*/
static function getNameAndEmail($skipFatal = FALSE) {
$fromEmailAddress = CRM_Core_OptionGroup::values('from_email_address', NULL, NULL, NULL, ' AND is_default = 1');
if (!empty($fromEmailAddress)) {
......@@ -219,6 +232,11 @@ class CRM_Core_BAO_Domain extends CRM_Core_DAO_Domain {
CRM_Core_Error::fatal($status);
}
/**
* @param $contactID
*
* @return bool|null|object|string
*/
static function addContactToDomainGroup($contactID) {
$groupID = self::getGroupId();
......@@ -231,6 +249,9 @@ class CRM_Core_BAO_Domain extends CRM_Core_DAO_Domain {
return FALSE;
}
/**
* @return bool|null|object|string
*/
static function getGroupId() {
static $groupID = NULL;
......@@ -269,11 +290,19 @@ class CRM_Core_BAO_Domain extends CRM_Core_DAO_Domain {
return $groupID ? $groupID : FALSE;
}
/**
* @param $groupId
*
* @return bool
*/
static function isDomainGroup($groupId) {
$domainGroupID = self::getGroupId();
return $domainGroupID == $groupId ? TRUE : FALSE;
}
/**
* @return array
*/
static function getChildGroupIds() {
$domainGroupID = self::getGroupId();
$childGrps = array();
......@@ -286,6 +315,9 @@ class CRM_Core_BAO_Domain extends CRM_Core_DAO_Domain {
}
// function to retrieve a list of contact-ids that belongs to current domain/site.
/**
* @return array
*/
static function getContactList() {
$siteGroups = CRM_Core_BAO_Domain::getChildGroupIds();
$siteContacts = array();
......
......@@ -320,6 +320,9 @@ AND reset_date IS NULL
return $fromEmailValues;
}
/**
* @return object
*/
static function isMultipleBulkMail() {
return CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, 'civimail_multiple_bulk_emails', NULL, FALSE);
}
......
......@@ -40,6 +40,13 @@
static $_signableFields = array('entityTable', 'entityID', 'fileID');
/**
* @param $fileID
* @param $entityID
* @param null $entityTable
*
* @return array
*/
static function path($fileID, $entityID, $entityTable = NULL) {
$entityFileDAO = new CRM_Core_DAO_EntityFile();
if ($entityTable) {
......@@ -65,6 +72,19 @@
}
/**
* @param $data
* @param $fileTypeID
* @param $entityTable
* @param $entityID
* @param $entitySubtype
* @param bool $overwrite
* @param null $fileParams
* @param string $uploadName
* @param null $mimeType<