}
/**
- * Funtion to add activity contact
+ * Function to add activity contact.
*
* @param array $params
* The values for this table: activity id, contact id, record type.
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2014
* $Id$
- *
*/
class CRM_Activity_BAO_Query {
/**
- * Build select for Case
+ * Build select for Case.
*
* @param $query
- *
- * @return void
*/
public static function select(&$query) {
if (!empty($query->_returnProperties['activity_id'])) {
* the form values associated with the saved search are used for searching.
* - if user has done a submit with new values the regular post submissing is
* done.
+ *
* The processing consists of using a Selector / Controller framework for getting the
* search results.
- *
- * @param
- *
- * @return void
*/
public function postProcess() {
if ($this->_done) {
}
/**
- * Build the form object
- *
- *
- * @return void
+ * Build the form object.
*/
public function buildQuickForm() {
$ufGroupId = $this->get('ufGroupId');
/**
* Set default values for the form.
- *
- *
- * @return void
*/
public function setDefaultValues() {
if (empty($this->_fields)) {
/**
* Process the form after the input has been submitted and validated
- *
- *
- * @return void
*/
public function postProcess() {
$params = $this->exportValues();
/**
* This class provides the functionality to delete a group of
- * Activites. This class provides functionality for the actual
+ * Activities. This class provides functionality for the actual
* deletion.
*/
class CRM_Activity_Form_Task_Delete extends CRM_Activity_Form_Task {
class CRM_Activity_Form_Task_Print extends CRM_Activity_Form_Task {
/**
- * Build all the data structures needed to build the form
+ * Build all the data structures needed to build the form.
*
* @return void
*/
class CRM_Activity_Import_Controller extends CRM_Core_Controller {
/**
- * Class constructor
+ * Class constructor.
+ *
* @param null $title
* @param bool|int $action
* @param bool $modal
protected $_fileSize;
/**
- * Seperator being used
+ * Separator being used.
*/
protected $_seperator;
/**
* Returns total number of rows for the query.
*
- * @param
+ * @param string $action
*
* @return int
* Total number of rows
}
/**
- * Returns all the rows in the given offset and rowCount
+ * Returns all the rows in the given offset and rowCount.
*
* @param string $action
* The action being performed.
protected $_task;
/**
- * Class constructor
+ * Class constructor.
+ *
* @param object $controller
- * @param int $action
+ * @param \const|int $action
*/
public function __construct($controller, $action = CRM_Core_Action::NONE) {
parent::__construct($controller, $action);
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2014
* $Id$
- *
*/
/**
- * class to represent the actions that can be performed on a group of contacts
- * used by the search forms
- *
+ * Class to represent the actions that can be performed on a group of contacts
+ * used by the search forms.
*/
class CRM_Activity_Task {
const
* @see hook_civicrm_triggerInfo
* @see CRM_Core_DAO::triggerRebuild
* @see http://issues.civicrm.org/jira/browse/CRM-10554
+ *
+ * @param $info
+ * @param null $tableName
*/
public static function triggerInfo(&$info, $tableName = NULL) {
//during upgrade, first check for valid version and then create triggers
class CRM_Contact_Controller_Search extends CRM_Core_Controller {
/**
- * Class constructor
+ * Class constructor.
+ *
+ * @param string $title
+ * @param bool $modal
+ * @param int|mixed|null $action
*/
public function __construct($title = NULL, $modal = TRUE, $action = CRM_Core_Action::NONE) {
parent::__construct($title, $modal);
$form->assign('tagGroup', $form->_tagGroup);
}
+ /**
+ * Climb tree.
+ *
+ * @param $form
+ * @param $tree
+ * @param $elements
+ *
+ * @return mixed
+ */
public static function climbtree($form, $tree, &$elements) {
foreach ($tree as $tagID => $varValue) {
$tagAttribute = array(
}
/**
+ * Is search active for this user.
+ *
* @return bool
*/
public function isActive() {
return $tables;;
}
+ /**
+ * Move IDs.
+ *
+ * @param string $fromTable
+ * @param string $toTable
+ * @param int $limit
+ */
public function moveIDs($fromTable, $toTable, $limit) {
$sql = "
INSERT INTO {$toTable}
return $tables;
}
+ /**
+ * Move IDs.
+ *
+ * @param $fromTable
+ * @param $toTable
+ * @param $limit
+ */
public function moveIDs($fromTable, $toTable, $limit) {
$sql = "
INSERT INTO {$toTable}
return $tables;
}
+ /**
+ * Move IDs.
+ * @param string $fromTable
+ * @param string $toTable
+ * @param int $limit
+ */
public function moveIDs($fromTable, $toTable, $limit) {
$sql = "
INSERT INTO {$toTable}
return $dao->N;
}
+ /**
+ * Destructor function.
+ */
public function __destruct() {
// the temporary tables are dropped automatically
// so we don't do it here
}
/**
- * convert associative array names to values
- * and vice-versa.
+ * Convert associative array names to values and vice-versa.
*
* This function is used by both the web form layer and the api. Note that
* the api needs the name => value conversion, also the view layer typically
* requires value => name conversion
+ *
+ * @param array $defaults
+ * @param string $property
+ * @param array $lookup
+ * @param bool $reverse
+ *
+ * @return bool
*/
public static function lookupValue(&$defaults, $property, &$lookup, $reverse) {
$id = $property . '_id';
}
/**
- * Add extra fields specific to contribtion
- *
+ * Add extra fields specific to contribution.
*/
public static function getSpecialContributionFields() {
$extraFields = array(
/**
* Update contribution as well as related objects.
+ *
+ * @param array $params
+ * @param bool $processContributionObject
+ *
+ * @return array
+ * @throws \Exception
*/
public static function transitionComponents($params, $processContributionObject = FALSE) {
// get minimum required values.
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2014
* $Id$
- *
*/
class CRM_Contribute_BAO_Contribution_Utils {
}
/**
- * Helper to determine if the page supports separate membership payments
+ * Helper to determine if the page supports separate membership payments.
+ *
* @param int $id form id
*
* @return bool
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2014
* $Id$
- *
*/
class CRM_Contribute_BAO_Query {
/**
- * Static field for all the export/import contribution fields
+ * Static field for all the export/import contribution fields.
*
* @var array
*/
}
/**
- * If contributions are involved, add the specific contribute fields
+ * If contributions are involved, add the specific contribute fields.
*
* @param $query
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2014
* $Id$
- *
*/
/**
*
* Typically the first form will display the search criteria and it's results
*
- * The second form is used to process search results with the asscociated actions
+ * The second form is used to process search results with the associated actions
*
*/
class CRM_Contribute_Controller_Contribution extends CRM_Core_Controller {
/**
- * Class constructor
+ * Class constructor.
+ *
+ * @param string $title
+ * @param bool|int $action
+ * @param bool $modal
*/
public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
parent::__construct($title, $modal);
class CRM_Contribute_Controller_Search extends CRM_Core_Controller {
/**
- * Class constructor
+ * Class constructor.
+ *
+ * @param string $title
+ * @param bool|int $action
+ * @param bool $modal
*/
public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
- | CiviCRM is distributed in the hope that it will be usefusul, but |
+ | CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
- | CiviCRM is distributed in the hope that it will be usefusul, but |
+ | CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
}
/**
- * Set default values for the form. Note that in edit/view mode
- * the default values are retrieved from the database
+ * Set default values for the form.
*
+ * Note that in edit/view mode
+ * the default values are retrieved from the database
*
* @return void
*/
}
/**
+ * Wrangle financial type ID.
+ *
* This wrangling of the financialType ID was happening in a shared function rather than in the form it relates to & hence has been moved to that form
* Pledges are not relevant to the membership code so that portion will not go onto the membership form.
*
- * Comments from previous refactor indicate doubt as to what was going on
+ * Comments from previous refactor indicate doubt as to what was going on.
+ *
* @param int $contributionTypeId
*
* @return null|string
}
/**
- * Process the form
+ * Process the form.
*
* @param array $premiumParams
* @param $contribution
- *
- * @return void
*/
public function postProcessPremium($premiumParams, $contribution) {
$hour = $minute = $second = 0;
}
/**
- * Process the contribution
+ * Process the contribution.
*
* @param CRM_Core_Form $form
* @param array $params
}
/**
- * Create the recurring contribution record
+ * Create the recurring contribution record.
*
* @param CRM_Core_Form $form
* @param array $params
}
/**
- * Add on behalf of organization and it's location
+ * Add on behalf of organization and it's location.
*
* @param array $behalfOrganization
* array of organization info.
* form values array.
* @param array $params
* @param null $fields
- *
- * @return void
*/
public static function processOnBehalfOrganization(&$behalfOrganization, &$contactID, &$values, &$params, $fields = NULL) {
$isCurrentEmployer = FALSE;
}
/**
- * Function used to save pcp / soft credit entry
+ * Function used to save pcp / soft credit entry.
+ *
* This is used by contribution and also event pcps
*
* @param array $params
* @param object $contribution
* Contribution object.
- *
*/
public static function processPcpSoft(&$params, &$contribution) {
- //add soft contribution due to pcp or Submit Credit / Debit Card Contribution by admin.
+ // Add soft contribution due to pcp or Submit Credit / Debit Card Contribution by admin.
if (!empty($params['soft_credit_to'])) {
$contributionSoftParams = array();
foreach (array(
}
/**
- * Function used to send notification mail to pcp owner
- * This is used by contribution and also event pcps
+ * Function used to send notification mail to pcp owner.
+ *
+ * This is used by contribution and also event PCPs.
*
* @param object $contribution
* @param object $contributionSoft
* Contribution object.
- *
*/
-
public static function pcpNotifyOwner($contribution, $contributionSoft) {
$params = array('id' => $contributionSoft->pcp_id);
CRM_Core_DAO::commonRetrieve('CRM_PCP_DAO_PCP', $params, $pcpInfo);
}
/**
- * Function used to se pcp related defaults / params
- * This is used by contribution and also event pcps
+ * Function used to se pcp related defaults / params.
+ *
+ * This is used by contribution and also event PCPs
*
* @param CRM_Core_Form $page
* Form object.
}
/**
+ * Process membership.
+ *
* @param array $membershipParams
* @param int $contactID
* @param array $customFieldsFormatted
}
/**
- * Are we going to do 2 financial transactions?
- * ie the membership block supports a separate transactions AND the contribution form has been configured for a contribution
- * transaction AND a membership transaction AND the payment processor supports double financial transactions (ie. NOT doTransferPayment style)
+ * Are we going to do 2 financial transactions.
*
+ * Ie the membership block supports a separate transactions AND the contribution form has been configured for a
+ * contribution
+ * transaction AND a membership transaction AND the payment processor supports double financial transactions (ie. NOT doTransferPayment style)
*
* @param int $formID
* @param bool $amountBlockActiveOnForm
}
/**
- * This function sets the fields
+ * This function sets the fields.
+ *
* - $this->_params['amount_level']
* - $this->_params['selectMembership']
* And under certain circumstances sets
$this->_params['selectMembership'] = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue',
$this->_params["price_{$priceField->id}"], 'membership_type_id');
}
- } // if separate payment we set contribution amount to be null, so that it will not show contribution amount same as membership amount.
+ }
+ // If separate payment we set contribution amount to be null, so that it will not show contribution amount same
+ // as membership amount.
// @todo - this needs more documentation - it appears the setting to null is tied up with separate membership payments
// but the circumstances are very confusing. Many of these conditions are repeated in the next conditional
// so we should merge them together
}
/**
+ * Submit function.
+ *
* @param array $params
*
* @throws CiviCRM_API3_Exception
}
/**
- * Helper function for static submit function - set relevant params - help us to build up an array that we can pass in
+ * Helper function for static submit function - set relevant params - help us to build up an array that we can pass
+ * in.
+ *
* @param int $id
* @param array $params
*
* The uploaded files if any.
* @param $self
*
- *
* @return bool|array
* true if no errors, else array of errors
*/
}
/**
- * Handle Payment Processor switching
- * For contribution and event registration forms
+ * Handle Payment Processor switching for contribution and event registration forms.
+ *
* @param CRM_Contribute_Form_Contribution_Main|CRM_Event_Form_Registration_Register $form
* @param bool $noFees
*/
/**
* Set variables up before form is built
*
- * @throws CRM_Contribution_Exception_InactiveContributionPageException
- * @return void
+ * @throws \CRM_Contribute_Exception_InactiveContributionPageException
+ * @throws \Exception
*/
public function preProcess() {
*/
/**
- * This class build form elements for select exitsing or create new soft block
+ * This class build form elements for select existing or create new soft block
*/
class CRM_Contribute_Form_SoftCredit {
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2014
- *
*/
/**
}
/**
- * The value is in string format. convert the value to the type of this field
+ * Set a value.
+ *
+ * The value is in string format. Convert the value to the type of this field
* and set the field value with the appropriate type
+ *
+ * @param $value
*/
public function setValue($value) {
$this->_value = $value;
}
/**
+ * Validate a field.
+ *
* @return bool
*/
public function validate() {
$onDuplicate
);
- // add all the necessary variables to the form
+ // Add all the necessary variables to the form.
$parser->set($this, CRM_Import_Parser::MODE_IMPORT);
- // check if there is any error occured
+ // Check if there is any error occurred.
$errorStack = CRM_Core_Error::singleton();
$errors = $errorStack->getErrors();
* @param CRM_Core_Session $store
*
* @param int $mode
- *
- * @return void
*/
public function set($store, $mode = self::MODE_SUMMARY) {
$store->set('fileSize', $this->_fileSize);
*/
/**
- * class to parse contribution csv files
+ * Class to parse contribution csv files.
*/
class CRM_Contribute_Import_Parser_Contribution extends CRM_Contribute_Import_Parser {
protected $_newContributions;
/**
- * Class constructor
+ * Class constructor.
+ *
+ * @param $mapperKeys
+ * @param null $mapperSoftCredit
+ * @param null $mapperPhoneType
+ * @param null $mapperSoftCreditType
*/
public function __construct(&$mapperKeys, $mapperSoftCredit = NULL, $mapperPhoneType = NULL, $mapperSoftCreditType = NULL) {
parent::__construct();
}
/**
- * Process pledge payments
+ * Process pledge payments.
+ *
+ * @param array $formatted
+ *
+ * @return int
*/
public function processPledgePayments(&$formatted) {
if (!empty($formatted['pledge_payment_id']) && !empty($formatted['pledge_id'])) {
/**
* Returns total number of rows for the query.
*
- * @param
+ * @param string $action
*
* @return int
* Total number of rows
/**
* Class constructor
*
- * @param CRM_Contact_Import_Controller $controller
+ * @param CRM_Core_Controller $controller
* @param \const|int $action
*
* @return CRM_Contribute_StateMachine_Contribution
),
);
+ /**
+ * Getter for status.
+ *
+ * @return string
+ */
public static function getStatus() {
return self::$status;
}
+ /**
+ * Setter for status.
+ *
+ * @param string $status
+ */
public static function setStatus($status) {
self::$status = $status;
}
/**
- * Save records in civicrm_recujrring_entity table
+ * Save records in civicrm_recurring_entity table.
*
* @param array $params
- * Reference array contains the values submitted by the form .
- *
+ * Reference array contains the values submitted by the form.
*
* @return object
*/
}
/**
- * Store multiple items in the setting table
+ * Store multiple items in the setting table.
*
* @param array $params
* (required) An api formatted array of keys and values.
- * @param null $domains
+ * @param array $domains Array of domains to get settings for. Default is the current domain
* @param $settingsToReturn
*
- * @domains array an array of domains to get settings for. Default is the current domain
- * @return void
+ * @return array
*/
public static function getItems(&$params, $domains = NULL, $settingsToReturn) {
$originalDomain = CRM_Core_Config::domainID();
return $defaults;
}
+ /**
+ * Build form.
+ *
+ * @param $form
+ */
public static function buildQuickForm(&$form) {
if (self::$_entityTable) {
$entityType = explode("_", self::$_entityTable);
return $result;
}
+ /**
+ * Get indices.
+ *
+ * @return array
+ */
public static function &indices() {
static $result = NULL;
if (!$result) {
return $result;
}
+ /**
+ * Get tables.
+ *
+ * @return array
+ */
public static function &tables() {
static $result = NULL;
if (!$result) {
}
}
+ /**
+ * Get declarations.
+ *
+ * @return array|null
+ */
public function getDeclarations() {
if ($this->declarations === NULL) {
$this->declarations = array();
$this->completeTransaction($input, $ids, $objects, $transaction, $recur);
}
+ /**
+ * Main function.
+ *
+ * @return bool
+ */
public function main() {
//@todo - this could be refactored like PayPalProIPN & a test could be added
}
/**
- * Getter for name
+ * Getter for name.
*
* @return string
*/
}
/**
- * Setter for name
+ * Setter for name.
*
* @param string $name
*
}
/**
- * Do a state transition jump. Currently only supported types are
+ * Do a state transition jump.
+ *
+ * Currently only supported types are
* Next and Back. The other actions (Cancel, Done, Submit etc) do
* not need the state machine to figure out where to go
*
}
/**
- * Helper function to add a State to the state machine
+ * Helper function to add a State to the state machine.
*
* @param string $name
* The internal name.
}
/**
- * Given a name find the corresponding state
+ * Given a name find the corresponding state.
*
* @param string $name
* The state name.
}
/**
- * Return the list of state objects
+ * Return the list of state objects.
*
* @return array
* array of states in the state machine
}
/**
- * AddSequentialStates: meta level function to create a simple
- * wizard for a state machine that is completely sequential.
+ * Add sequential pages.
*
+ * Meta level function to create a simple wizard for a state machine that is completely sequential.
*
* @param array $pages
* (reference ) the array of page objects.
- *
- * @internal param array $states states is an array of arrays. Each element
- * of the top level array describes a state. Each state description
- * includes the name, the display name and the class name
- *
- * @return void
*/
public function addSequentialPages(&$pages) {
$this->_pages = &$pages;
return self::$participantStatus[$index];
}
+ /**
+ * Get participant status class options.
+ *
+ * @return array
+ */
public static function participantStatusClassOptions() {
return array(
'Positive' => ts('Positive'),
class CRM_Group_StateMachine extends CRM_Core_StateMachine {
/**
- * Class constructor
+ * Class constructor.
+ *
+ * @param object $controller
+ * @param \const|int $action
*/
public function __construct($controller, $action = CRM_Core_Action::NONE) {
parent::__construct($controller, $action);
class CRM_Member_Import_Controller extends CRM_Core_Controller {
/**
- * Class constructor
+ * Class constructor.
+ *
+ * @param string $title
+ * @param bool|int $action
+ * @param bool $modal
*/
public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
parent::__construct($title, $modal);
protected $_task;
/**
- * Class constructor
+ * Class constructor.
+ *
+ * @param object $controller
+ * @param \const|int $action
*/
public function __construct($controller, $action = CRM_Core_Action::NONE) {
parent::__construct($controller, $action);
}
/**
- * Return the form name of the task
+ * Return the form name of the task.
*
* @return string
*/
class CRM_PCP_Controller_PCP extends CRM_Core_Controller {
/**
- * Class constructor
+ * Class constructor.
+ *
+ * @param string $title
+ * @param bool|int $action
+ * @param bool $modal
*/
public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
return parent::run();
}
+ /**
+ * Get context.
+ *
+ * @param $form
+ */
public static function setContext(&$form) {
$context = CRM_Utils_Request::retrieve('context', 'String', $form, FALSE, 'search');
protected $_task;
/**
- * Class constructor
+ * Class constructor.
+ *
+ * @param object $controller
+ * @param \const|int $action
*/
public function __construct($controller, $action = CRM_Core_Action::NONE) {
parent::__construct($controller, $action);
* Value we want to set the is_active field.
*
* @return Object
- * DAO object on sucess, null otherwise
- *
+ * DAO object on success, null otherwise.
*/
public static function setIsActive($id, $is_active) {
return CRM_Core_DAO::setFieldValue('CRM_Price_DAO_PriceField', $id, 'is_active', $is_active);
}
+ /**
+ * Freeze form if the event is full.
+ *
+ * @param $element
+ * @param $fieldOptions
+ *
+ * @return null
+ */
public static function freezeIfEnabled(&$element, $fieldOptions) {
if (!empty($fieldOptions['is_full'])) {
$element->freeze();
* @param bool $required
* @param bool $validOnly
*
- * @internal param int $setId - price set id whose details are needed
- *
* @return array
* array consisting of field details
*/
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2014
* $Id$
- *
*/
class CRM_Upgrade_Incremental_php_FourSix {
const BATCH_SIZE = 5000;
/**
+ * Verify DB state.
+ *
* @param $errors
*
* @return bool
}
/**
- * Compute any messages which should be displayed beforeupgrade
+ * Compute any messages which should be displayed before upgrade.
*
* Note: This function is called iteratively for each upcoming
* revision to the database.
* @param string $rev
* a version number, e.g. '4.4.alpha1', '4.4.beta3', '4.4.0'.
* @param null $currentVer
- *
- * @return void
*/
public function setPreUpgradeMessage(&$preUpgradeMessage, $rev, $currentVer = NULL) {
}
$queue->createItem($task, array('weight' => -1));
}
- function upgrade_4_6_alpha3($rev) {
- // task to process sql
+ /**
+ * Upgrade function.
+ *
+ * @param string $rev
+ */
+ public function upgrade_4_6_alpha3($rev) {
+ // Task to process sql.
$this->addTask(ts('Add and update reference_date column for Schedule Reminders'), 'updateReferenceDate');
}
- // CRM-15728, Add new column reference_date to civicrm_action_log in order to track
- // actual action_start_date for membership entity for only those schedule reminders which are not repeatable
- static function updateReferenceDate(CRM_Queue_TaskContext $ctx) {
- //Add column civicrm_action_log.reference_date if not exists
+ /**
+ * Add new column reference_date to civicrm_action_log in order to track.
+ *
+ * CRM-15728, actual action_start_date for membership entity for only those schedule reminders which are not repeatable
+ *
+ * @param \CRM_Queue_TaskContext $ctx
+ *
+ * @return bool
+ */
+ public static function updateReferenceDate(CRM_Queue_TaskContext $ctx) {
+ //Add column civicrm_action_log.reference_date if not exists.
$sql = "SELECT count(*) FROM information_schema.columns WHERE table_schema = database() AND table_name = 'civicrm_action_log' AND COLUMN_NAME = 'reference_date' ";
$res = CRM_Core_DAO::singleValueQuery($sql);
CRM_Core_DAO::executeQuery($query);
}
- //Retrieve schedule reminders for membership entity and is not repeatable and no absolute date chosen
+ //Retrieve schedule reminders for membership entity and is not repeatable and no absolute date chosen.
$query = "SELECT schedule.* FROM civicrm_action_schedule schedule
LEFT JOIN civicrm_action_mapping mapper ON mapper.id = schedule.mapping_id AND
mapper.entity = 'civicrm_membership' AND
// construct basic where clauses
$where = array(
- 'reminder.action_date_time >= DATE_SUB(reminder.action_date_time, INTERVAL 9 MONTH)'
+ 'reminder.action_date_time >= DATE_SUB(reminder.action_date_time, INTERVAL 9 MONTH)',
); //choose reminder older then 9 months
$dao = CRM_Core_DAO::executeQuery($query);
- while($dao->fetch()) {
+ while ($dao->fetch()) {
$referenceColumn = str_replace('membership_', "m.", $dao->start_action_date);
$value = implode(', ', explode(CRM_Core_DAO::VALUE_SEPARATOR, trim($dao->entity_value, CRM_Core_DAO::VALUE_SEPARATOR)));
return TRUE;
}
+
}
}
}
+ /**
+ * Convert html to tcpdf.
+ *
+ * @param $paper_size
+ * @param $orientation
+ * @param $margins
+ * @param $html
+ * @param $output
+ * @param $fileName
+ * @param $stationery_path
+ */
public static function _html2pdf_tcpdf($paper_size, $orientation, $margins, $html, $output, $fileName, $stationery_path) {
// Documentation on the TCPDF library can be found at: http://www.tcpdf.org
// This function also uses the FPDI library documented at: http://www.setasign.com/products/fpdi/about/
*
* @param array $params
*
- * @internal param \total $int the total count of items to be displayed
- * @internal param \currentPage $int the page currently being displayed
- * @internal param \status $string the status message to be displayed. It embeds a token
- * %%statusMessage%% that will be replaced with which items
- * are currently being displayed
- * @internal param \csvString $string the title of the link to be displayed for the export
- * @internal param \perPage $int the number of items displayed per page
- *
* @return \CRM_Utils_Pager the newly created and initialized pager object
*/
public function __construct($params) {
/**
* Helper function to assign remaining pager options as good default
- * values
+ * values.
*
* @param array $params
* The set of options needed to initialize the parent.
return $text;
}
+ /**
+ * Format Fts.
+ *
+ * @param string $text
+ * @param $mode
+ *
+ * @return mixed
+ */
protected function _formatFts($text, $mode) {
$result = NULL;
return $this->dedupeWildcards($result, '%');
}
+ /**
+ * Format FTS.
+ *
+ * @param string $text
+ * @param $mode
+ *
+ * @return mixed
+ */
protected function _formatFtsBool($text, $mode) {
$result = NULL;
return $this->dedupeWildcards($result, '%');
}
+ /**
+ * Format like.
+ *
+ * @param $text
+ * @param $mode
+ *
+ * @return mixed
+ */
protected function _formatLike($text, $mode) {
$result = NULL;
return $text;
}
+ /**
+ * Get modes.
+ *
+ * @return array
+ */
public static function getModes() {
return array(
self::MODE_NONE,
);
}
+ /**
+ * Get languages.
+ *
+ * @return array
+ */
public static function getLanguages() {
return array(
self::LANG_SOLR,
*/
namespace Civi\CCase;
+/**
+ * Class Analyzer
+ *
+ * @package Civi\CCase
+ */
class Analyzer {
/**
* @var int
*/
private $indices;
+ /**
+ * @param $caseId
+ */
public function __construct($caseId) {
$this->caseId = $caseId;
$this->flush();
*/
namespace Civi\CCase;
+/**
+ * Interface CaseChangeListener
+ *
+ * @package Civi\CCase
+ */
interface CaseChangeListener {
+ /**
+ * @param \Civi\CCase\Event\CaseChangeEvent $event
+ *
+ * @return mixed
+ */
public function onCaseChange(\Civi\CCase\Event\CaseChangeEvent $event);
}
*/
public $analyzer;
+ /**
+ * @param $analyzer
+ */
public function __construct($analyzer) {
$this->analyzer = $analyzer;
}
*/
namespace Civi\CCase;
+/**
+ * Class Events
+ *
+ * @package Civi\CCase
+ */
class Events {
/**
* @var array (int $caseId => bool $active) list of cases for which we are actively firing case-change event
}
}
+ /**
+ * @param $caseId
+ */
public static function fireCaseChangeForRealz($caseId) {
if (!isset(self::$isActive[$caseId])) {
$tx = new \CRM_Core_Transaction();
<?php
namespace Civi\CCase\Exception;
+/**
+ * Class MultipleActivityException
+ *
+ * @package Civi\CCase\Exception
+ */
class MultipleActivityException extends \CRM_Core_Exception {
}
return self::$singleton;
}
+ /**
+ * @param \Civi\CCase\Event\CaseChangeEvent $event
+ */
public static function onCaseChange_static(\Civi\CCase\Event\CaseChangeEvent $event) {
self::singleton()->onCaseChange($event);
}
+ /**
+ * @param \Civi\CCase\Event\CaseChangeEvent $event
+ *
+ * @throws \CiviCRM_API3_Exception
+ */
public function onCaseChange(\Civi\CCase\Event\CaseChangeEvent $event) {
/** @var \Civi\CCase\Analyzer $analyzer */
$analyzer = $event->analyzer;
<?php
namespace Civi\CiUtil;
+/**
+ * Class Arrays
+ *
+ * @package Civi\CiUtil
+ */
class Arrays {
+ /**
+ * @param $arr
+ * @param $col
+ *
+ * @return array
+ */
public static function collect($arr, $col) {
$r = array();
foreach ($arr as $k => $item) {
<?php
namespace Civi\CiUtil\Command;
+/**
+ * Class AntagonistCommand
+ *
+ * @package Civi\CiUtil\Command
+ */
class AntagonistCommand {
+ /**
+ * @param $argv
+ */
public static function main($argv) {
if (count($argv) != 3) {
print "usage: {$argv[0]} <TargetTest::testFunc> </path/to/suite>\n";
<?php
namespace Civi\CiUtil\Command;
+/**
+ * Class CompareCommand
+ *
+ * @package Civi\CiUtil\Command
+ */
class CompareCommand {
+ /**
+ * @param $argv
+ */
public static function main($argv) {
if (empty($argv[1])) {
echo "summary: Compares the output of different test runs\n";
* @package Civi\CiUtil\Command
*/
class LsCommand {
+ /**
+ * @param $argv
+ */
public static function main($argv) {
$paths = $argv;
array_shift($paths);
<?php
namespace Civi\CiUtil;
+/**
+ * Class ComparisonPrinter
+ *
+ * @package Civi\CiUtil
+ */
class ComparisonPrinter {
var $headers;
var $hasHeader = FALSE;
+ /**
+ * @param $headers
+ */
public function __construct($headers) {
$this->headers = $headers;
}
$this->hasHeader = TRUE;
}
+ /**
+ * @param $test
+ * @param $values
+ */
public function printRow($test, $values) {
$this->printHeader();
printf("%-90s ", $test);
<?php
namespace Civi\CiUtil;
+/**
+ * Class CsvPrinter
+ *
+ * @package Civi\CiUtil
+ */
class CsvPrinter {
var $file;
var $headers;
var $hasHeader = FALSE;
+ /**
+ * @param $file
+ * @param $headers
+ */
public function __construct($file, $headers) {
$this->file = fopen($file, "w");
$this->headers = $headers;
$this->hasHeader = TRUE;
}
+ /**
+ * @param $test
+ * @param $values
+ */
public function printRow($test, $values) {
$this->printHeader();
$row = $values;
protected $phpunit;
protected $envTestSuite;
+ /**
+ * @param string $phpunit
+ * @param string $envTestSuite
+ */
public function __construct($phpunit = "phpunit", $envTestSuite = 'EnvTests') {
$this->phpunit = $phpunit;
$this->envTestSuite = $envTestSuite;
*/
public $result;
+ /**
+ * @param $object
+ * @param $result
+ */
public function __construct($object, $result) {
$this->object = $object;
$this->result = $result;
*/
public $object;
+ /**
+ * @param $object
+ */
public function __construct($object) {
$this->object = $object;
}
*/
public $object;
+ /**
+ * @param $action
+ * @param $entity
+ * @param $id
+ * @param $object
+ */
public function __construct($action, $entity, $id, $object) {
$this->action = $action;
$this->entity = $entity;
*/
public $params;
+ /**
+ * @param $action
+ * @param $entity
+ * @param $id
+ * @param $params
+ */
public function __construct($action, $entity, $id, $params) {
$this->action = $action;
$this->entity = $entity;
*/
public $request;
+ /**
+ * @param $e
+ * @param $request
+ */
public function __construct($e, $request) {
$this->request = $request;
$this->exception = $e;
$this->refCount--;
}
+ /**
+ * @return bool
+ */
public function isEmpty() {
return ($this->refCount == 0);
}
+ /**
+ * @return bool
+ */
public function isRollbackOnly() {
return !$this->doCommit;
}
<?php
/**
+ * @file
* File for the CiviCRM APIv3 API wrapper
*
* @package CiviCRM_APIv3
private $extraParams = array();
/**
+ * Class constructor.
+ *
* @param string $message
* The human friendly error message.
* @param mixed $error_code
}
/**
- * custom string representation of object
+ * Custom string representation of object.
+ *
* @return string
*/
public function __toString() {
}
/**
+ * Get extra parameters.
+ *
* @return array
*/
public function getExtraParams() {
}
/**
+ * Get error codes.
+ *
* @return array
*/
public function getErrorCodes() {
private $extraParams = array();
/**
+ * Class constructor.
+ *
* @param string $message
* The human friendly error message.
* @param mixed $error_code
}
/**
- * custom string representation of object
+ * Custom string representation of object.
+ *
* @return string
*/
public function __toString() {
}
/**
+ * Get error code.
+ *
* @return mixed
*/
public function getErrorCode() {
}
/**
+ * Get extra parameters.
+ *
* @return array
*/
public function getExtraParams() {
interface API_Wrapper {
/**
+ * Interface for interpreting api input.
+ *
* @param array $apiRequest
*
* @return array
public function fromApiInput($apiRequest);
/**
+ * Interface for interpreting api output.
+ *
* @param array $apiRequest
* @param array $result
*
<?php
/**
- * File for the CiviCRM APIv3 API wrapper
+ * @file
+ * File for the CiviCRM APIv3 API wrapper.
*
* @package CiviCRM_APIv3
* @subpackage API
*/
/**
+ * CiviCRM API wrapper function.
+ *
* @param string $entity
* type of entities to deal with
* @param string $action
}
/**
- * Version 3 wrapper for civicrm_api. Throws exception
+ * Version 3 wrapper for civicrm_api.
+ *
+ * Throws exception.
*
* @param string $entity
* Type of entities to deal with.
}
/**
- * Call getfields from api wrapper. This function ensures that settings that
+ * Call getfields from api wrapper.
+ *
+ * This function ensures that settings that
* could alter getfields output (e.g. action for all api & profile_id for
* profile api ) are consistently passed in.
*
* @todo other output modifiers include contact_type
*
* @param array $apiRequest
+ *
* @return array
* getfields output
*/
}
/**
+ * Get camel case version of entity or action name.
+ *
* @param $entity
*
* @return string
}
/**
- * Swap out any $values vars - ie. the value after $value is swapped for the parent $result
+ * Swap out any $values vars.
+ *
+ * Ie. the value after $value is swapped for the parent $result
* 'activity_type_id' => '$value.testfield',
* 'tag_id' => '$value.api.tag.create.id',
* 'tag1_id' => '$value.api.entity.create.0.id'
}
/**
- * Convert possibly camel name to underscore separated entity name
+ * Convert possibly camel name to underscore separated entity name.
*
* @param string $entity
* Entity name in various formats e.g. Contribution, contribution,
* OptionValue, option_value, UFJoin, uf_join.
+ *
* @return string
* Entity name in underscore separated format.
*
}
/**
- * Having a DAO object find the entity name
+ * Having a DAO object find the entity name.
+ *
* @param object $bao
* DAO being passed in.
+ *
* @return string
*/
function _civicrm_api_get_entity_name_from_dao($bao) {
class civicrm_api3 {
/**
+ * Class constructor.
+ *
* @param array $config API configuration.
*/
public function __construct($config = NULL) {
}
/**
+ * Convert to string.
+ *
* @return string
*/
public function __toString() {
}
/**
- * Perform action
+ * Perform action.
+ *
* @param $action
* @param $params
+ *
* @return bool
*/
public function __call($action, $params) {
}
/**
- * As of PHP 5.3.0
+ * As of PHP 5.3.0.
+ *
* @param $name
* @param $arguments
*/
}
/**
- * Call via rest
+ * Call via rest.
+ *
* @param $entity
* @param $action
* @param array $params
+ *
* @return \stdClass
*/
public function remoteCall($entity, $action, $params = array()) {
}
/**
+ * Call api function.
+ *
* @param $entity
* @param string $action
* @param array $params
}
/**
- * Initialize
+ * Initialize.
*/
public function init() {
CRM_Core_DAO::init($this->cfg->dsn);
}
/**
+ * Get attribute.
+ *
* @param $name
* @param null $value
+ *
* @return $this
*/
public function attr($name, $value = NULL) {
}
/**
+ * Is this an error.
+ *
* @return bool
*/
public function is_error() {
}
/**
+ * Check if var is set.
+ *
* @param string $name
+ *
* @return bool
*/
public function is_set($name) {
}
/**
- * @param $name
+ * Get object.
+ *
+ * @param string $name
+ *
* @return $this
*/
public function __get($name) {
*
* @package CiviCRM_APIv3
* @subpackage API_acl_role
- *
*/
/**
- * Save an acl_role
+ * Save an acl_role.
*
* Allowed @params array keys are:
- * {@getfields acl_role_create}
- * @example acl_roleCreate.php
*
* @param array $params
*
}
/**
- * Get an acl_role
- *
- * Allowed @params array keys are:
- * {@getfields acl_role_get}
- * @example acl_roleCreate.php
+ * Get an acl_role.
*
* @param array $params
*
}
/**
- * Delete an acl_role
- *
- * Allowed @params array keys are:
- * {@getfields acl_role_delete}
- * @example acl_roleCreate.php
+ * Delete an acl_role.
*
* @param array $params
*
* @subpackage API_ActionSchedule
*
* @copyright CiviCRM LLC (c) 2004-2014
- *
*/
/**
- * Get CiviCRM Action Schedule details
- * {@getfields action_schedule_create}
+ * Get CiviCRM Action Schedule details.
+ *
* @param array $params
+ *
* @return array
*/
function civicrm_api3_action_schedule_get($params) {
/**
- * Create a new Action Schedule
+ * Create a new Action Schedule.
*
* @param array $params
*
* @return array
- *
- * {@getfields action_schedule_create}
*/
function civicrm_api3_action_schedule_create($params) {
civicrm_api3_verify_one_mandatory($params, NULL, array('start_action_date', 'absolute_date'));
function _civicrm_api3_action_schedule_create_spec(&$params) {
$params['title']['api.required'] = TRUE;
$params['mapping_id']['api.required'] = TRUE;
- // $params['entity_status']['api.required'] = TRUE;
$params['entity_value']['api.required'] = TRUE;
}
/**
- * delete an existing action_schedule
+ * Delete an existing action_schedule.
*
* @param array $params
* Array containing id of the action_schedule.
*
* @return array
* API result array
- *
*/
function civicrm_api3_action_schedule_delete($params) {
return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
* @subpackage API_Activity
* @copyright CiviCRM LLC (c) 2004-2014
* @version $Id: Activity.php 30486 2010-11-02 16:12:09Z shot $
- *
*/
/**
- * Creates or updates an Activity. See the example for usage
+ * Creates or updates an Activity.
*
* @param array $params
- * Associative array of property name/value.
- * pairs for the activity.
- * {@getfields activity_create}
+ * Array per getfields documentation.
*
* @throws API_Exception
* @return array
- * Array containing 'is_error' to denote success or failure and details of the created activity
- *
- * @example ActivityCreate.php Standard create example
- * @example Activity/ContactRefCustomField.php Create example including setting a contact reference custom field
- * {@example ActivityCreate.php 0}
+ * Array containing 'is_error' to denote success or failure and details of the created activity.
*/
function civicrm_api3_activity_create($params) {
}
/**
- * Specify Meta data for create. Note that this data is retrievable via the getfields function
- * and is used for pre-filling defaults and ensuring mandatory requirements are met.
+ * Specify Meta data for create.
+ *
+ * Note that this data is retrievable via the getfields function and is used for pre-filling defaults and
+ * ensuring mandatory requirements are met.
+ *
* @param array $params
- * (reference) array of parameters determined by getfields.
+ * Array of parameters determined by getfields.
*/
function _civicrm_api3_activity_create_spec(&$params) {
- //default for source_contact_id = currently logged in user
+ // Default for source_contact_id = currently logged in user.
$params['source_contact_id']['api.default'] = 'user_contact_id';
$params['status_id']['api.aliases'] = array('activity_status');
}
/**
- * Gets a CiviCRM activity according to parameters
+ * Gets a CiviCRM activity according to parameters.
*
* @param array $params
- * Associative array of property name/value.
- * pairs for the activity.
+ * Array per getfields documentation.
*
* @return array
- *
- * {@getfields activity_get}
- * @example ActivityGet.php Basic example
- * @example Activity/DateTimeHigh.php Example get with date filtering
- * {@example ActivityGet.php 0}
*/
function civicrm_api3_activity_get($params) {
if (!empty($params['contact_id'])) {
$activities = CRM_Activity_BAO_Activity::getContactActivity($params['contact_id']);
- //BAO function doesn't actually return a contact ID - hack api for now & add to test so when api re-write happens it won't get missed
+ // BAO function doesn't actually return a contact ID - hack api for now & add to test so when api re-write
+ // happens it won't get missed.
foreach ($activities as $key => $activityArray) {
$activities[$key]['id'] = $key;
}
}
/**
- * Given a list of activities, append any extra data requested about the activities
+ * Given a list of activities, append any extra data requested about the activities.
*
* NOTE: Called by civicrm-core and CiviHR
*
* @param array $params
* API request parameters.
* @param array $activities
+ *
* @return array
* new activities list
*/
*
* @param array $params
* Array holding 'id' of activity to be deleted.
- * {@getfields activity_delete}
*
* @throws API_Exception
- * @return void|CRM_Core_Error An error if 'activityName or ID' is invalid,
- * permissions are insufficient, etc. or CiviCRM success array
- *
- *
- *
- * @example ActivityDelete.php Standard Delete Example
*
+ * @return array
*/
function civicrm_api3_activity_delete($params) {
}
/**
- * Check for required params
+ * Check for required params.
*
* @param array $params
* Associated array of fields.
FROM civicrm_contact
WHERE id IN (' . implode(', ', $contactIds) . ' )';
if (count($contactIds) != CRM_Core_DAO::singleValueQuery($sql)) {
- throw new API_Exception('Invalid ' . ' Contact Id');
+ throw new API_Exception('Invalid Contact Id');
}
}
}
/**
+ * Get parameters for activity list.
+ *
* @see _civicrm_api3_generic_getlist_params
*
* @param array $request
}
/**
+ * Get output for activity list.
+ *
* @see _civicrm_api3_generic_getlist_output
*
* @param array $result
*/
/**
- * Add a record relating a contact with an activity
- *
- * Allowed @params array keys are:
- *
- * @example ActivityContact.php
+ * Add a record relating a contact with an activity.
*
* @param array $params
*
* @return array
- * Array of newly created activity contact records.
+ * API result array.
*/
function civicrm_api3_activity_contact_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
/**
- * Deletes an existing ActivityContact record
+ * Delete an existing ActivityContact record.
*
* @param array $params
*
* @return array
* Api Result
- *
- * @example ActivityContact.php
*/
function civicrm_api3_activity_contact_delete($params) {
return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
/**
* Get a ActivityContact.
*
- * @example ActivityContact.php
- *
* @param array $params
* An associative array of name/value pairs.
*
* @return array
* details of found tags else error
- *
*/
function civicrm_api3_activity_contact_get($params) {
return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
*
* @copyright CiviCRM LLC (c) 2004-2014
* $Id: ActivityType.php 30171 2010-10-14 09:11:27Z mover $
- *
*/
/**
+ * Notification of deprecated function.
+ *
* @deprecated api notice
* @return string
* to indicate this entire api entity is deprecated
}
/**
- * retrieve activity types
+ * Retrieve activity types.
*
* @param array $params
*
}
/**
- * create activity type (
+ * Create activity type.
*
* @param array $params
*
}
/**
- * delete activity type
+ * Delete activity type.
*
* @param array $params
* Array including id of activity_type to delete.
-
+ *
* @return array
* API result array
*
*/
/**
- * Add an Address for a contact
- *
- * Allowed @params array keys are:
- * {@getfields address_create}
- * {@example AddressCreate.php}
+ * Add an Address for a contact.
*
* @param array $params
+ * Array per getfields metadata.
*
* @return array
* Array of newly created tag property values.
);
}
/**
- * Adjust Metadata for Get action
+ * Adjust Metadata for Get action.
*
* @param array $params
- * Array or parameters determined by getfields.
+ * Array of parameters determined by getfields.
*/
function _civicrm_api3_address_get_spec(&$params) {
$params['world_region'] = array(
}
/**
- * Deletes an existing Address
+ * Delete an existing Address.
*
* @param array $params
- *
- * {@getfields address_delete}
- * {@example AddressDelete.php 0}
+ * Array per getfields metadata.
*
* @return array
* api result array
}
/**
- * Retrieve one or more addresses on address_id, contact_id, street_name, city
- * or a combination of those
+ * Retrieve one or more addresses.
*
* @param array $params
- * An associative array of name/value pairs.
+ * Array per getfields metadata.
*
* @return array
* details of found addresses else error
* @subpackage API_Attachment
* @copyright CiviCRM LLC (c) 2004-2014
* $Id: $
- *
*/
/**
- * Adjust metadata for "create" action
+ * Adjust metadata for "create" action.
*
* @param array $spec
* List of fields.
}
/**
- * Create an attachment
+ * Create an attachment.
*
* @param array $params
+ *
* @return array
* Array of newly created file property values.
* @throws API_Exception validation errors
}
/**
- * Adjust metadata for "create" action
+ * Adjust metadata for get action.
*
* @param array $spec
* List of fields.
}
/**
+ * Get attachment.
+ *
* @param array $params
+ *
* @return array
* per APIv3
* @throws API_Exception validation errors
}
/**
+ * Adjust metadata for attachment delete action.
+ *
* @param $spec
*/
function _civicrm_api3_attachment_delete_spec(&$spec) {
}
/**
+ * Delete attachment.
+ *
* @param array $params
+ *
* @return array
* @throws API_Exception
*/
}
/**
+ * Attachment find helper.
+ *
* @param array $params
* @param int|null $id the user-supplied ID of the attachment record
* @param array $file
* @param array $entityFile
* The user-supplied values of the entity-file (entity_table, entity_id).
* @param bool $isTrusted
+ *
* @return CRM_Core_DAO
* @throws API_Exception
*/
if ($id) {
$select->where('cf.id = #id', array('#id' => $id));
}
- // recall: $file is filtered by parse_params
+ // Recall: $file is filtered by parse_params.
foreach ($file as $key => $value) {
$select->where('cf.!field = @value', array(
'!field' => $key,
'@value' => $value,
));
}
- // recall: $entityFile is filtered by parse_params
+ // Recall: $entityFile is filtered by parse_params.
foreach ($entityFile as $key => $value) {
$select->where('cef.!field = @value', array(
'!field' => $key,
}
/**
+ * Attachment parsing helper.
+ *
* @param array $params
- * @return array (0 => int $id, 1 => array $file, 2 => array $entityFile, 3 => string $name, 4 => string $content,
+ *
+ * @return array
+ * (0 => int $id, 1 => array $file, 2 => array $entityFile, 3 => string $name, 4 => string $content,
* 5 => string $moveFile, 6 => $isTrusted, 7 => bool $returnContent)
* - array $file: whitelisted fields that can pass through directly to civicrm_file
* - array $entityFile: whitelisted fields that can pass through directly to civicrm_entity_file
}
/**
+ * Attachment result formatting helper.
+ *
* @param CRM_Core_DAO_File $fileDao
* Maybe "File" or "File JOIN EntityFile".
* @param CRM_Core_DAO_EntityFile $entityFileDao
* Whether to return the full content of the file.
* @param bool $isTrusted
* Whether the current request is trusted to perform file-specific operations.
+ *
* @return array
*/
function _civicrm_api3_attachment_format_result($fileDao, $entityFileDao, $returnContent, $isTrusted) {
}
/**
+ * Attachment getfields helper.
+ *
* @return array
* list of fields (indexed by name)
*/
$spec['description'] = $fileFields['description'];
$spec['upload_date'] = $fileFields['upload_date'];
$spec['entity_table'] = $entityFileFields['entity_table'];
- $spec['entity_table']['title'] = CRM_Utils_Array::value('title', $spec['entity_table'], 'Entity Table') . ' (write-once)'; // would be hard to securely handle changes
+ // Would be hard to securely handle changes.
+ $spec['entity_table']['title'] = CRM_Utils_Array::value('title', $spec['entity_table'], 'Entity Table') . ' (write-once)';
$spec['entity_id'] = $entityFileFields['entity_id'];
$spec['entity_id']['title'] = CRM_Utils_Array::value('title', $spec['entity_id'], 'Entity ID') . ' (write-once)'; // would be hard to securely handle changes
$spec['url'] = array(
*
* @package CiviCRM_APIv3
* @subpackage API_Batch
- *
*/
/**
- * Save a Batch
- *
- * Allowed @params array keys are:
- * {@getfields batch_create}
- * @example BatchCreate.php
+ * Save a Batch.
*
* @param array $params
*
}
/**
- * Get a Batch
- *
- * Allowed @params array keys are:
- * {@getfields batch_get}
- * @example BatchCreate.php
+ * Get a Batch.
*
* @param array $params
*
}
/**
- * Delete a Batch
- *
- * Allowed @params array keys are:
- * {@getfields batch_delete}
- * @example BatchCreate.php
+ * Delete a Batch.
*
* @param array $params
*
}
/**
- * Returns array of campaigns matching a set of one or more group properties
+ * Returns array of campaigns matching a set of one or more group properties.
*
* @param array $params
* Array per getfields
}
/**
- * delete an existing campaign
+ * Delete an existing campaign.
*
* This method is used to delete any existing campaign. id of the group
* to be deleted is required field in $params array
}
/**
- * Deprecated. Use activity API instead
+ * Deprecated API.
+ *
+ * Use activity API instead.
*
* @param array $params
*
}
/**
+ * Declare deprecated api functions.
+ *
* @deprecated api notice
* @return array
* Array of deprecated actions
}
/**
- * Internal function to format create params for processing
+ * Internal function to format create params for processing.
*
* @param array $params
*/
if (!$params['case_type_id']) {
$caseTypeLabels = CRM_Case_PseudoConstant::caseType('title', FALSE);
$params['case_type_id'] = array_search($params['case_type'], $caseTypeLabels);
- $params['case_type'] = $caseTypes[$params['case_type_id']]; // label => name
+ $params['case_type'] = $caseTypes[$params['case_type_id']];
}
}
elseif (empty($params['case_type'])) {
* @package CiviCRM_APIv3
* @subpackage API_Case
* @copyright CiviCRM LLC (c) 2004-2014
- *
*/
/**
- * create or update case type
+ * Create or update case type.
*
* @param array $params
* Input parameters.
*
- * Allowed @params array keys are:
- * {@getfields case_type_create}
- *
* @throws API_Exception
* @return array
* API result array
- *
*/
function civicrm_api3_case_type_create($params) {
civicrm_api3_verify_mandatory($params, _civicrm_api3_get_DAO(__FUNCTION__));
- unset($params['is_forkable']); // computed property
- unset($params['is_forked']); // computed property
+ // Computed properties.
+ unset($params['is_forkable']);
+ unset($params['is_forked']);
if (!array_key_exists('is_active', $params) && empty($params['id'])) {
$params['is_active'] = TRUE;
}
- if (!empty($params['id']) // this is an existing case-type
+ // This is an existing case-type.
+ if (!empty($params['id'])
&& !CRM_Case_BAO_CaseType::isForked($params['id']) // which is not yet forked
&& !CRM_Case_BAO_CaseType::isForkable($params['id']) // for which new forks are prohibited
) {
}
/**
- * retrieve case types
+ * Retrieve case types.
*
* @param array $params
*
}
/**
- * format definition
+ * Format definition.
*
* @param array $result
+ *
* @return array
* @throws \CRM_Core_Exception
*/
}
/**
- * Function to delete case type
+ * Function to delete case type.
*
* @param array $params
* Array including id of case_type to delete.
*/
/**
+ * Declare deprecated api entity.
+ *
* @deprecated api notice
* @return string
* to indicate this entire api entity is deprecated
}
/**
+ * Get constant values (deprecated).
+ *
* @deprecated as of CiviCRM 4.4.
* It's recommended to use the api getoptions action instead
*
* <li>worldRegion</li>
* <li>wysiwygEditor</li>
* </ul>
+ *
* @return array
- * @example ConstantGet.php
- * {@getfields constant_get}
*/
function civicrm_api3_constant_get($params) {
}
/**
+ * Adjust metadata for constant get action.
+ *
* @param array $params
*/
function _civicrm_api3_constant_get_spec(&$params) {
* @subpackage API_Contact
* @copyright CiviCRM LLC (c) 2004-2014
* $Id: Contact.php 30879 2010-11-22 15:45:55Z shot $
- *
*/
/**
- * Create or update a contact (note you should always call this via civicrm_api() & never directly)
+ * Create or update a contact (note you should always call this via civicrm_api() & never directly).
*
* @param array $params
* Input parameters.
*
- * Allowed @params array keys are:
- * {@getfields contact_create}
- *
- *
* @throws API_Exception
- * @example ContactCreate.php Example of Create Call
*
* @return array
* API Result Array
- *
*/
function civicrm_api3_contact_create($params) {
}
/**
- * Retrieve one or more contacts, given a set of search params
+ * Retrieve one or more contacts, given a set of search params.
+ *
+ * @param array $params
*
* @return array
* API Result Array
}
/**
+ * Get count of contact.
+ *
* @param array $params
*
* @return int
}
/**
- * Adjust Metadata for Get action
+ * Adjust Metadata for Get action.
*
* @param array $params
* Array or parameters determined by getfields.
function _civicrm_api3_contact_get_spec(&$params) {
$params['contact_is_deleted']['api.default'] = 0;
- //we declare all these pseudofields as there are other undocumented fields accessible
+ // We declare all these pseudoFields as there are other undocumented fields accessible
// via the api - but if check permissions is set we only allow declared fields
$params['address_id']['title'] = 'Primary Address ID';
$params['street_address']['title'] = 'Primary Address Street Address';
}
/**
+ * Support for historical oddities.
+ *
* We are supporting 'showAll' = 'all', 'trash' or 'active' for contact get
* and for getcount
* - hopefully some day we'll come up with a std syntax for the 3-way-boolean of
}
/**
- * Delete a contact with given contact id
+ * Delete a contact with given contact id.
*
* @param array $params
* input parameters per getfields
/**
+ * Check parameters passed in.
+ *
+ * This function is on it's way out.
+ *
* @param array $params
* @param bool $dupeCheck
*
}
/**
- * Takes an associative array and creates a contact object and all the associated
- * derived objects (i.e. individual, location, email, phone etc)
+ * Helper function for contact create.
*
* @param array $params
* (reference ) an assoc array of name/value pairs.
}
/**
- * Validate the addressee or email or postal greetings
+ * Validate the addressee or email or postal greetings.
*
* @param array $params
- * Associative array of property name/value.
- * pairs to insert in new contact.
+ * Array per getfields metadata.
*
* @throws API_Exception
- *
*/
function _civicrm_api3_greeting_format_params($params) {
$greetingParams = array('', '_id', '_custom');
}
$formatParams = FALSE;
- // unset display value from params.
+ // Unset display value from params.
if (isset($params["{$key}{$greeting}_display"])) {
unset($params["{$key}{$greeting}_display"]);
}
}
/**
- * Old contact quick search api
+ * Old contact quick search api.
*
* @deprecated
*
- * {@example ContactGetquick.php 0}
* @param array $params
+ *
* @return array
* @throws \API_Exception
*/
}
/**
+ * Declare deprecated api functions.
+ *
* @deprecated api notice
* @return array
* Array of deprecated actions
*
* @return array
* API Result Array
- *
*/
function civicrm_api3_contact_merge($params) {
$mode = CRM_Utils_Array::value('mode', $params, 'safe');
}
/**
+ * Adjust metadata for contact_proximity api function.
+ *
* @param array $params
*/
function _civicrm_api3_contact_proximity_spec(&$params) {
}
/**
+ * Get contacts by proximity.
+ *
* @param array $params
*
* @return array
/**
+ * Get parameters for getlist function.
+ *
* @see _civicrm_api3_generic_getlist_params
*
* @param array $request
}
/**
+ * Get output for getlist function.
+ *
* @see _civicrm_api3_generic_getlist_output
*
* @param array $result
function _civicrm_api3_contact_getlist_output($result, $request) {
$output = array();
if (!empty($result['values'])) {
- $addressFields = array_intersect(array('street_address', 'city', 'state_province', 'country'), $request['params']['return']);
+ $addressFields = array_intersect(array(
+ 'street_address',
+ 'city',
+ 'state_province',
+ 'country',
+ ),
+ $request['params']['return']);
foreach ($result['values'] as $row) {
$data = array(
'id' => $row[$request['id_field']],
*/
/**
- * create/update contact_type
+ * Create/update contact_type.
*
* This API is used to create new contact_type or update any of the existing
* In case of updating existing contact_type, id of that particular contact_type must
* be in $params array.
*
* @param array $params
- * (reference) Associative array of property.
- * name/value pairs to insert in new 'contact_type'
+ * Array per getfields metadata.
*
* @return array
* contact_type array
- *
*/
function civicrm_api3_contact_type_create($params) {
civicrm_api3_verify_mandatory($params, _civicrm_api3_get_DAO(__FUNCTION__), array('name', 'parent_id'));
}
/**
- * Returns array of contact_types matching a set of one or more group properties
+ * Returns array of contact_types matching a set of one or more group properties.
*
* @param array $params
* One or more valid.
}
/**
- * delete an existing contact_type
+ * Delete an existing contact_type.
*
* This method is used to delete any existing contact_type. id of the group
* to be deleted is required field in $params array
*
* @return array
* API Result Array
- *
*/
function civicrm_api3_contact_type_delete($params) {
return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
*
* @copyright CiviCRM LLC (c) 2004-2014
* @version $Id: Contribution.php 30486 2010-11-02 16:12:09Z shot $
- *
*/
/**
- * Add or update a contribution
+ * Add or update a contribution.
*
* @param array $params
- * (reference ) input parameters.
+ * Input parameters.
*
* @throws API_Exception
* @return array
_civicrm_api3_contribution_create_legacy_support_45($params);
- // make sure tax calculation is handled via api
+ // Make sure tax calculation is handled via api.
$params = CRM_Contribute_BAO_Contribution::checkTaxAmount($params);
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Contribution');
}
/**
- * Support for schema changes made in 4.5
+ * Support for schema changes made in 4.5.
+ *
* The main purpose of the API is to provide integrators a level of stability not provided by
* the core code or schema - this means we have to provide support for api calls (where possible)
* across schema changes.
+ *
* @param array $params
*/
function _civicrm_api3_contribution_create_legacy_support_45(&$params) {
}
/**
- * Delete a contribution
+ * Delete a contribution.
*
* @param array $params
- * (reference ) input parameters.
+ * Input parameters.
*
- * @return bool
- * true if success, else false
+ * @return array
*/
function civicrm_api3_contribution_delete($params) {
}
/**
- * modify metadata. Legacy support for contribution_id
+ * Modify metadata for delete action.
+ *
+ * Legacy support for contribution_id.
+ *
* @param array $params
*/
function _civicrm_api3_contribution_delete_spec(&$params) {
}
/**
- * Retrieve a set of contributions, given a set of input params
+ * Retrieve a set of contributions.
*
* @param array $params
- * (reference ) input parameters.
+ * Input parameters.
*
* @return array
* Array of contributions, if error an array with an error id and error message
}
/**
- * This function is used to format the soft credit for backward compatibility
- * as of v4.4 we support multiple soft credit, so now contribution returns array with 'soft_credit' as key
+ * This function is used to format the soft credit for backward compatibility.
+ *
+ * As of v4.4 we support multiple soft credit, so now contribution returns array with 'soft_credit' as key
* but we still return first soft credit as a part of contribution array
+ *
* @param $contribution
*/
function _civicrm_api3_format_soft_credit(&$contribution) {
}
/**
- * Adjust Metadata for Get action
+ * Adjust Metadata for Get action.
*
* The metadata is used for setting defaults, documentation & validation.
*
}
/**
- * take the input parameter list as specified in the data model and
- * convert it into the same format that we use in QF and BAO object
+ * Legacy handling for contribution parameters.
+ *
+ * Take the input parameter list as specified in the data model and
+ * convert it into the same format that we use in QF and BAO object.
*
* @param array $params
* property name/value pairs to insert in new contact.
}
/**
- * Adjust Metadata for Transact action
+ * Adjust Metadata for Transact action.
*
* The metadata is used for setting defaults, documentation & validation.
*
* Process a transaction and record it against the contact.
*
* @param array $params
- * (reference ) input parameters.
+ * Input parameters.
*
* @return array
* contribution of created or updated record (or a civicrm error)
}
/**
- * Send a contribution confirmation (receipt or invoice)
+ * Send a contribution confirmation (receipt or invoice).
+ *
* The appropriate online template will be used (the existence of related objects
* (e.g. memberships ) will affect this selection
*
* Input parameters.
*
* @throws Exception
- * Api result array.
*/
function civicrm_api3_contribution_sendconfirmation($params) {
$contribution = new CRM_Contribute_BAO_Contribution();
}
/**
- * Adjust Metadata for sendconfirmation action
+ * Adjust Metadata for sendconfirmation action.
*
* The metadata is used for setting defaults, documentation & validation.
*
}
/**
- * Complete an existing (pending) transaction, updating related entities (participant, membership, pledge etc)
- * and taking any complete actions from the contribution page (e.g. send receipt)
+ * Complete an existing (pending) transaction.
+ *
+ * This will update related entities (participant, membership, pledge etc)
+ * and take any complete actions from the contribution page (e.g. send receipt).
*
* @todo - most of this should live in the BAO layer but as we want it to be an addition
* to 4.3 which is already stable we should add it to the api layer & re-factor into the BAO layer later
*
* @param array $params
* Input parameters.
- * {@getfields Contribution_completetransaction}
*
* @throws API_Exception
* Api result array.
}
/**
- * provide function metadata
+ * Provide function metadata.
+ *
* @param array $params
*/
function _civicrm_api3_contribution_completetransaction_spec(&$params) {
*/
/**
- * Create or update a contribution_page
+ * Create or update a contribution_page.
*
* @param array $params
- * Associative array of property.
- * name/value pairs to insert in new 'contribution_page'
- * @example ContributionPageCreate.php Std Create example
+ * Array per getfields metadata.
*
* @return array
* api result array
- * {@getfields contribution_page_create}
*/
function civicrm_api3_contribution_page_create($params) {
$result = _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
* The metadata is used for setting defaults, documentation & validation.
*
* @param array $params
- * Array or parameters determined by getfields.
+ * Array per getfields metadata.
*/
function _civicrm_api3_contribution_page_create_spec(&$params) {
$params['financial_type_id']['api.required'] = 1;
}
/**
- * Returns array of contribution_pages matching a set of one or more group properties
+ * Returns array of contribution_pages matching a set of one or more group properties.
*
* @param array $params
- * Array of one or more valid property_name=>value pairs.
+ * Array per getfields metadata.
*
* @return array
* API Result array Array of matching contribution_pages
- * {@getfields contribution_page_get}
*/
function civicrm_api3_contribution_page_get($params) {
return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
/**
- * delete an existing contribution_page
+ * Delete an existing contribution_page.
*
* This method is used to delete any existing contribution_page. id of the group
* to be deleted is required field in $params array
*
* @param array $params
- * Array containing id of the group.
- * to be deleted
+ * Array per getfields metadata.
*
* @return array
* API result Array
- * {@getfields contribution_page_delete}
*/
function civicrm_api3_contribution_page_delete($params) {
return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
/**
- * delete an existing contribution_page
- *
- * This method is used to delete any existing contribution_page. id of the group
- * to be deleted is required field in $params array
+ * Submit a contribution_page.
*
* @param array $params
- * (reference) array containing id of the group.
- * to be deleted
+ * Array per getfields metadata.
*
* @return array
* API result array
- * {@getfields contribution_page_delete}
*/
function civicrm_api3_contribution_page_submit($params) {
$result = CRM_Contribute_Form_Contribution_Confirm::submit($params);
*/
/**
- * Create or update a contribution_recur
+ * Create or update a contribution_recur.
*
* @param array $params
- * Associative array of property.
- * name/value pairs to insert in new 'contribution_recur'
- * @example ContributionRecurCreate.php Std Create example
+ * Array per getfields metadata.
*
* @return array
* api result array
}
/**
- * Returns array of contribution_recurs matching a set of one or more group properties
+ * Returns array of contribution_recurs matching a set of one or more group properties.
*
* @param array $params
* Array of one or more valid.
}
/**
- * Cancel a recurring contribution of existing contribution_recur.id
+ * Cancel a recurring contribution of existing contribution_recur.id.
*
* @param array $params
- * (reference) array containing id of the recurring contribution.
+ * Array containing id of the recurring contribution.
*
* @return bool
* returns true is successfully cancelled
}
/**
- * delete an existing contribution_recur
+ * Delete an existing contribution_recur.
*
* This method is used to delete any existing contribution_recur. id of the group
* to be deleted is required field in $params array
<?php
-// $Id$
-
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.6 |
*/
/**
- * File for the CiviCRM APIv3 soft credit functions
+ * File for the CiviCRM APIv3 soft credit functions.
*
* @package CiviCRM_APIv3
* @subpackage API_ContributionSoft
*/
/**
- * Create or Update a Soft Credit
+ * Create or Update a Soft Credit.
*
* @param array $params
- * Associative array of property.
- * name/value pairs to insert in new 'contribution_soft'
- *
- * @example ContributionSoftCreate.php Standard Create Example //FIXME
+ * Array per getfields metadata.
*
- * @return array API result array {@getfields contribution_soft_create}
+ * @return array
+ * API result array
*/
function civicrm_api3_contribution_soft_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
/**
- * Deletes an existing Soft Credit
+ * Deletes an existing Soft Credit.
*
* @param array $params
- *
- * @example ContributionSoftDelete.php Standard Delete Example
- * {@getfields contribution_soft_delete}
*/
function civicrm_api3_contribution_soft_delete($params) {
- // non standard BAO - we have to write custom code to cope
+ // Non standard BAO - we have to write custom code to cope.
CRM_Contribute_BAO_ContributionSoft::del(array('id' => $params['id']));
}
/**
- * Retrieve one or more Soft Credits
+ * Retrieve one or more Soft Credits.
*
- * @example ContributionSoftGet.php Standard Get Example
- *
- * @param array $params An associative array of name/value pairs.
+ * @param array $params
+ * Array per getfields metadata.
*
- * @return array api result {@getfields contribution_soft_get}
+ * @return array
+ * API result
*/
function civicrm_api3_contribution_soft_get($params) {
return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
* @version $Id: Country.php 2011-02-16 ErikHommel $
*/
-require_once 'CRM/Core/DAO/Country.php';
-
/**
- * Add an Country for a contact
- *
- * Allowed @params array keys are:
- *
- * @example CountryCreate.php Standard Create Example
+ * Add an Country for a contact.
*
* @param array $params
+ * Array per getfields metadata.
+ *
* @return array
* API result array
* @throws \API_Exception
}
/**
- * Deletes an existing Country
+ * Deletes an existing Country.
*
* @param array $params
*
- * @example CountryDelete.php Standard Delete Example
- *
- * @return bool
- * | error true if successfull, error otherwise
- * {@getfields country_delete}
+ * @return array
*/
function civicrm_api3_country_delete($params) {
return _civicrm_api3_basic_delete(_civicrm_api3_get_DAO(__FUNCTION__), $params);
}
/**
- * Retrieve one or more countrys
- *
- * @example CountryGet.php Standard Get Example
+ * Retrieve one or more countryies.
*
* @param array $params
- * An associative array of name/value pairs.
+ * Array per getfields metadata.
*
* @return array
* api result array
- * {@getfields country_get}
*/
function civicrm_api3_country_get($params) {
/**
* Create a 'custom field' within a custom field group.
+ *
* We also empty the static var in the getfields
* function after deletion so that the field is available for us (getfields manages date conversion
* among other things
*
* @param array $params
- * Array Associative array of property name/value pairs to create new custom field.
+ * Array per getfields metadata.
*
* @return array
* API success array
*/
function civicrm_api3_custom_field_create($params) {
- // Array created for passing options in params
+ // Array created for passing options in params.
if (isset($params['option_values']) && is_array($params['option_values'])) {
foreach ($params['option_values'] as $key => $value) {
$params['option_label'][$key] = $value['label'];
}
/**
- * Flush static caches in functions that might have stored available custom fields
+ * Flush static caches in functions that might have stored available custom fields.
*/
function _civicrm_api3_custom_field_flush_static_caches() {
civicrm_api('custom_field', 'getfields', array('version' => 3, 'cache_clear' => 1));
}
/**
- * Helper function to validate custom field value
+ * Helper function to validate custom field value.
+ *
* @deprecated
*
* @param string $fieldName
}
/**
- * CRM-15191 - Hack to ensure the cache gets cleared after updating a custom field
+ * CRM-15191 - Hack to ensure the cache gets cleared after updating a custom field.
+ *
* @param array $params
+ * Array per getfields metadata.
+ *
* @return array
*/
function civicrm_api3_custom_field_setvalue($params) {
*/
/**
- * Most API functions take in associative arrays ( name => value pairs
- * as parameters. Some of the most commonly used parameters are
- * described below
+ * Use this API to create a new group.
*
- * @param array $params
- * An associative array used in construction.
- * retrieval of the object
- * @todo missing get function
- *
- *
- */
-
-/**
- * Use this API to create a new group. The 'extends' value accepts an array or a comma separated string.
+ * The 'extends' value accepts an array or a comma separated string.
* e.g array(
- 'Individual','Contact') or 'Individual,Contact'
+ * 'Individual','Contact') or 'Individual,Contact'
* See the CRM Data Model for custom_group property definitions
* $params['class_name'] is a required field, class being extended.
*
* @param array $params
- * Array Associative array of property name/value pairs to insert in group.
- * {@getfields CustomGroup_create}
+ * Array per getfields metadata.
*
* @return array
* @todo $params['extends'] is array format - is that std compatible
}
/**
- * Use this API to get existing custom fields.
+ * API to get existing custom fields.
*
* @param array $params
- * Array to search on.
+ * Array per getfields metadata.
*
* @return array
*/
}
/**
- * CRM-15191 - Hack to ensure the cache gets cleared after updating a custom group
+ * CRM-15191 - Hack to ensure the cache gets cleared after updating a custom group.
+ *
* @param array $params
+ * Array per getfields metadata.
+ *
* @return array
*/
function civicrm_api3_custom_group_setvalue($params) {
<?php
/**
- * Retrieve a CustomSearches
+ * Retrieve custom searches.
*
* FIXME This is a bare-minimum placeholder
*
* @param array $params
*
- * {@example OptionValueGet.php 0}
- * @example OptionValueGet.php
- *
* @return array
* details of found Option Values
- * {@getfields OptionValue_get}
*/
function civicrm_api3_custom_search_get($params) {
require_once 'api/v3/OptionValue.php';
}
/**
- * Add a CustomSearch
- *
- * Allowed @params array keys are:
- *
- * {@example OptionValueCreate.php}
+ * Add a CustomSearch.
*
* @param array $params
*
* @return array
* Array of newly created option_value property values.
- * {@getfields OptionValue_create}
*/
function civicrm_api3_custom_search_create($params) {
require_once 'api/v3/OptionValue.php';
}
/**
- * Deletes an existing ReportTemplate
+ * Deletes an existing ReportTemplate.
*
* @param array $params
*
- * {@example ReportTemplateDelete.php 0}
- *
* @return array
* Api result
- * {@getfields ReportTemplate_create}
*/
function civicrm_api3_custom_search_delete($params) {
require_once 'api/v3/OptionValue.php';
* @throws Exception
* @return array
* ['values' => TRUE] or ['is_error' => 1, 'error_message' => 'what went wrong']
- *
*/
function civicrm_api3_custom_value_create($params) {
// @todo it's not clear where the entity_table is used as CRM_Core_BAO_CustomValueTable::setValues($create)
*
* @throws API_Exception
* @return array
- *
- *
*/
function civicrm_api3_custom_value_get($params) {
}
/**
- * Adjust Metadata for Get action
+ * Adjust Metadata for Get action.
*
* The metadata is used for setting defaults, documentation & validation.
*
* @subpackage API_Activity
* @copyright CiviCRM LLC (c) 2004-2014
* @version $Id: Activity.php 30486 2010-11-02 16:12:09Z shot $
- *
*/
}
/**
- * Specify Meta data for create. Note that this data is retrievable via the getfields function
+ * Specify Meta data for create.
+ *
+ * Note that this data is retrievable via the getfields function
* and is used for pre-filling defaults and ensuring mandatory requirements are met.
+ *
* @param array $params
- * (reference) array of parameters determined by getfields.
+ * array of parameters determined by getfields.
*/
function _civicrm_api3_dashboard_create_spec(&$params) {
unset($params['version']);
}
/**
- * Gets a CiviCRM Dashlets according to parameters
+ * Gets a CiviCRM Dashlets according to parameters.
*
* @param array $params
*
* @subpackage API_ActionSchedule
*
* @copyright CiviCRM LLC (c) 2004-2014
- *
*/
/**
- * Creates/Updates a new Dashboard Contact Entry
+ * Creates/Updates a new Dashboard Contact Entry.
*
* @param array $params
*
* @return array
- *
*/
function civicrm_api3_dashboard_contact_create($params) {
if (empty($params['id'])) {
}
/**
- * Gets a CiviCRM Dashlets of Contacts according to parameters
+ * Gets a CiviCRM Dashlets of Contacts according to parameters.
*
* @param array $params
- * Associative array of property name/value.
- * pairs for the activity.
+ * Array per getfields metadata.
*
* @return array
- *
*/
function civicrm_api3_dashboard_contact_get($params) {
return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
/**
+ * Check permissions on contact dashboard retrieval.
+ *
* @param array $params
+ * Array per getfields metadata.
*
* @return array|null
*/
}
/**
- * Delete an existing dashboard-contact
+ * Delete an existing dashboard-contact.
*
* This method is used to delete any existing dashboard-board. the id of the dashboard-contact
* is required field in $params array
*
* @param array $params
+ *
* @return array
* @throws \API_Exception
*/
*
* @copyright CiviCRM LLC (c) 2004-2014
* @version $Id: Domain.php 30171 2010-10-14 09:11:27Z mover $
- *
*/
/**
- * Get CiviCRM domain details
- * {@getfields domain_create}
- * @example DomainGet.php
+ * Get CiviCRM domain details.
+ *
* @param array $params
+ *
* @return array
* @throws \API_Exception
*/
}
/**
- * Adjust Metadata for Get action
+ * Adjust Metadata for Get action.
*
* The metadata is used for setting defaults, documentation & validation.
*
}
/**
- * Create a new domain
+ * Create a new domain.
*
* @param array $params
*
* @return array
- * @example DomainCreate.php
- * {@getfields domain_create}
*/
function civicrm_api3_domain_create($params) {
$params['version'] = $params['domain_version'];
*/
/**
- * Add an Email for a contact
- *
- * Allowed @params array keys are:
- *
- * @example EmailCreate.php Standard Create Example
+ * Add an Email for a contact.
*
* @param array $params
+ * Array per getfields metadata.
*
* @return array
* API result array
}
/**
- * Deletes an existing Email
+ * Deletes an existing Email.
*
* @param array $params
+ * Array per getfields metadata.
*
- * @example EmailDelete.php Standard Delete Example
- *
- * @return bool
- * | error true if successfull, error otherwise
+ * @return array
+ * API result array.
*/
function civicrm_api3_email_delete($params) {
return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
/**
- * Retrieve one or more emails
+ * Retrieve one or more emails.
*
* @param array $params
- * An associative array of name/value pairs.
+ * Array per getfields metadata.
*
* @return array
* api result array
<?php
/**
+ * Get list of deprecated entities.
+ *
* @deprecated api notice
+ *
* @param array $entities
+ *
* @return array
* Array of deprecated api entities
*/
}
/**
- * Placeholder function. This should never be called, as it doesn't have any meaning
+ * Placeholder function.
+ *
+ * This should never be called, as it doesn't have any meaning.
+ *
* @param array $params
+ *
* @return array
*/
function civicrm_api3_entity_create($params) {
}
/**
- * Placeholder function. This should never be called, as it doesn't have any meaning
+ * Placeholder function.
+ *
+ * This should never be called, as it doesn't have any meaning.
+ *
* @param array $params
+ *
* @return array
*/
function civicrm_api3_entity_delete($params) {
}
/**
- * Placeholder function. This should never be called, as it doesn't have any meaning
+ * Placeholder function.
+ *
+ * This should never be called, as it doesn't have any meaning.
+ *
* @param array $params
+ *
* @return array
*/
function civicrm_api3_entity_getfields($params) {
*
* @copyright CiviCRM LLC (c) 2004-2014
* @version $Id: Event.php 30964 2010-11-29 09:41:54Z shot $
- *
*/
/**
- * Create a Event
- *
- * This API is used for creating a Event
+ * Create a Event.
*
* @param array $params
* Input parameters.
- * Allowed @params array keys are:
- * {@getfields event_create}
*
* @return array
* API result Array.
}
/**
- * Support for schema changes made in 4.2
+ * Support for schema changes made in 4.2.
+ *
* The main purpose of the API is to provide integrators a level of stability not provided by
* the core code or schema - this means we have to provide support for api calls (where possible)
* across schema changes.
+ *
* @param array $params
*/
function _civicrm_api3_event_create_legacy_support_42(&$params) {
}
/**
- * Adjust Metadata for Get action
+ * Adjust Metadata for Get action.
*
* The metadata is used for setting defaults, documentation & validation.
*
}
/**
- * Support for schema changes made in 4.2
+ * Support for schema changes made in 4.2.
+ *
* The main purpose of the API is to provide integrators a level of stability not provided by
* the core code or schema - this means we have to provide support for api calls (where possible)
* across schema changes.
- * @param $event
- * @param $event_id
+ *
+ * @param array $event
+ * @param int $event_id
*/
function _civicrm_api3_event_get_legacy_support_42(&$event, $event_id) {
if (!empty($event[$event_id]['payment_processor'])) {
}
/**
- * Deletes an existing event
+ * Delete an existing event.
*
- * This API is used for deleting a event
+ * This API is used for deleting a event.
*
* @param array $params
+ *
* @return array
*/
function civicrm_api3_event_delete($params) {
return CRM_Event_BAO_Event::del($params['id']) ? civicrm_api3_create_success() : civicrm_api3_create_error(ts('Error while deleting event'));
}
-/*
/**
- * add 'is_full' & 'available_seats' to the return array. (this might be better in the BAO)
+ * Add 'is_full' & 'available_seats' to the return array.
+ *
+ * (this might be better in the BAO)
* Default BAO function returns a string if full rather than a Bool - which is more appropriate to a form
*
* @param array $event
* Return array of the event.
* @param int $event_id
* Id of the event to be updated.
- *
- */
-/**
- * @param $event
- * @param int $event_id
*/
function _civicrm_api3_event_getisfull(&$event, $event_id) {
$eventFullResult = CRM_Event_BAO_Participant::eventFull($event_id, 1);
/**
+ * Get event list parameters.
+ *
* @see _civicrm_api3_generic_getlist_params
*
* @param array $request
}
/**
+ * Get event list output.
+ *
* @see _civicrm_api3_generic_getlist_output
*
* @param array $result
$data = array(
'id' => $row[$request['id_field']],
'label' => $row[$request['label_field']],
- 'description' => array(CRM_Core_Pseudoconstant::getLabel('CRM_Event_BAO_Event', 'event_type_id', $row['event_type_id'])),
+ 'description' => array(
+ CRM_Core_Pseudoconstant::getLabel(
+ 'CRM_Event_BAO_Event',
+ 'event_type_id',
+ $row['event_type_id']
+ ),
+ ),
);
if (!empty($row['start_date'])) {
$data['description'][0] .= ': ' . CRM_Utils_Date::customFormat($row['start_date']);
*
* @copyright CiviCRM LLC (c) 2004-2014
* @version $Id$
- *
*/
/**
- * Install an extension
+ * Install an extension.
*
* @param array $params
* Input parameters.
}
/**
- * Upgrade an extension - runs upgrade_N hooks and system.flush
+ * Upgrade an extension - runs upgrade_N hooks and system.flush.
*
* @return array
* API result
}
/**
- * Enable an extension
+ * Enable an extension.
*
* @param array $params
* Input parameters.
}
/**
- * Disable an extension
+ * Disable an extension.
*
* @param array $params
* Input parameters.
*
* @return array
* API result
- * @example ExtensionDisable.php
*/
function civicrm_api3_extension_disable($params) {
$keys = _civicrm_api3_getKeys($params);
}
/**
- * Uninstall an extension
+ * Uninstall an extension.
*
* @param array $params
* Input parameters.
}
/**
- * Download and install an extension
+ * Download and install an extension.
*
* @param array $params
* Input parameters.
}
/**
- * Download and install an extension
+ * Download and install an extension.
*
* @param array $params
* Input parameters.
*
* @return array
* API result
- * @example ExtensionRefresh.php
- *
*/
function civicrm_api3_extension_refresh($params) {
$defaults = array('local' => TRUE, 'remote' => TRUE);
}
/**
- * Get a list of available extensions
+ * Get a list of available extensions.
*
* @param array $params
*
* @return array
* API result
- * @example ExtensionGet.php
*/
function civicrm_api3_extension_get($params) {
$statuses = CRM_Extension_System::singleton()->getManager()->getStatuses();
}
/**
- * Determine the list of extension keys
+ * Determine the list of extension keys.
*
* @param array $params
* API request params with 'key' or 'keys'.
+ *
* @return array
* Array of extension keys
* @throws API_Exception
* @subpackage API_File
* @copyright CiviCRM LLC (c) 2004-2014
* $Id: $
- *
*/
/**
- * Create a file
- *
- * This API is used for creating a file
+ * Create a file.
*
* @param array $params
- * An associative array of name/value property values of civicrm_file.
+ * Array per getfields metadata.
*
* @return array
* Array of newly created file property values.
}
$fileDAO = new CRM_Core_DAO_File();
- $properties = array('id', 'file_type_id', 'mime_type', 'uri', 'document', 'description', 'upload_date');
+ $properties = array(
+ 'id',
+ 'file_type_id',
+ 'mime_type',
+ 'uri',
+ 'document',
+ 'description',
+ 'upload_date',
+ );
foreach ($properties as $name) {
if (array_key_exists($name, $params)) {
/**
* Get a file.
*
- * This api is used for finding an existing file.
- * Required parameters : id OR file_type_id of a file
- *
* @param array $params
- * An associative array of name/value property values of civicrm_file.
+ * Array per getfields metadata.
*
* @return array
* Array of all found file object property values.
}
/**
- * Update an existing file
- *
- * This api is used for updating an existing file.
- * Required parameters : id of a file
+ * Update an existing file.
*
* @param array $params
+ * Array per getfields metadata.
+ *
* @return array
*/
function civicrm_api3_file_update($params) {
}
/**
- * Deletes an existing file
- *
- * This API is used for deleting a file
- * Required parameters : id of a file
+ * Delete an existing file.
*
* @param array $params
+ * Array per getfields metadata.
*
* @return array
* API result array
*
* @package CiviCRM_APIv3
* @subpackage API_financial_account
- *
*/
/**
- * Save a financial_account
- *
- * Allowed @params array keys are:
- * {@getfields financial_account_create}
- * @example financial_accountCreate.php
+ * Save a financial_account.
*
* @param array $params
*
}
/**
- * Get a financial_account
- *
- * Allowed @params array keys are:
- * {@getfields financial_account_get}
- * @example financial_accountCreate.php
+ * Get a financial_account.
*
* @param array $params
*
}
/**
- * Delete a financial_account
- *
- * Allowed @params array keys are:
- * {@getfields financial_account_delete}
- * @example financial_accountCreate.php
+ * Delete a financial_account.
*
* @param array $params
*
*
* @package CiviCRM_APIv3
* @subpackage API_financial_type
- *
*/
/**
- * Save a financial_type
- *
- * Allowed @params array keys are:
- * {@getfields financial_type_create}
- * @example financial_typeCreate.php
+ * Save a financial_type.
*
* @param array $params
*
}
/**
- * Get a financial_type
- *
- * Allowed @params array keys are:
- * {@getfields financial_type_get}
- * @example financial_typeCreate.php
+ * Get a financial_type.
*
* @param array $params
*
}
/**
- * Delete a financial_type
- *
- * Allowed @params array keys are:
- * {@getfields financial_type_delete}
- * @example financial_typeCreate.php
+ * Delete a financial_type.
*
* @param array $params
*
<?php
/**
- * Get information about fields for a given api request. Getfields information
- * is used for documentation, validation, default setting
+ * Get information about fields for a given api request.
+ *
+ * Getfields information is used for documentation, validation, default setting
* We first query the scheme using the $dao->fields function & then augment
* that information by calling the _spec functions that apply to the relevant function
* Note that we use 'unique' field names as described in the xml/schema files
* - version: string
* - function: callback (mixed)
* - params: array, varies
+ *
* @return array
* API success object
*/
CRM_Utils_PseudoConstant::flushConstant($apiRequest['params']['fieldname']);
}
if (!empty($apiRequest['params']['option_group_id'])) {
- $optionGroupName = civicrm_api('option_group', 'getvalue', array('version' => 3, 'id' => $apiRequest['params']['option_group_id'], 'return' => 'name'));
+ $optionGroupName = civicrm_api('option_group', 'getvalue', array(
+ 'version' => 3,
+ 'id' => $apiRequest['params']['option_group_id'],
+ 'return' => 'name',
+ ));
if (is_string($optionGroupName)) {
CRM_Utils_PseudoConstant::flushConstant(_civicrm_api_get_camel_name($optionGroupName));
}
}
/**
- * API return function to reformat results as count
+ * API return function to reformat results as count.
*
* @param array $apiRequest
* Api request as an array. Keys are.
}
/**
- * API return function to reformat results as single result
+ * API return function to reformat results as single result.
*
* @param array $apiRequest
* Api request as an array. Keys are.
* count of results
*/
function civicrm_api3_generic_getsingle($apiRequest) {
- // so the first entity is always result['values'][0]
+ // So the first entity is always result['values'][0].
$apiRequest['params']['sequential'] = 1;
$result = civicrm_api($apiRequest['entity'], 'get', $apiRequest['params']);
if ($result['is_error'] !== 0) {
}
/**
- * API return function to reformat results as single value
+ * API return function to reformat results as single value.
*
* @param array $apiRequest
* Api request as an array. Keys are.
}
/**
+ * Get count of contact references.
+ *
* @param array $params
*/
function _civicrm_api3_generic_getrefcount_spec(&$params) {
}
/**
- * API to determine if a record is in-use
+ * API to determine if a record is in-use.
*
* @param array $apiRequest
* Api request as an array.
}
/**
- * API wrapper for replace function
+ * API wrapper for replace function.
*
* @param array $apiRequest
* Api request as an array. Keys are.
}
/**
- * API wrapper for getoptions function
+ * API wrapper for getoptions function.
*
* @param array $apiRequest
* Api request as an array.
* Array of results
*/
function civicrm_api3_generic_getoptions($apiRequest) {
- // Resolve aliases
+ // Resolve aliases.
$fieldName = _civicrm_api3_api_resolve_alias($apiRequest['entity'], $apiRequest['params']['field']);
if (!$fieldName) {
return civicrm_api3_create_error("The field '{$apiRequest['params']['field']}' doesn't exist.");
}
/**
+ * Get metadata.
+ *
* Function fills the 'options' array on the metadata returned by getfields if
* 1) the param option 'get_options' is defined - e.g. $params['options']['get_options'] => array('custom_1)
* (this is passed in as the $fieldsToResolve array)
*/
/**
- * create/update grant
- *
- * This API is used to create new grant or update any of the existing
- * In case of updating existing grant, id of that particular grant must
- * be in $params array.
+ * Create/update grant.
*
* @param array $params
- * Associative array of property.
- * name/value pairs to insert in new 'grant'
+ * Array per getfields metadata.
*
* @return array
* grant array
- * {@getfields grant_create}
*/
function civicrm_api3_grant_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Grant');
}
/**
- * Returns array of grants matching a set of one or more group properties
+ * Returns array of grants matching a set of one or more group properties.
*
* @param array $params
- * Array of one or more valid.
- * property_name=>value pairs. If $params is set
- * as null, all grants will be returned
+ * Array per getfields metadata.
*
* @return array
* Array of matching grants
- * {@getfields grant_get}
*/
function civicrm_api3_grant_get($params) {
return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, TRUE, 'Grant');
}
/**
- * delete an existing grant
+ * Delete an existing grant.
*
* This method is used to delete any existing grant. id of the group
* to be deleted is required field in $params array
*
* @param array $params
- * Array containing id of the group.
- * to be deleted
+ * Array per getfields metadata.
*
* @return array
* API Result Array
- * {@getfields grant_delete}
*/
function civicrm_api3_grant_delete($params) {
return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
*/
/**
- * create/update group
- *
- * This API is used to create new group or update any of the existing
- * In case of updating existing group, id of that particular group must
- * be in $params array. Either id or name is required field in the
- * $params array
+ * Create/update group.
*
* @param array $params
* Associative array of property.
*
* @return array
* API result array
- * @example GroupCreate.php
- * {@getfields group_create}
*/
function civicrm_api3_group_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Group');
}
/**
- * Returns array of groups matching a set of one or more group properties
+ * Returns array of groups matching a set of one or more group properties.
*
* @param array $params
* Array of one or more valid.
*
* @return array
* Array of matching groups
- * @example GroupGet.php
- * {@getfields group_get}
*/
function civicrm_api3_group_get($params) {
$options = _civicrm_api3_get_options_from_params($params, TRUE, 'group', 'get');
}
/**
- * delete an existing group
- *
- * This method is used to delete any existing group. id of the group
- * to be deleted is required field in $params array
+ * Delete an existing group.
*
* @param array $params
* Array containing id of the group.
*
* @return array
* API result array
- * @example GroupDelete.php
- * {@getfields group_delete}
- *
*/
function civicrm_api3_group_delete($params) {
*
* @copyright CiviCRM LLC (c) 2004-2014
* @version $Id: GroupContact.php 30171 2010-10-14 09:11:27Z mover $
- *
*/
/**
- * This API will give list of the groups for particular contact
- * Particular status can be sent in params array
+ * This API will give list of the groups for particular contact.
+ *
+ * Particular status can be sent in params array.
+ *
* If no status mentioned in params, by default 'added' will be used
* to fetch the records
*
* @param array $params
* Name value pair of contact information.
- * {@getfields GroupContact_get}
*
* @return array
* list of groups, given contact subsribed to
}
/**
- * Add contact(s) to group(s)
+ * Add contact(s) to group(s).
+ *
* @param array $params
* Input parameters.
*
* "contact_id.1" etc. (optional) : another contact to add<br>
* "group_id.1" etc. (optional) : additional group to add contact(s) to<br>
* "status" (optional) : one of "Added", "Pending" or "Removed" (default is "Added")
- * {@example GroupContactCreate.php 0}
*
* @return array
* Information about operation results
}
/**
+ * Delete group contact record.
*
* @param array $params
*
* @return array
- * <type>
+ *
* @deprecated
*/
function civicrm_api3_group_contact_delete($params) {
}
/**
- * modify metadata
+ * Adjust metadata.
+ *
* @param array $params
*/
function _civicrm_api3_group_contact_delete_spec(&$params) {
}
/**
+ * Get pending group contacts.
*
* @param array $params
*
}
/**
+ * Group contact helper function.
*
* @param array $params
* @param string $op
}
/**
+ * Update group contact status.
+ *
* @deprecated - this should be part of create but need to know we aren't missing something
+ *
* @param array $params
+ *
* @return bool
* @throws \API_Exception
*/
}
/**
+ * Deprecated function notices.
+ *
* @deprecated api notice
* @return array
* Array of deprecated actions
*
* @copyright CiviCRM LLC (c) 2004-2014
* @version $Id: GroupNesting.php 21624 2009-08-07 22:02:55Z wmorgan $
- *
*/
/**
*
* @param array $params
* An array containing at least child_group_id or parent_group_id.
- * {@getfields GroupNesting_get}
*
* @return array
* list of group nesting records
/**
* Creates group nesting record for given parent and child id.
+ *
* Parent and child groups need to exist.
*
* @param array $params
*
* @copyright CiviCRM LLC (c) 2004-2014
* @version $Id: GroupContact.php 21624 2009-06-04 22:02:55Z mover $
- *
*/
/**
- * This API will give list of the groups for particular contact
- * Particualr status can be sent in params array
- * If no status mentioned in params, by default 'added' will be used
- * to fetch the records
+ * Get group organization record/s.
*
* @param array $params
* Name value pair of contact information.
- * {@getfields GroupOrganization_get}
- * @example GroupOrganizationGet.php
*
* @return array
- * list of groups, given contact subsribed to
+ * list of groups, given contact subscribed to
*/
function civicrm_api3_group_organization_get($params) {
return _civicrm_api3_basic_get('CRM_Contact_DAO_GroupOrganization', $params);
}
/**
- * @example GroupOrganizationCreate.php
- * {@getfields GroupOrganization_create}
+ * Create group organization record.
*
* @param array $params
* Array.
*
* @return array
- *
*/
function civicrm_api3_group_organization_create($params) {
}
/**
- * Deletes an existing Group Organization
+ * Deletes an existing Group Organization.
*
* This API is used for deleting a Group Organization
*
*
* @return array
* API Result
- * {@getfields GroupOrganization_delete}
- * @example GroupOrganizationDelete.php
*/
function civicrm_api3_group_organization_delete($params) {
* API Result Array
*/
function civicrm_api3_job_execute($params) {
- // @noinspection PhpUnusedParameterInspection
$facility = new CRM_Core_JobManager();
$facility->execute(FALSE);
- // always creates success - results are handled elsewhere
- return civicrm_api3_create_success();
+ // Always creates success - results are handled elsewhere.
+ return civicrm_api3_create_success(1, $params);
}
/**
}
/**
- * Job to get mail and create activities
+ * Job to get mail and create activities.
*
* @param array $params
*
}
/**
- * Process participant statuses
+ * Process participant statuses.
*
* @param array $params
- * (reference ) input parameters.
+ * Input parameters.
*
* @return array
* array of properties, if error an array with an error id and error message
/**
- * This api checks and updates the status of all membership records for a given domain using the calc_membership_status and
- * update_contact_membership APIs.
+ * This api checks and updates the status of all membership records for a given domain.
+ *
+ * The function uses the calc_membership_status and update_contact_membership APIs.
*
* IMPORTANT:
* Sending renewal reminders has been migrated from this job to the Scheduled Reminders function as of 4.3.
$lock->release();
if ($result['is_error'] == 0) {
- return civicrm_api3_create_success($result['messages']);
+ return civicrm_api3_create_success($result['messages'], $params);
}
else {
return civicrm_api3_create_error($result['messages']);
*
* @return array
* API Result Array
- *
*/
function civicrm_api3_job_process_batch_merge($params) {
$rgid = CRM_Utils_Array::value('rgid', $params);
}
/**
+ * Metadata for batch merge function.
+ *
* @param $params
*/
function _civicrm_api3_job_process_batch_merge_spec(&$params) {
}
/**
- * Runs handlePaymentCron method in the specified payment processor
+ * Runs handlePaymentCron method in the specified payment processor.
*
* @param array $params
* Input parameters.
*
- * Expected @params array keys are:
+ * Expected @params array keys are: INCORRECTLY DOCUMENTED AND SHOULD BE IN THE _spec function
+ * for retrieval via getfields.
* {string 'processor_name' - the name of the payment processor, eg: Sagepay}
- *
*/
function civicrm_api3_job_run_payment_cron($params) {
}
/**
- * This api cleans up all the old session entries and temp tables. We recommend that sites run this on an hourly basis
+ * This api cleans up all the old session entries and temp tables.
+ *
+ * We recommend that sites run this on an hourly basis.
*
* @param array $params
* Sends in various config parameters to decide what needs to be cleaned.
/**
* Set expired relationships to disabled.
- * @param $params
+ *
+ * @param array $params
+ *
* @return array
* @throws \API_Exception
*/
function civicrm_api3_job_disable_expired_relationships($params) {
- /** @noinspection PhpUnusedParameterInspection */
$result = CRM_Contact_BAO_Relationship::disableExpiredRelationships();
if (!$result) {
throw new API_Exception('Failed to disable all expired relationships.');
}
- return civicrm_api3_create_success();
+ return civicrm_api3_create_success(1, $params);
}
/**
- * This api reloads all the smart groups. If the org has a large number of smart groups
- * it is recommended that they use the limit clause to limit the number of smart groups
- * evaluated on a per job basis. Might also help to increase the smartGroupCacheTimeout
- * and use the cache
+ * This api reloads all the smart groups.
+ *
+ * If the org has a large number of smart groups it is recommended that they use the limit clause
+ * to limit the number of smart groups evaluated on a per job basis.
+ *
+ * Might also help to increase the smartGroupCacheTimeout and use the cache.
*
* @param array $params
+ *
* @return array
* @throws \API_Exception
*/
/**
- * File for the CiviCRM APIv3 group functions
+ * File for the CiviCRM APIv3 line item functions
*
* @package CiviCRM_APIv3
* @subpackage API_LineItem
*/
/**
- * Create or update a line_item
+ * Create or update a line_item.
*
* @param array $params
- * Associative array of property.
- * name/value pairs to insert in new 'line_item'
- * @example LineItemCreate.php Std Create example
+ * Array of property name/value pairs to insert in new 'line_item'
*
* @return array
* api result array
}
/**
- * Returns array of line_items matching a set of one or more group properties
+ * Returns array of line_items matching a set of one or more group properties.
*
* @param array $params
* Array of one or more valid property_name=>value pairs. If $params is set.
}
/**
- * delete an existing line_item
+ * Delete an existing line_item.
*
* This method is used to delete any existing line_item. id of the group
* to be deleted is required field in $params array
*/
/**
- * Create or update a loc_block
+ * Create or update a loc_block.
*
* @param array $params
* Associative array of property.
* name/value pairs to insert in new 'loc_block'
- * @example LocBlockCreate.php Std Create example
*
* @return array
- * api result array
- * {@getfields loc_block_create}
+ * API result array.
*/
function civicrm_api3_loc_block_create($params) {
$entities = array();
}
/**
- * Returns array of loc_blocks matching a set of one or more properties
+ * Returns array of loc_blocks matching a set of one or more properties.
*
* @param array $params
* Array of one or more valid property_name=>value pairs. If $params is set.
* as null, all loc_blocks will be returned (default limit is 25)
*
* @return array
- * Array of matching loc_blocks
- * {@getfields loc_block_get}
+ * API result array.
*/
function civicrm_api3_loc_block_get($params) {
$options = _civicrm_api3_get_options_from_params($params);
}
/**
- * delete an existing loc_block
- *
- * This method is used to delete any existing loc_block.
- * id of the record to be deleted is required field in $params array
+ * Delete an existing loc_block.
*
* @param array $params
* Array containing id of the record to be deleted.
*
* @return array
- * API result array
- * {@getfields loc_block_delete}
+ * API result array.
*/
function civicrm_api3_loc_block_delete($params) {
return _civicrm_api3_basic_delete('CRM_Core_DAO_LocBlock', $params);
<?php
/**
- * Functions to inform caller that Location is obsolete and Address, Phone, Email, Website should be used
+ * Function to inform caller that Location is obsolete and Address, Phone, Email, Website should be used.
+ *
* @param array $params
+ *
* @return array
*/
function civicrm_api3_location_create($params) {
}
/**
+ * Function to inform caller that Location is obsolete and Address, Phone, Email, Website should be used.
+ *
* @param array $params
*
* @return array
}
/**
+ * Function to inform caller that Location is obsolete and Address, Phone, Email, Website should be used.
+ *
* @param array $params
*
* @return array
*/
/**
- * Add a Location Type
- *
- * Allowed @params array keys are:
- *
- * @example LocationTypeCreate.php Standard Create Example
+ * Add a Location Type.
*
* @param array $params
*
* @return array
- * API result array
- * {@getfields email_create}
+ * API result array.
*/
function civicrm_api3_location_type_create($params) {
//set display_name equal to name if it's not defined
}
/**
- * Deletes an existing Location Type
+ * Deletes an existing Location Type.
*
* @param array $params
*
- * @example LocationTypeDelete.php Standard Delete Example
- *
* @return array
- * API result array
- * {@getfields LocationType_delete}
+ * API result array.
*/
function civicrm_api3_location_type_delete($params) {
return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
/**
- * Retrieve one or more Location Types
- *
- * @example LocationTypeGet.php Standard Get Example
+ * Retrieve one or more Location Types.
*
* @param array $params
* An associative array of name/value pairs.
*
* @return array
- * api result
- * {@getfields LocationType_get}
+ * API result array.
*/
function civicrm_api3_location_type_get($params) {
return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
*/
/**
- * Create or update a mail_settings
+ * Create or update a mail_settings.
*
* @param array $params
- * Associative array of property.
+ * Array of property.
* name/value pairs to insert in new 'mail_settings'
- * @example mail_settingsCreate.php Std Create example
*
* @return array
- * api result array
- * {@getfields mail_settings_create}
+ * API result array.
*/
function civicrm_api3_mail_settings_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
/**
- * Returns array of mail_settings matching a set of one or more group properties
+ * Returns array of mail_settings matching a set of one or more group properties.
*
* @param array $params
* Array of one or more valid.
* as null, all mail_settings will be returned
*
* @return array
- * Array of matching mail_settings
- * {@getfields mail_settings_get}
+ * API result array.
*/
function civicrm_api3_mail_settings_get($params) {
return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
/**
- * delete an existing mail_settings
- *
- * This method is used to delete any existing mail_settings. id of the group
- * to be deleted is required field in $params array
+ * Delete an existing mail_settings.
*
* @param array $params
* Array containing id of the group.
* to be deleted
*
* @return array
- * api result array
- * {@getfields mail_settings_delete}
+ * API result array.
*/
function civicrm_api3_mail_settings_delete($params) {
return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
* @subpackage API_Mailing
* @copyright CiviCRM LLC (c) 2004-2014
* $Id$
- *
*/
/**
* Handle a create event.
*
* @param array $params
- * @return array API Success Array
+ *
+ * @return array
* API Success Array
* @throws \API_Exception
* @throws \Civi\API\Exception\UnauthorizedException
}
/**
+ * Get mailing token.
+ *
* @param array $params
+ *
* @return array
* @throws \API_Exception
*/
* Handle a get event.
*
* @param array $params
+ *
* @return array
*/
function civicrm_api3_mailing_get($params) {
}
/**
+ * Adjust metadata for mailing submit api function.
+ *
* @param array $spec
*/
function _civicrm_api3_mailing_submit_spec(&$spec) {
}
/**
+ * Mailing submit.
+ *
* @param array $params
+ *
* @return array
* @throws API_Exception
*/
$updateParams = array();
$updateParams['id'] = $params['id'];
- // the BAO will autocreate the job
- $updateParams['api.mailing_job.create'] = 0; // note: exact match to API default
+ // The BAO will auto-create the job - note: exact match to API default.
+ $updateParams['api.mailing_job.create'] = 0;
- // note: we'll pass along scheduling/approval fields, but they may get ignored
- // if we don't have permission
+ // Note: we'll pass along scheduling/approval fields, but they may get ignored
+ // if we don't have permission.
if (isset($params['scheduled_date'])) {
$updateParams['scheduled_date'] = $params['scheduled_date'];
$updateParams['scheduled_id'] = CRM_Core_Session::getLoggedInContactID();
}
/**
- * Adjust Metadata for bounce_spec action
+ * Adjust Metadata for bounce_spec action.
*
* The metadata is used for setting defaults, documentation & validation.
*
}
/**
- * Handle a confirm event
+ * Handle a confirm event.
+ *
* @deprecated
*
* @param array $params
}
/**
+ * Declare deprecated functions.
+ *
* @deprecated api notice
* @return array
* Array of deprecated actions
}
/**
- * Handle a reply event
+ * Handle a reply event.
*
* @param array $params
*
}
/**
- * Adjust Metadata for event_reply action
+ * Adjust Metadata for event_reply action.
*
* The metadata is used for setting defaults, documentation & validation.
*
}
/**
- * Handle a forward event
+ * Handle a forward event.
*
* @param array $params
*
}
/**
- * Adjust Metadata for event_forward action
+ * Adjust Metadata for event_forward action.
*
* The metadata is used for setting defaults, documentation & validation.
*
}
/**
- * Handle a click event
+ * Handle a click event.
*
* @param array $params
*
}
/**
- * Handle an open event
+ * Handle an open event.
*
* @param array $params
*
}
/**
+ * Preview mailing.
+ *
* @param array $params
+ * Array per getfields metadata.
+ *
* @return array
* @throws \API_Exception
*/
}
/**
+ * Adjust metadata for send test function.
+ *
* @param array $spec
*/
function _civicrm_api3_mailing_send_test_spec(&$spec) {
}
/**
+ * Send test mailing.
+ *
* @param array $params
+ *
* @return array
* @throws \API_Exception
* @throws \CiviCRM_API3_Exception
}
/**
- * Adjust Metadata for send_mail action
+ * Adjust Metadata for send_mail action.
*
* The metadata is used for setting defaults, documentation & validation.
*
}
/**
+ * Function which needs to be explained.
+ *
* @param array $params
+ *
* @return array
* @throws \API_Exception
*/
}
/**
- * Fix the reset dates on the email record based on when a mail was last delivered
+ * Fix the reset dates on the email record based on when a mail was last delivered.
+ *
* We only consider mailings that were completed and finished in the last 3 to 7 days
* Both the min and max days can be set via the params
+ *
* @param array $params
+ *
* @return array
*/
function civicrm_api3_mailing_update_email_resetdate($params) {
* @subpackage API_MailingAB
* @copyright CiviCRM LLC (c) 2004-2014
* $Id$
- *
*/
/**
- * Handle a create mailing ab testing
+ * Handle a create mailing ab testing.
*
* @param array $params
*
* Handle a get event.
*
* @param array $params
+ *
* @return array
*/
function civicrm_api3_mailing_a_b_get($params) {
}
/**
- * Adjust Metadata for submit action
+ * Adjust Metadata for submit action.
*
* The metadata is used for setting defaults, documentation & validation.
*
}
/**
- * Send A/B mail to A/B recipients respectively
+ * Send A/B mail to A/B recipients respectively.
*
* @param array $params
+ *
* @return array
* @throws API_Exception
*/
}
/**
- * Adjust Metadata for graph_stats action
+ * Adjust Metadata for graph_stats action.
*
* The metadata is used for setting defaults, documentation & validation.
*
}
/**
- * Send graph detail for A/B tests mail
+ * Send graph detail for A/B tests mail.
*
* @param array $params
+ *
* @return array
* @throws API_Exception
*/
*
* @package CiviCRM_APIv3
* @subpackage API_mailing_component
- *
*/
/**
- * Save a mailing_component
- *
- * Allowed @params array keys are:
- * {@getfields mailing_component_create}
- * @example mailing_componentCreate.php
+ * Save a mailing_component.
*
* @param array $params
*
* @throws API_Exception
* @return array
- * Array of newly created mailing_component property values.
+ * API result array.
*/
function civicrm_api3_mailing_component_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
/**
- * Get a mailing_component
- *
- * Allowed @params array keys are:
- * {@getfields mailing_component_get}
- * @example mailing_componentCreate.php
+ * Get a mailing_component.
*
* @param array $params
*
* @return array
- * Array of retrieved mailing_component property values.
+ * API result array.
*/
function civicrm_api3_mailing_component_get($params) {
return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
/**
- * Delete a mailing_component
- *
- * Allowed @params array keys are:
- * {@getfields mailing_component_delete}
- * @example mailing_componentCreate.php
+ * Delete a mailing_component.
*
* @param array $params
*
* @throws API_Exception
* @return array
- * Array of deleted values.
+ * API result array.
*/
function civicrm_api3_mailing_component_delete($params) {
return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
*
* @copyright CiviCRM LLC (c) 2004-2014
* @version $Id$
- *
*/
/**
- * Get all the mailings and details that a contact was involved with
+ * Get all the mailings and details that a contact was involved with.
*
* @param array $params
* Input parameters - see _spec for details (returned by getfields)
return civicrm_api3_create_success(_civicrm_api3_mailing_contact_getresults($params, FALSE));
}
/**
- * This is a wrapper for the functions that return the results from the 'quasi-entity'
- * mailing contact
+ * This is a wrapper for the functions that return the results from the 'quasi-entity' mailing contact.
+ *
* @param array $params
* @param bool $count
+ *
* @throws Exception
*/
function _civicrm_api3_mailing_contact_getresults($params, $count) {
$count
);
}
+
/**
- * Adjust Metadata for Get action
+ * Adjust Metadata for Get action.
*
* @param array $params
* Array or parameters determined by getfields.
}
/**
+ * Helper function for mailing contact queries.
+ *
* @param int $contactID
* @param $offset
* @param $limit
}
/**
+ * Get delivered mailing contacts.
+ *
* @param int $contactID
* @param $offset
* @param $limit
}
/**
+ * Get bounced mailing contact records.
+ *
* @param int $contactID
* @param $offset
* @param $limit
}
/**
- * Get count of all the mailings that a contact was involved with
+ * Get count of all the mailings that a contact was involved with.
*
* @param array $params
* Input parameters per getfields
* @subpackage API_MailerGroup
* @copyright CiviCRM LLC (c) 2004-2014
* $Id$
- *
*/
/**
- * Handle a confirm event
+ * Handle a confirm event.
*
* @param array $params
- * Associative array of property.
+ * Array of property.
*
* @throws Exception
* @return array
}
/**
+ * Get mailing event queue record.
+ *
* @param array $params
+ *
* @return array
*/
function civicrm_api3_mailing_event_queue_get($params) {
}
/**
+ * Delete mailing event queue record.
+ *
* @param array $params
+ *
* @return array
* @throws \API_Exception
*/
* @subpackage API_MailerGroup
* @copyright CiviCRM LLC (c) 2004-2014
* $Id$
- *
*/
/**
- * Subscribe from mailing group
+ * Subscribe from mailing group.
*
* @param array $params
- * Associative array of property.
- * name/value pairs to insert in new 'survey'
+ * Array per getfields metadata.
*
* @throws API_Exception
* @return array
* api result array
- * {@getfields mailing_event_subscribe_create}
*/
function civicrm_api3_mailing_event_subscribe_create($params) {
$email = $params['email'];
* @subpackage API_MailerGroup
* @copyright CiviCRM LLC (c) 2004-2014
* $Id$
- *
*/
/**
- * Unsubscribe from mailing group
+ * Unsubscribe from mailing group.
*
* @param array $params
- * Associative array of property.
- * name/value pairs to insert in new 'survey'
+ * Array per getfields metadata.
*
- * @return array api result array {@getfields mailing_event_unsubscribe_create}
+ * @return array
+ * Api result array
*/
function civicrm_api3_mailing_event_unsubscribe_create($params) {
* @subpackage API_MailerGroup
* @copyright CiviCRM LLC (c) 2004-2014
* $Id$
- *
*/
/**
+ * Declare deprecated functions.
+ *
* @deprecated api notice
* @return string
* to indicate this entire api entity is deprecated
}
/**
- * Handle an unsubscribe event
+ * Handle an unsubscribe event.
+ *
* @deprecated
*
* @param array $params
}
/**
- * Handle a site-level unsubscribe event
+ * Handle a site-level unsubscribe event.
+ *
* @deprecated
*
* @param array $params
}
/**
- * Handle a resubscription event
+ * Handle a re-subscription event.
+ *
* @deprecated
*
* @param array $params
}
/**
- * Handle a subscription event
+ * Handle a subscription event.
+ *
* @deprecated
*
* @param array $params
}
/**
+ * Create mailing group.
+ *
* @param array $params
+ *
* @return array
* @throws \API_Exception
*/
}
/**
+ * Get mailing group.
+ *
* @param array $params
*
* @return array
}
/**
+ * Delete mailing group.
+ *
* @param array $params
+ *
* @return array
* @throws \API_Exception
*/
}
/**
+ * Get metadata for mailing group functions.
+ *
* @param array $params
+ *
* @return array
*/
function civicrm_api3_mailing_group_getfields($params) {
* @subpackage API_Mailing
* @copyright CiviCRM LLC (c) 2004-2014
* $Id$
- *
*/
/**
* Handle creation of a Mailing Job for a Mailing.
+ *
* @param array $params
+ *
* @return array
* @throws \API_Exception
*/
}
/**
- * Returns array of Mailing Jobs matching a set of one or more group properties
+ * Returns array of Mailing Jobs matching a set of one or more group properties.
*
* @param array $params
* Array of one or more valid.
*
* @return array
* API return Array of matching mailing jobs.
- * {@getfields mailing_job_get}
*/
function civicrm_api3_mailing_job_get($params) {
return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
/**
* Handle deletion of a Mailing Job for a Mailing.
+ *
* @param array $params
+ *
* @return array
* @throws \API_Exception
*/
* @subpackage API_Mailing
* @copyright CiviCRM LLC (c) 2004-2014
* $Id$
- *
*/
/**
- * Returns array of Mailing Recipients
+ * Returns array of Mailing Recipients.
*
* @param array $params
- * Array of one or more valid.
+ * Array per getfields metadata.
*
* @return array
* API return Array of matching mailing jobs
*/
/**
- * Deletes an existing contact membership
- *
- * This API is used for deleting a contact membership
+ * Deletes an existing contact membership.
*
* @param array $params
* Array array holding id - Id of the contact membership to be deleted.
*
* @return array
- * api result
- * {@getfields membership_delete}
+ * API result array.
*/
function civicrm_api3_membership_delete($params) {
return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
/**
- * Create a Contact Membership
+ * Create a Contact Membership.
*
* This API is used for creating a Membership for a contact.
* Required parameters : membership_type_id and status_id.
*
* @param array $params
- * An associative array of name/value property values of civicrm_membership.
+ * Array of name/value property values of civicrm_membership.
*
* @return array
- * Array of newly created membership property values.
- * {@getfields membership_create}
+ * API result array.
*/
function civicrm_api3_membership_create($params) {
// check params for membership id during update
if (!empty($params['id']) && !isset($params['skipStatusCal'])) {
- //don't calculate status on exisiting membership - expect API use to pass them in
- // or leave unchanged
+ // Don't calculate status on existing membership - expect API use to pass them in
+ // or leave unchanged.
$params['skipStatusCal'] = 1;
}
else {
'type' => CRM_Utils_Type::T_INT,
);
}
+
/**
- * Adjust Metadata for Get action
+ * Adjust Metadata for Get action.
*
* The metadata is used for setting defaults, documentation & validation.
*
*/
function _civicrm_api3_membership_get_spec(&$params) {
$params['membership_type_id']['api.aliases'] = array('membership_type');
+ $params['active_only'] = array(
+ 'title' => 'Only retrieve active memberships',
+ 'type' => CRM_Utils_Type::T_BOOLEAN,
+ );
}
/**
}
/**
+ * Perform api v2 custom behaviour.
+ *
* When we copied apiv3 from api v2 we brought across some custom behaviours - in the case of
* membership a complicated return array is constructed. The original
* behaviour made contact_id a required field. We still need to keep this for v3 when contact_id
/**
- * non-standard behaviour inherited from v2
+ * Non-standard behaviour inherited from v2.
*
* @param array $params
* Parameters passed into get function.
$members = $membershipValues;
- // populating contacts in members array based on their relationship with direct members.
+ // Populating contacts in members array based on their relationship with direct members.
if (!empty($relationships)) {
foreach ($relationships as $relTypeId => $membershipId) {
// As members are not direct members, there should not be
*
* @copyright CiviCRM LLC (c) 2004-2014
* @version $Id: MembershipBlock.php 30171 2010-10-14 09:11:27Z mover $
- *
*/
/**
- * API to Create or update a Membership Type
+ * API to Create or update a Membership Type.
*
* @param array $params
* An associative array of name/value property values of civicrm_membership_block.
}
/**
- * Deletes an existing membership type
+ * Deletes an existing membership type.
*
* This API is used for deleting a membership type
* Required parameters : id of a membership type
*/
/**
- * Add or update a link between contribution and membership
+ * Add or update a link between contribution and membership.
*
* @param array $params
- * (reference ) input parameters.
+ * Input parameters.
*
* @return array
- * (reference ) membership_payment_id of created or updated record
- * {@getfields MembershipPayment_create}
- * @example MembershipPaymentCreate.php
+ * API result array.
*/
function civicrm_api3_membership_payment_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
/**
- * Retrieve one / all contribution(s) / membership(s) linked to a
- * membership / contrbution.
+ * Retrieve one or more membership payment records.
*
* @param array $params
* Input parameters.
*
* @return array
- * array of properties, if error an array with an error id and error message
- * @example MembershipPaymentGet
- * {@getfields MembershipPayment_get}
+ * API result array.
*/
function civicrm_api3_membership_payment_get($params) {
return _civicrm_api3_basic_get('CRM_Member_DAO_MembershipPayment', $params);
*
* @copyright CiviCRM LLC (c) 2004-2014
* @version $Id: MembershipStatus.php 30171 2010-10-14 09:11:27Z mover $
- *
*/
/**
- * Create a Membership Status
- *
- * This API is used for creating a Membership Status
+ * Create a Membership Status.
*
* @param array $params
- * An associative array of name/value property values of civicrm_membership_status.
+ * Array of name/value property values of civicrm_membership_status.
*
* @return array
* Array of newly created membership status property values.
- * {@getfields MembershipStatus_create}
*/
function civicrm_api3_membership_status_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
/**
- * Update an existing membership status
+ * Update an existing membership status.
*
* This api is used for updating an existing membership status.
* Required parameters : id of a membership status
*
* @param array $params
- * An associative array of name/value property values of civicrm_membership_status.
+ * Array of name/value property values of civicrm_membership_status.
+ *
* @deprecated - should just use create
*
* @return array
* Array of updated membership status property values
*/
-function &civicrm_api3_membership_status_update($params) {
+function civicrm_api3_membership_status_update($params) {
civicrm_api3_verify_mandatory($params, NULL, array('id'));
//don't allow duplicate names.
}
/**
- * Deletes an existing membership status
+ * Deletes an existing membership status.
*
* This API is used for deleting a membership status
*
* @param array $params
+ *
* @return array
*/
function civicrm_api3_membership_status_delete($params) {
}
/**
- * Derives the Membership Status of a given Membership Reocrd
+ * Derives the Membership Status of a given Membership Record.
*
* This API is used for deriving Membership Status of a given Membership
* record using the rules encoded in the membership_status table.
*
* @return array
* Array of status id and status name
- * @public
*/
function civicrm_api3_membership_status_calc($membershipParams) {
if (!($membershipID = CRM_Utils_Array::value('membership_id', $membershipParams))) {
*
* @copyright CiviCRM LLC (c) 2004-2014
* @version $Id: MembershipType.php 30171 2010-10-14 09:11:27Z mover $
- *
*/
/**
- * API to Create or update a Membership Type
+ * API to Create or update a Membership Type.
*
* @param array $params
- * An associative array of name/value property values of civicrm_membership_type.
+ * Array of name/value property values of civicrm_membership_type.
*
* @return array
- * newly created or updated membership type property values.
+ * API result array.
*/
function civicrm_api3_membership_type_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Membership_type');
* This api is used for finding an existing membership type.
*
* @param array $params
- * An associative array of name/value property values of civicrm_membership_type.
- * {getfields MembershipType_get}
+ * Array of name/value property values of civicrm_membership_type.
*
* @return array
- * Array of all found membership type property values.
+ * API result array.
*/
function civicrm_api3_membership_type_get($params) {
return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
/**
- * Deletes an existing membership type
- *
- * This API is used for deleting a membership type
- * Required parameters : id of a membership type
+ * Deletes an existing membership type.
*
* @param array $params
*
- * @return bool
- * true if success, else false
+ * @return array
+ * API result array.
*/
function civicrm_api3_membership_type_delete($params) {
return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
* File for the CiviCRM APIv3 message_template functions
*
* @package CiviCRM_SEPA
- *
*/
/**
+ * Create message template.
+ *
* @param array $params
+ *
* @return array
* @throws \API_Exception
*/
}
/**
+ * Delete message template.
+ *
* @param array $params
*
* @return bool
}
/**
+ * Adjust metadata for message_template get action.
+ *
* @param array $params
*/
function _civicrm_api3_message_template_get_spec(&$params) {
}
/**
- * Retrieve one or more message_template
+ * Retrieve one or more message_template.
*
* @param array $params
- * An associative array of name/value pairs.
+ * Array of name/value pairs.
*
* @return array
- * api result array
+ * API result array.
*/
function civicrm_api3_message_template_get($params) {
return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
/**
* Sends a template.
+ *
* @param array $params
*/
function civicrm_api3_message_template_send($params) {
*
* @copyright CiviCRM LLC (c) 2004-2014
* @version $Id: Note.php 30879 2010-11-22 15:45:55Z shot $
- *
*/
/**
- * Create Note
+ * Create Note.
*
* This API is used for creating a note.
* Required parameters : entity_id AND note
}
/**
- * Deletes an existing note
+ * Deletes an existing note.
*
* This API is used for deleting a note
*
* @param array $params
* Including id of the note to be deleted.
- * {@getfields note_delete}
*
- * @return null
+ * @return array
*/
function civicrm_api3_note_delete($params) {
}
/**
- * Retrieve a specific note, given a set of input params
+ * Retrieve a specific note or notes, given a set of input params.
*
* @param array $params
* Input parameters.
* @return array
* array of properties,
* if error an array with an error id and error message
- *
- * {@getfields note_get}
*/
function civicrm_api3_note_get($params) {
}
/**
- * Adjust Metadata for Get action
+ * Adjust Metadata for Get action.
*
* The metadata is used for setting defaults, documentation & validation.
*
}
/**
- * Get all descendents of given note
+ * Get all descendants of given note.
*
* @param array $params
- * Associative array; only required 'id' parameter is used.
+ * array; only required 'id' parameter is used.
*
* @return array
* Nested associative array beginning with direct children of given note.
<?php
/**
+ * Get option groups.
+ *
* @param array $params
*
* @return array
}
/**
- * create/update survey
- *
- * This API is used to create new survey or update any of the existing
- * In case of updating existing survey, id of that particular survey must
- * be in $params array.
+ * Create/update option group.
*
* @param array $params
- * (reference) Associative array of property.
- * name/value pairs to insert in new 'survey'
+ * Array per getfields metadata.
*
* @return array
- * survey array
- *
*/
function civicrm_api3_option_group_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
*
* @return array
* API Result Array
- * {@getfields OptionGroup_delete}
*/
function civicrm_api3_option_group_delete($params) {
return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
<?php
/**
- * Retrieve one or more OptionValues
+ * Retrieve one or more option values.
*
* @param array $params
*
- * {@example OptionValueGet.php 0}
- * @example OptionValueGet.php
- *
* @return array
- * details of found Option Values
- * {@getfields OptionValue_get}
+ * Details of found Option Values
*/
function civicrm_api3_option_value_get($params) {
}
/**
- * Add a OptionValue. OptionValues are used to classify CRM entities (including Contacts, Groups and Actions).
- *
- * Allowed @params array keys are:
- *
- * {@example OptionValueCreate.php}
+ * Add an OptionValue.
*
* @param array $params
*
* @throws API_Exception
* @return array
* Array of newly created option_value property values.
- * {@getfields OptionValue_create}
*/
function civicrm_api3_option_value_create($params) {
$result = _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
/**
- * Deletes an existing OptionValue
+ * Deletes an existing option value.
*
* @param array $params
*
- * {@example OptionValueDelete.php 0}
- *
* @return array
* Api result
- * {@getfields OptionValue_create}
*/
function civicrm_api3_option_value_delete($params) {
- // we will get the option group id before deleting so we can flush pseudoconstants
+ // We will get the option group id before deleting so we can flush pseudoconstants.
$optionGroupID = civicrm_api('option_value', 'getvalue', array('version' => 3, 'id' => $params['id'], 'return' => 'option_group_id'));
if (CRM_Core_BAO_OptionValue::del((int) $params['id'])) {
civicrm_api('option_value', 'getfields', array('version' => 3, 'cache_clear' => 1, 'option_group_id' => $optionGroupID));
*
* @copyright CiviCRM LLC (c) 2004-2014
* @version $Id: Participant.php 30486 2010-11-02 16:12:09Z shot $
- *
*/
/**
- * Create an Event Participant
- *
- * This API is used for creating a participants in an event.
- * Required parameters : event_id AND contact_id for new creation
- * : participant as name/value with participantid for edit
+ * Create an Event Participant.
*
* @param array $params
* An associative array of name/value property values of civicrm_participant.
*
* @return array
- * apiresult
- * {@getfields participant_create}
+ * API result array
*/
function civicrm_api3_participant_create($params) {
- //check that event id is not an template - should be done @ BAO layer
+ // Check that event id is not an template - should be done @ BAO layer.
if (!empty($params['event_id'])) {
$isTemplate = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $params['event_id'], 'is_template');
if (!empty($isTemplate)) {
}
/**
+ * Create a default participant line item.
+ *
* @todo this should be done in the BAO not the api
- * Create a default participant line item
+ *
* @param array $params
* @param $participant
+ *
* @throws \CiviCRM_API3_Exception
*/
function _civicrm_api3_participant_createlineitem(&$params, $participant) {
}
/**
- * Retrieve a specific participant, given a set of input params
- * If more than one matching participant exists, return an error, unless
- * the client has requested to return the first found contact
+ * Retrieve a specific participant, given a set of input params.
*
* @param array $params
- * (reference ) input parameters.
+ * input parameters.
*
* @return array
- * (reference ) array of properties, if error an array with an error id and error message
- * {@getfields participant_get}
+ * array of properties, if error an array with an error id and error message
*/
function civicrm_api3_participant_get($params) {
$mode = CRM_Contact_BAO_Query::MODE_EVENT;
}
/**
- * Adjust Metadata for Get action
+ * Adjust Metadata for Get action.
*
* The metadata is used for setting defaults, documentation & validation.
*
}
/**
- * Deletes an existing contact participant
+ * Deletes an existing contact participant.
*
* This API is used for deleting a contact participant
*
* @param array $params
* Array containing Id of the contact participant to be deleted.
*
- * {@getfields participant_delete}
* @throws Exception
* @return array
*/
*
* @copyright CiviCRM LLC (c) 2004-2014
* @version $Id: Participant.php 30486 2010-11-02 16:12:09Z shot $
- *
*/
/**
- * Create a Event Participant Payment
+ * Create a Event Participant Payment.
*
* This API is used for creating a Participant Payment of Event.
* Required parameters : participant_id, contribution_id.
}
/**
- * Deletes an existing Participant Payment
- *
- * This API is used for deleting a Participant Payment
+ * Deletes an existing Participant Payment.
*
* @param array $params
*
* @return array
* API result
- * @example ParticipantPaymentDelete.php
- * {@getfields ParticipantPayment_delete}
*/
function civicrm_api3_participant_payment_delete($params) {
$participant = new CRM_Event_BAO_ParticipantPayment();
}
/**
- * Retrieve one / all contribution(s) / participant(s) linked to a
- * contribution.
+ * Retrieve one or more participant payment records.
*
* @param array $params
* Input parameters.
*
* @return array
* array of properties, if error an array with an error id and error message
- * @example ParticipantPaymentGet
- * {@getfields ParticipantPayment_get}
*/
function civicrm_api3_participant_payment_get($params) {
return _civicrm_api3_basic_get('CRM_Event_DAO_ParticipantPayment', $params);
*/
/**
- * create/update participant_status
+ * Create/update participant_status.
*
* This API is used to create new participant_status or update any of the existing
* In case of updating existing participant_status, id of that particular participant_status must
* be in $params array.
*
* @param array $params
- * Associative array of property.
+ * Array of property.
* name/value pairs to insert in new 'participant_status'
*
* @return array
* participant_status array
- * {@getfields ParticipantStatusType_create}
- * @example ParticipantStatusTypeCreate.php
*/
function civicrm_api3_participant_status_type_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
/**
- * Returns array of participant_statuses matching a set of one or more group properties
+ * Returns array of participant_statuses matching a set of one or more group properties.
*
* @param array $params
* Array of one or more valid.
*
* @return array
* Array of matching participant_statuses
- * {@getfields ParticipantStatusType_get}
- * @example ParticipantStatusTypeGet.php
*/
function civicrm_api3_participant_status_type_get($params) {
return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
/**
- * delete an existing participant_status
+ * Delete an existing participant_status.
*
* This method is used to delete any existing participant_status. id of the group
* to be deleted is required field in $params array
*
* @param array $params
- * (reference) array containing id of the group.
+ * Array containing id of the group.
* to be deleted
*
* @return array
* api result array
- * {@getfields ParticipantStatusType_delete}
- * @example ParticipantStatusTypeDelete.php
*/
function civicrm_api3_participant_status_type_delete($params) {
if (CRM_Event_BAO_ParticipantStatusType::deleteParticipantStatusType($params['id'])) {
*/
/**
- * Add/Update a PaymentProcessor
- *
- * Allowed @params array keys are:
- * {@getfields payment_processor_create}
+ * Add/Update a PaymentProcessor.
*
* @param array $params
*
}
/**
- * Deletes an existing PaymentProcessor
+ * Deletes an existing PaymentProcessor.
*
* @param array $params
- * {@getfields payment_processor_delete}
*
* @return array
* API result Array
}
/**
- * Retrieve one or more PaymentProcessor
+ * Retrieve one or more PaymentProcessor.
*
* @param array $params
- * An associative array of name/value pairs.
- * {@getfields payment_processor_get}
+ * Array of name/value pairs.
*
* @return array
* details of found PaymentProcessor
* @subpackage API_Contact
* @copyright CiviCRM LLC (c) 2004-2014
* $Id: PaymentProcessorType.php 30415 2010-10-29 12:02:47Z shot $
- *
- */
-
-/**
- * Include common API util functions
*/
/**
- * create payment_processor type
+ * Create payment_processor type.
*
* @param array $params
* Associative array of property name/value pairs to insert in new payment_processor type.
}
/**
- * get all payment_processor types
+ * Get all payment_processor types.
+ *
* @param array $params
+ *
* @return array
*/
function civicrm_api3_payment_processor_type_get($params) {
}
/**
- * Delete a payment_processor type delete
+ * Delete a payment_processor type delete.
*
* @param array $params
*
*/
/**
- * Add an Phone for a contact
- *
- * Allowed @params array keys are:
- * {@getfields phone_create}
- * @example PhoneCreate.php
+ * Add an Phone for a contact.
*
* @param array $params
+ * Array per getfields metadata.
*
* @return array
* Array of newly created phone property values.
}
/**
- * Deletes an existing Phone
+ * Delete an existing Phone.
*
* @param array $params
+ * Array per getfields metadata.
*
* @return array
* Api Result
- * {@getfields phone_delete}
- * @example PhoneDelete.php
*/
function civicrm_api3_phone_delete($params) {
return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
* your module under api/v3/Phone/Dial.php.
*
* @param array $params
- * An associative array of name/value pairs.
+ * Array per getfields metadata.
*
* @return array
* details of found phones else error
*
* @copyright CiviCRM LLC (c) 2004-2014
* @version $Id: Pledge.php
- *
- */
-
-/**
- * Include utility functions
*/
/**
- * Creates or updates an Activity. See the example for usage
+ * Create or updates an Pledge.
*
- * @param array $params
- * Associative array of property name/value.
- * pairs for the activity.
- * {@getfields pledge_create}
+ * @param $params
*
* @return array
* Array containing 'is_error' to denote success or failure and details of the created pledge
- *
- * @example PledgeCreate.php Standard create example
- *
+ * @throws \API_Exception
*/
function civicrm_api3_pledge_create($params) {
_civicrm_api3_pledge_format_params($params, TRUE);
}
/**
- * Delete a pledge
+ * Delete a pledge.
*
* @param array $params
* Array included 'pledge_id' of pledge to delete.
*
- * @return bool
- * true if success, else false
- * {@getfields pledge_delete}
- * @example PledgeDelete.php
+ * @return array
*/
function civicrm_api3_pledge_delete($params) {
if (CRM_Pledge_BAO_Pledge::deletePledge($params['id'])) {
}
/**
+ * Adjust metadata for pledge delete action.
+ *
* @param array $params
*/
function _civicrm_api3_pledge_delete_spec(&$params) {
}
/**
- * return field specification specific to get requests
+ * Adjust field specification specific to get requests.
+ *
* @param array $params
*/
function _civicrm_api3_pledge_get_spec(&$params) {
}
/**
- * return field specification specific to get requests
+ * Adjust field specification specific to get requests.
+ *
* @param array $params
*/
function _civicrm_api3_pledge_create_spec(&$params) {
}
/**
- * Retrieve a set of pledges, given a set of input params
+ * Retrieve a set of pledges, given a set of input params.
*
* @param array $params
* Input parameters. Use interrogate for possible fields.
}
/**
- * Set default to not return test params
+ * Set default to not return test params.
*/
function _civicrm_api3_pledge_get_defaults() {
return array('pledge_test' => 0);
}
/**
- * Legacy function - I removed a bunch of stuff no longer required from here but it still needs
+ * Legacy function to format pledge parameters.
+ *
+ * I removed a bunch of stuff no longer required from here but it still needs
* more culling
* take the input parameter list as specified in the data model and
* convert it into the same format that we use in QF and BAO object
*
* @param array $values
* The reformatted properties that we can use internally.
- *
*/
function _civicrm_api3_pledge_format_params(&$values) {
*
* @copyright CiviCRM LLC (c) 2004-2014
* @version $Id: PledgePayment.php
- *
*/
/**
- * Add or update a plege payment. Pledge Payment API doesn't actually add a pledge
+ * Add or update a pledge payment.
+ *
+ * Pledge Payment API doesn't actually add a pledge
* if the request is to 'create' and 'id' is not passed in
* the oldest pledge with no associated contribution is updated
*
*
* @param array $params
* Input parameters.
- * {@getfields PledgePayment_create}
- * @example PledgePaymentCreate.php
*
* @return array
* API Result
}
/**
- * Delete a pledge Payment - Note this deletes the contribution not just the link
+ * Delete a pledge Payment - Note this deletes the contribution not just the link.
*
* @param array $params
* Input parameters.
- * {@getfields PledgePayment_delete}
- * @example PledgePaymentDelete.php
*
* @return array
* API result
}
/**
- * Retrieve a set of pledges, given a set of input params
+ * Retrieve a set of pledges, given a set of input params.
*
* @param array $params
* Input parameters.
- * {@getfields PledgePayment_get}
- * @example PledgePaymentGet.php *
*
* @return array
- * (reference ) array of pledges, if error an array with an error id and error message
+ * array of pledges, if error an array with an error id and error message
*/
function civicrm_api3_pledge_payment_get($params) {
}
/**
- * Gets field for civicrm_pledge_payment functions
+ * Gets field for civicrm_pledge_payment functions.
*
* @param array $params
* Modifiable list of fields allowed for the PledgePayment.get action.
*
* @package CiviCRM_APIv3
* @subpackage API_premium
- *
*/
/**
- * Save a premium
- *
- * Allowed @params array keys are:
- * {@getfields premium_create}
- * @example premiumCreate.php
+ * Save a premium.
*
* @param array $params
*
}
/**
- * Get a premium
- *
- * Allowed @params array keys are:
- * {@getfields premium_get}
- * @example premiumCreate.php
+ * Get a premium.
*
* @param array $params
*
}
/**
- * Delete a premium
- *
- * Allowed @params array keys are:
- * {@getfields premium_delete}
- * @example premiumCreate.php
+ * Delete a premium.
*
* @param array $params
*
}
/**
- * return field specification specific to get requests
+ * Return field specification specific to get requests.
+ *
* @param array $params
*/
function _civicrm_api3_premium_get_spec(&$params) {
}
/**
- * return field specification specific to create requests
+ * Return field specification specific to create requests.
+ *
* @param array $params
*/
function _civicrm_api3_premium_create_spec(&$params) {
*/
/**
- * Create or update a price_field
+ * Create or update a price_field.
*
* @param array $params
* Associative array of property.
* name/value pairs to insert in new 'price_field'
- * @example PriceFieldCreate.php Std Create example
*
* @return array
* api result array
- * {@getfields price_field_create}
*/
function civicrm_api3_price_field_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
/**
- * Returns array of price_fields matching a set of one or more group properties
+ * Returns array of price_fields matching a set of one or more group properties.
*
* @param array $params
* Array of one or more valid property_name=>value pairs. If $params is set.
*
* @return array
* Array of matching price_fields
- * {@getfields price_field_get}
*/
function civicrm_api3_price_field_get($params) {
return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
/**
- * delete an existing price_field
+ * Delete an existing price_field.
*
* This method is used to delete any existing price_field. id of the group
* to be deleted is required field in $params array
*
* @return array
* API result array
- * {@getfields price_field_delete}
*/
function civicrm_api3_price_field_delete($params) {
return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
*/
/**
- * Create or update a price_field_value
+ * Create or update a price_field_value.
*
* @param array $params
- * Associative array of property.
+ * Array of property.
* name/value pairs to insert in new 'price_field_value'
- * @example PriceFieldValueCreate.php Std Create example
*
* @return array
- * api result array
- * {@getfields price_field_value_create}
+ * API result array.
*/
function civicrm_api3_price_field_value_create($params) {
$ids = array();
}
/**
- * Returns array of price_field_values matching a set of one or more group properties
+ * Returns array of price_field_values matching a set of one or more group properties.
*
* @param array $params
* Array of one or more valid property_name=>value pairs. If $params is set.
* as null, all price_field_values will be returned (default limit is 25)
*
* @return array
- * Array of matching price_field_values
- * {@getfields price_field_value_get}
+ * API result array.
*/
function civicrm_api3_price_field_value_get($params) {
return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
/**
- * delete an existing price_field_value
+ * Delete an existing price_field_value.
*
* This method is used to delete any existing price_field_value. id of the group
* to be deleted is required field in $params array
* to be deleted
*
* @return array
- * API result array
- * {@getfields price_field_value_delete}
+ * API result array.
*/
function civicrm_api3_price_field_value_delete($params) {
return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
*/
/**
- * Create or update a price_set
+ * Create or update a price_set.
*
* @param array $params
- * Associative array of property.
+ * array of property.
* name/value pairs to insert in new 'price_set'
- * @example PriceSetCreate.php Std Create example
*
* @return array
* api result array
- * {@getfields price_set_create}
*/
function civicrm_api3_price_set_create($params) {
$result = _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
/**
- * Returns array of price_sets matching a set of one or more group properties
+ * Returns array of price_sets matching a set of one or more group properties.
*
* @param array $params
* Array of one or more valid property_name=>value pairs. If $params is set.
*
* @return array
* Array of matching price_sets
- * {@getfields price_set_get}
*/
function civicrm_api3_price_set_get($params) {
// hack to make getcount work. - not sure the best approach here
}
/**
- * delete an existing price_set
+ * Delete an existing price_set.
*
* This method is used to delete any existing price_set. id of the group
* to be deleted is required field in $params array
*
* @return array
* API result array
- * {@getfields price_set_delete}
*/
function civicrm_api3_price_set_delete($params) {
return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
*
* @package CiviCRM_APIv3
* @subpackage API_print_label
- *
*/
/**
- * Save a print_label
- *
- * Allowed @params array keys are:
- * {@getfields print_label_create}
- * @example print_labelCreate.php
+ * Save a print_label.
*
* @param array $params
*
}
/**
- * Get a print_label
- *
- * Allowed @params array keys are:
- * {@getfields print_label_get}
- * @example print_labelCreate.php
+ * Get a print_label.
*
* @param array $params
*
}
/**
- * Delete a print_label
- *
- * Allowed @params array keys are:
- * {@getfields print_label_delete}
- * @example print_labelCreate.php
+ * Delete a print_label.
*
* @param array $params
*
*
* @package CiviCRM_APIv3
* @subpackage API_product
- *
*/
/**
- * Save a product
- *
- * Allowed @params array keys are:
- * {@getfields product_create}
- * @example productCreate.php
+ * Save a product.
*
* @param array $params
*
}
/**
- * Get a product
- *
- * Allowed @params array keys are:
- * {@getfields product_get}
- * @example productCreate.php
+ * Get a product.
*
* @param array $params
*
}
/**
- * Delete a product
- *
- * Allowed @params array keys are:
- * {@getfields product_delete}
- * @example productCreate.php
+ * Delete a product.
*
* @param array $params
*
* @subpackage API_ActivityProfile
* @copyright CiviCRM LLC (c) 2004-2014
* @version $Id: Profile.php 30486 2011-05-20 16:12:09Z rajan $
- *
*/
/**
}
/**
+ * Adjust profile get function metadata.
+ *
* @param array $params
*/
function _civicrm_api3_profile_get_spec(&$params) {
/**
* Submit a set of fields against a profile.
+ *
* Note choice of submit versus create is discussed CRM-13234 & related to the fact
* 'profile' is being treated as a data-entry entity
*
}
/**
+ * Translate field names for BAO.
+ *
* The api standards expect field names to be lower case but the BAO uses mixed case
* so we accept 'email-primary' but pass 'email-Primary' to the BAO
* we could make the BAO handle email-primary but this would alter the fieldname seen by hooks
* & we would need to consider that change
+ *
* @param string $fieldName
* API field name.
*
$fieldName = str_replace('url', 'URL', $fieldName);
return str_replace('primary', 'Primary', $fieldName);
}
+
/**
- * metadata for submit action
+ * Metadata for submit action.
+ *
* @param array $params
* @param array $apirequest
*/
}
/**
+ * Set profile - deprecated.
+ *
* @deprecated - calling this function directly is deprecated as 'set' is not a clear action
* use submit
* Update Profile field values.
*
* @param array $params
- * Associative array of property name/value.
+ * Array of property name/value.
* pairs to update profile field values
*
* @return array
* Updated Contact/ Activity object|CRM_Error
- *
- *
*/
function civicrm_api3_profile_set($params) {
return civicrm_api3('profile', 'submit', $params);
}
/**
+ * Apply profile - deprecated.
+ *
* @deprecated - appears to be an internal function - should not be accessible via api
* Provide formatted values for profile fields.
*
* @param array $params
- * Associative array of property name/value.
+ * Array of property name/value.
* pairs to profile field values
*
* @throws API_Exception
/**
+ * Get pseudo profile 'billing'.
+ *
* This is a function to help us 'pretend' billing is a profile & treat it like it is one.
* It gets standard credit card address fields etc
* Note this is 'better' that the inbuilt version as it will pull in fallback values
}
/**
- * Here we will build up getfields type data for all the fields in the profile. Because the integration with the
- * form layer in core is so hard-coded we are not going to attempt to re-use it
+ * Here we will build up getfields type data for all the fields in the profile.
+ *
+ * Because the integration with the form layer in core is so hard-coded we are not going to attempt to re-use it
* However, as this function is unit-tested & hence 'locked in' we can aspire to extract sharable
* code out of the form-layer over time.
*
*
* @copyright CiviCRM LLC (c) 2004-2014
* @version $Id: Relationship.php 30486 2010-11-02 16:12:09Z shot $
- *
*/
/**
- * Add or update a relationship
+ * Add or update a relationship.
*
* @param array $params
* Input parameters.
*
* @throws API_Exception
- * @example RelationshipCreate.php Std Create example
*
* @return array
* API Result Array
- * {@getfields relationship_create}
*/
function civicrm_api3_relationship_create($params) {
_civicrm_api3_handle_relationship_type($params);
}
/**
- * Delete a relationship
+ * Delete a relationship.
*
* @param array $params
*
* @return array
* API Result Array
- * {@getfields relationship_delete}
- * @example RelationshipDelete.php Delete Example
- *
*/
function civicrm_api3_relationship_delete($params) {
}
/**
- * get the relationship
+ * Get one or more relationship/s.
*
* @param array $params
* Input parameters.
+ *
* @todo Result is inconsistent depending on whether contact_id is passed in :
* - if you pass in contact_id - it just returns all relationships for 'contact_id'
* - if you don't pass in contact_id then it does a filter on the relationship table (DAO based search)
*
* @return array
* API Result Array
- * {@getfields relationship_get}
- * @example RelationshipGet.php
*/
function civicrm_api3_relationship_get($params) {
$options = _civicrm_api3_get_options_from_params($params);
}
/**
- * legacy handling for relationship_type parameter
+ * Legacy handling for relationship_type parameter.
*
* @param array $params
* Associative array of property name/value.
* @subpackage API_Contact
* @copyright CiviCRM LLC (c) 2004-2014
* $Id: Contact.php 30415 2010-10-29 12:02:47Z shot $
- *
*/
/**
- * create relationship type
+ * Create relationship type.
*
* @param array $params
- * Associative array of property name/value pairs to insert in new relationship type.
+ * Array per getfields metadata.
*
* @return array
*/
}
/**
- * get all relationship type
- * retruns An array of Relationship_type
- * {@getfields RelationshipType_get}
- * @example RelationshipTypeGet.php
+ * Get all relationship types.
+ *
* @param array $params
+ *
* @return array
*/
function civicrm_api3_relationship_type_get($params) {
}
/**
- * Delete a relationship type delete
+ * Delete a relationship type.
*
* @param array $params
*
}
/**
+ * Get list defaults for relationship types.
+ *
* @see _civicrm_api3_generic_getlist_defaults
*
* @param array $request
+ *
* @return array
*/
function _civicrm_api3_relationship_type_getlist_defaults($request) {
<?php
/**
- * Retrieve a report instance
+ * Retrieve a report instance.
*
* @param array $params
* Input parameters.
*
* @return array
- * details of found instances
+ * Details of found instances
*/
function civicrm_api3_report_instance_get($params) {
return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
/**
- * Add or update a report instance.
+ * Add or update a report instance.
*
* @param array $params
*
}
/**
- * Deletes an existing ReportInstance
+ * Deletes an existing ReportInstance.
*
* @param array $params
*
<?php
/**
- * Retrieve a report template
+ * Retrieve a report template.
*
* FIXME This is a bare-minimum placeholder
*
* @param array $params
*
- * {@example OptionValueGet.php 0}
- * @example OptionValueGet.php
- *
* @return array
* details of found Option Values
- * {@getfields OptionValue_get}
*/
function civicrm_api3_report_template_get($params) {
require_once 'api/v3/OptionValue.php';
}
/**
- * Add a OptionValue. OptionValues are used to classify CRM entities (including Contacts, Groups and Actions).
- *
- * Allowed @params array keys are:
+ * Add an OptionValue.
*
- * {@example OptionValueCreate.php}
+ * OptionValues are used to classify CRM entities (including Contacts, Groups and Actions).
*
* @param array $params
*
* @return array
* Array of newly created option_value property values.
- * {@getfields OptionValue_create}
*/
function civicrm_api3_report_template_create($params) {
require_once 'api/v3/OptionValue.php';
}
/**
- * Deletes an existing ReportTemplate
+ * Deletes an existing ReportTemplate.
*
* @param array $params
*
- * {@example ReportTemplateDelete.php 0}
- *
* @return array
* Api result
- * {@getfields ReportTemplate_create}
*/
function civicrm_api3_report_template_delete($params) {
require_once 'api/v3/OptionValue.php';
}
/**
- * Retrieve rows from a report template
+ * Retrieve rows from a report template.
*
* @param array $params
* Input parameters.
}
/**
+ * Get report template rows.
+ *
* @param array $params
*
* @return array
}
/**
+ * Get statistics from a given report.
+ *
* @param array $params
*
* @return array
return civicrm_api3_create_success($stats, $params, 'report_template', 'getstatistics', CRM_Core_DAO::$_nullObject, $metadata);
}
/**
- * Retrieve rows from a report template
+ * Adjust metadata for template getrows action.
*
* @param array $params
* Input parameters.
- *
- * @return void
- * details of found instances
*/
function _civicrm_api3_report_template_getrows_spec(&$params) {
$params['report_id'] = array(
* @subpackage API_Settings
* @copyright CiviCRM LLC (c) 2004-2014
* @version $Id: Settings.php
+ */
+
+/**
+ * Get fields for setting api calls.
+ *
* @param array $params
+ *
* @return array
*/
function civicrm_api3_setting_getfields($params) {
}
/**
- * Alter metadata for getfields functions
+ * Alter metadata for getfields functions.
+ *
* @param array $params
*/
function _civicrm_api3_setting_getfields_spec(&$params) {
}
/**
- * Return default values for settings. We will domain key this as it could vary by domain (ie. urls)
+ * Return default values for settings.
+ *
+ * We will domain key this as it could vary by domain (ie. urls)
* as we will be creating the option for a function rather than an value to be in the defaults
- * Note that is not in place as yet
+ * Note that is not in place as yet.
+ *
* @param array $params
+ *
* @return array
* @throws \CiviCRM_API3_Exception
* @throws \Exception
return civicrm_api3_create_success($defaults, $params, 'setting', 'getfields');
}
/**
- * Metadata for setting create function
+ * Metadata for setting create function.
*
* @param array $params
* Parameters as passed to the API.
}
/**
- * Revert settings to defaults
+ * Revert settings to defaults.
+ *
* @param array $params
+ *
* @return array
* @throws \Exception
*/
}
/**
- * Alter metadata for getfields functions
+ * Alter metadata for getfields functions.
+ *
* @param array $params
*/
function _civicrm_api3_setting_revert_spec(&$params) {
$params['component_id'] = array('title' => 'id of relevant component');
$params['domain_id'] = array(
'api.default' => 'current_domain',
- 'description' => 'Defaults may differ by domain - if you do not pass in a domain id this will default to the current domain
- an array or "all" are acceptable values for multiple domains',
+ 'description' => 'Defaults may differ by domain - if you do not pass in a domain id this will default to the current domain'
+ . ' an array or "all" are acceptable values for multiple domains',
'title' => 'Setting Domain',
);
}
/**
- * Revert settings to defaults
+ * Revert settings to defaults.
+ *
* @param array $params
+ *
* @return array
* @throws \CiviCRM_API3_Exception
* @throws \Exception
}
/**
- * Alter metadata for getfields functions
+ * Alter metadata for getfields functions.
+ *
* @param array $params
*/
function _civicrm_api3_setting_fill_spec(&$params) {
$params['domain_id'] = array(
'api.default' => 'current_domain',
'title' => 'Setting Domain',
- 'description' => 'Defaults may differ by domain - if you do not pass in a domain id this will default to the current domain
- an array or "all" are acceptable values for multiple domains',
+ 'description' => 'Defaults may differ by domain - if you do not pass in a domain id this will default to the '
+ . 'current domain, an array or "all" are acceptable values for multiple domains',
);
}
/**
- * Create or update a setting
+ * Create or update a setting.
*
* @param array $params
- * Associative array of setting.
- * name/value pairs + other vars as applicable - see getfields for more
- * @example SettingCreate.php Std Create example
+ * Parameters as per getfields.
*
* @return array
* api result array
- * {@getfields setting_create}
*/
function civicrm_api3_setting_create($params) {
$domains = _civicrm_api3_setting_getDomainArray($params);
}
/**
- * Metadata for setting create function
+ * Metadata for setting create function.
*
* @param array $params
* Parameters as passed to the API.
}
/**
- * Returns array of settings matching input parameters
+ * Returns array of settings matching input parameters.
*
* @param array $params
- * Array of one or more valid.
- * property_name=>value pairs.
+ * Array of one or more valid property_name=>value pairs.
*
* @return array
* Array of matching settings
- * {@getfields setting_get}
*/
function civicrm_api3_setting_get($params) {
$domains = _civicrm_api3_setting_getDomainArray($params);
return civicrm_api3_create_success($result, $params, 'setting', 'get');
}
/**
- * Metadata for setting create function
+ * Metadata for setting create function.
*
* @param array $params
* Parameters as passed to the API.
);
}
/**
- * Returns value for specific parameter. Function requires more fields than 'get' but is intended for
+ * Returns value for specific parameter.
+ *
+ * Function requires more fields than 'get' but is intended for
* runtime usage & should be quicker
*
* @param array $params
- * (reference) Array of one or more valid.
+ * Array of one or more valid.
* property_name=>value pairs.
*
* @return array
- * Array of matching settings
- * {@getfields setting_get}
+ * API result array.
*/
function civicrm_api3_setting_getvalue($params) {
$config = CRM_Core_Config::singleton();
}
/**
- * Metadata for setting create function
+ * Metadata for setting create function.
*
* @param array $params
* Parameters as passed to the API.
}
/**
- * Converts domain input into an array. If an array is passed in this is used, if 'all' is passed
+ * Converts domain input into an array.
+ *
+ * If an array is passed in this is used, if 'all' is passed
* in this is converted to 'all arrays'
*
* Really domain_id should always be set but doing an empty check because at the moment
* using crm-editable will pass an id & default won't be applied
- * we did talk about id being a pseudonym for domain_id in this api so applying it here
+ * we did talk about id being a pseudonym for domain_id in this api so applying it here.
+ *
* @param array $params
+ *
* @return array
* @throws \Exception
*/
*
* @package CiviCRM_APIv3
* @subpackage API_sms_provider
- *
*/
/**
- * Save an sms_provider
- *
- * Allowed @params array keys are:
- * {@getfields sms_provider_create}
- * @example sms_providerCreate.php
+ * Save an sms_provider.
*
* @param array $params
*
}
/**
- * Get an sms_provider
- *
- * Allowed @params array keys are:
- * {@getfields sms_provider_get}
- * @example sms_providerCreate.php
+ * Get an sms_provider.
*
* @param array $params
*
}
/**
- * Delete an sms_provider
- *
- * Allowed @params array keys are:
- * {@getfields sms_provider_delete}
- * @example sms_providerCreate.php
+ * Delete an sms_provider.
*
* @param array $params
*
/**
- * Create or update a survey
+ * Create or update a survey.
*
* @param array $params
- * Associative array of property.
- * name/value pairs to insert in new 'survey'
- * @example SurveyCreate.php Std Create example
+ * Array per getfields metadata.
*
* @return array
* api result array
- * {@getfields survey_create}
*/
function civicrm_api3_survey_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Survey');
}
/**
- * Returns array of surveys matching a set of one or more group properties
+ * Returns array of surveys matching a set of one or more group properties.
*
* @param array $params
* Array of one or more valid.
*
* @return array
* API result Array of matching surveys
- * {@getfields survey_get}
*/
function civicrm_api3_survey_get($params) {
return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, TRUE, 'Survey');
}
/**
- * delete an existing survey
+ * Delete an existing survey.
*
* This method is used to delete any existing survey. id of the group
* to be deleted is required field in $params array
*
* @return array
* api result array
- * {@getfields survey_delete}
*/
function civicrm_api3_survey_delete($params) {
return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
*/
/**
+ * Notify caller of deprecated function.
+ *
* @deprecated api notice
* @return string
* to indicate this entire api entity is deprecated
}
/**
- * Get the list of signatories
+ * Get the list of signatories.
+ *
* @deprecated - api currently not supported
+ *
* @param array $params
- * (reference ) input parameters.
+ * input parameters.
*
* @return array
*/
}
/**
+ * Count survey respondents.
+ *
* @deprecated - api currently not supported
+ *
* @param array $params
* @return array
*/
*
* @copyright CiviCRM LLC (c) 2004-2014
* @version $Id: Domain.php 30171 2010-10-14 09:11:27Z mover $
- *
*/
/**
- * Flush all system caches
+ * Flush all system caches.
*
* @param array $params
* Input parameters.
}
/**
- * Adjust Metadata for Flush action
+ * Adjust Metadata for Flush action.
*
* The metadata is used for setting defaults, documentation & validation.
*
}
/**
- * System.Check API specification (optional)
+ * System.Check API specification (optional).
+ *
* This is used for documentation and validation.
*
* @param array $spec
* Description of fields supported by this API call.
- * @return void
+ *
* @see http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
*/
function _civicrm_api3_system_check_spec(&$spec) {
}
/**
- * System.Check API
+ * System.Check API.
*
* @param array $params
+ *
* @return array
* API result descriptor; return items are alert codes/messages
* @see civicrm_api3_create_success
}
/**
+ * Log entry to system log table.
+ *
* @param array $params
*
* @return array
*/
function civicrm_api3_system_log($params) {
$log = new CRM_Utils_SystemLogger();
- // this part means fields with separate db storage are accepted as params which kind of seems more intuitive to me
+ // This part means fields with separate db storage are accepted as params which kind of seems more intuitive to me
// because I felt like not doing this required a bunch of explanation in the spec function - but perhaps other won't see it as helpful?
if (!isset($params['context'])) {
$params['context'] = array();
}
/**
- * Metadata for log function
+ * Metadata for log function.
+ *
* @param array $params
*/
function _civicrm_api3_system_log_spec(&$params) {
}
/**
- * System.Get API
+ * System.Get API.
*
* @param array $params
+ *
* @return array
*/
function civicrm_api3_system_get($params) {
*
* @copyright CiviCRM LLC (c) 2004-2014
* @version $Id: SystemLog.php 30171 2010-10-14 09:11:27Z mover $
- *
*/
/**
+ * Delete system log record.
+ *
* @param array $params
*
* @return array
}
/**
- * Create system log
+ * Create system log record.
+ *
* It's arguable whether this function should exist as it fits our crud pattern and adding it meets our SyntaxConformance test requirements
* but it just wraps system.log which is more consistent with the PSR3 implemented.
+ *
* @param array $params
*
* @return array
}
/**
- * @param array $params
+ * Adjust system log create metadata.
*
- * @return void
+ * @param array $params
*/
function _civicrm_api3_system_log_create_spec(&$params) {
require_once 'api/v3/System.php';
}
/**
+ * Get system log record.
+ *
* @param array $params
*
* @return array
*
* Tags are used to classify CRM entities (including Contacts, Groups and Actions).
*
- * Allowed @params array keys are:
- *
- * {@example TagCreate.php}
- *
* @param array $params
+ * Array per getfields metadata.
*
* @return array
- * Array of newly created tag property values.
- * {@getfields tag_create}
*/
function civicrm_api3_tag_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
* This api is used for finding an existing tag.
* Either id or name of tag are required parameters for this api.
*
- * @example TagGet.php
- *
* @param array $params
- * An associative array of name/value pairs.
+ * Array per getfields metadata.
*
* @return array
* details of found tags else error
- * {@getfields tag_get}
*/
function civicrm_api3_tag_get($params) {
*
* @copyright CiviCRM LLC (c) 2004-2014
* @version $Id: UFField.php 30171 2010-10-14 09:11:27Z mover $
- *
*/
/**
* Defines 'uf field' within a group.
*
* @param array $params
- * Array Associative array of property name/value pairs to create new uf field.
+ * Array per getfields metadata.
*
* @throws API_Exception
*
}
/**
- * Gets field for civicrm_uf_field create
+ * Adjust metadata for civicrm_uf_field create.
*
* @param array $params
- *
- * @return void
- * fields valid for other functions
*/
function _civicrm_api3_uf_field_create_spec(&$params) {
$params['option.autoweight'] = array(
}
/**
- * Returns array of uf groups (profiles) matching a set of one or more group properties
+ * Returns array of uf groups (profiles) matching a set of one or more group properties.
*
* @param array $params
- * (reference) Array of one or more valid.
- * property_name=>value pairs. If $params is set
- * as null, all surveys will be returned
+ * Array per getfields metadata.
*
* @return array
- * (reference) Array
- * {@getfields UFField_get
- * @example UFFieldGet.php
*/
function civicrm_api3_uf_field_get($params) {
return _civicrm_api3_basic_get('CRM_Core_BAO_UFField', $params);
}
/**
- * Delete uf field
+ * Delete uf field.
*
* @param array $params
*
}
/**
- * field id accepted for backward compatibility - unset required on id
+ * Field id accepted for backward compatibility - unset required on id.
+ *
* @param array $params
*/
function _civicrm_api3_uf_field_delete_spec(&$params) {
*
* @copyright CiviCRM LLC (c) 2004-2014
* @version $Id: UFGroup.php 30171 2010-10-14 09:11:27Z mover $
- *
*/
/**
+ * Adjust metadata for create action.
+ *
* @param array $params
*/
function _civicrm_api3_uf_group_create_spec(&$params) {
$params['title']['api.required'] = 1;
$params['is_active']['api.default'] = 1;
$params['is_update_dupe']['api.default'] = 1;
- $params['created_id']['api.default'] = 'user_contact_id';//the current user
+ // Default to the logged in user.
+ $params['created_id']['api.default'] = 'user_contact_id';
$params['created_date']['api.default'] = 'now';
}
+
/**
- * Use this API to create a new group. See the CRM Data Model for uf_group property definitions
+ * Use this API to create a new group.
+ *
+ * See the CRM Data Model for uf_group property definitions
*
* @param array $params
- * Array Associative array of property name/value pairs to insert in group.
+ * Array per getfields metadata.
*
* @return array
* API result array
- * {@getfields UFGroup_create}
- * @example UFGroupCreate.php
*/
function civicrm_api3_uf_group_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
/**
- * Returns array of uf groups (profiles) matching a set of one or more group properties
+ * Returns array of uf groups (profiles) matching a set of one or more group properties.
*
* @param array $params
- * (reference) Array of one or more valid.
+ * Array of one or more valid.
* property_name=>value pairs. If $params is set
* as null, all surveys will be returned
*
* @return array
* Array of matching profiles
- * {@getfields UFGroup_get}
- * @example UFGroupGet.php
*/
function civicrm_api3_uf_group_get($params) {
}
/**
- * Delete uf group
+ * Delete uf group.
*
* @param array $params
*
- *
* @return array
*/
function civicrm_api3_uf_group_delete($params) {
*
* @copyright CiviCRM LLC (c) 2004-2014
* @version $Id: UFJoin.php 30171 2010-10-14 09:11:27Z mover $
- *
*/
/**
- * takes an associative array and creates a uf join in the database
+ * Takes an associative array and creates a uf join in the database.
*
* @param array $params
- * Assoc array of name/value pairs.
+ * Array per getfields metadata.
*
* @return array
* CRM_Core_DAO_UFJoin Array
*
* @param array $params
* Array or parameters determined by getfields.
+ *
* @todo - suspect module, weight don't need to be required - need to test
*/
function _civicrm_api3_uf_join_create_spec(&$params) {
}
/**
- * Get CiviCRM UF_Joins (ie joins between CMS user records & CiviCRM user record
+ * Get CiviCRM UF_Joins (ie joins between CMS user records & CiviCRM user record.
*
* @param array $params
- * (reference) an assoc array of name/value pairs.
+ * Array of name/value pairs.
*
* @return array
- * CiviCRM Result Array or null
+ * API result array.
+ *
* @todo Delete function missing
*/
function civicrm_api3_uf_join_get($params) {
*
* @copyright CiviCRM LLC (c) 2004-2014
* @version $Id: UFGroup.php 30171 2010-10-14 09:11:27Z mover $
- *
*/
/**
- * get the contact_id given a uf_id or vice versa
+ * Get the contact_id given a uf_id or vice versa.
*
* @param array $params
*
}
/**
- * Create or update a UF Match record
+ * Create or update a UF Match record.
*
* @param array $params
- * Associative array of property.
- * name/value pairs to insert in new 'survey'
- * @example UFMatch.php Std Create example
+ * Array per getfields metadata.
*
* @return array
- * api result array
- * {@getfields uf_match_create}
+ * Api result array
*/
function civicrm_api3_uf_match_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
/**
- * Create or update a survey
+ * Delete a UF Match record.
*
* @param array $params
- * Associative array of property.
- * name/value pairs to insert in new 'survey'
- * @example UFMatch.php Std Create example
*
* @return array
- * api result array
- * {@getfields uf_match_create}
+ * Api result array.
*/
function civicrm_api3_uf_match_delete($params) {
return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
*/
/**
- * Add an Website for a contact
- *
- * Allowed @params array keys are:
- * {@getfields website_create}
- * @example WebsiteCreate.php
- * {@example WebsiteCreate.php}
+ * Add an Website for a contact.
*
* @param array $params
*
* @return array
- * Array of newly created website property values.
+ * API result array.
* @todo convert to using basic create - BAO function non-std
*/
function civicrm_api3_website_create($params) {
}
/**
- * Deletes an existing Website
+ * Deletes an existing Website.
+ *
* @todo convert to using Basic delete - BAO function non standard
+ *
* @param array $params
- * {@getfields website_delete}
+ *
* @return array
* API result
* @throws \API_Exception
}
/**
- * Retrieve one or more websites
+ * Retrieve one or more websites.
*
* @param array $params
- * {@example WebsiteGet.php 0}
- * @example WebsiteGet.php
*
* @return array
* details of found websites
- *
*/
function civicrm_api3_website_get($params) {
return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, TRUE, 'website');
*
* @copyright CiviCRM LLC (c) 2004-2014
* @version $Id: Domain.php 30171 2010-10-14 09:11:27Z mover $
- *
*/
/**
- * Get CiviCRM Word Replacement details
- * {@getfields word_replacement_create}
+ * Get CiviCRM Word Replacement details.
+ *
* @param array $params
+ *
* @return array
* @throws \API_Exception
*/
/**
- * Create a new Word Replacement
+ * Create a new Word Replacement.
*
* @param array $params
*
* @return array
- *
- * {@getfields word_replacement_create}
*/
function civicrm_api3_word_replacement_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
/**
- * delete an existing word_replacement
- *
+ * Delete an existing word_replacement.
*
* @param array $params
- * Array containing id of the word_replacement.
- * to be deleted
+ * Array containing id of the word_replacement to be deleted.
*
* @return array
- * api result array
- *
+ * API result array
*/
function civicrm_api3_word_replacement_delete($params) {
return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
*
* @copyright CiviCRM LLC (c) 2004-2014
* @version $Id: utils.php 30879 2010-11-22 15:45:55Z shot $
- *
*/
/**
- * Initialize CiviCRM - should be run at the start of each API function
+ * Initialize CiviCRM - should be run at the start of each API function.
*/
function _civicrm_api3_initialize() {
require_once 'CRM/Core/ClassLoader.php';
}
/**
- * Wrapper Function for civicrm_verify_mandatory to make it simple to pass either / or fields for checking
+ * Wrapper Function for civicrm_verify_mandatory to make it simple to pass either / or fields for checking.
*
* @param array $params
* Array of fields to check.
}
/**
- * check mandatory fields are included
+ * Check mandatory fields are included.
*
* @param array $params
* Array of fields to check.
}
/**
+ * Create error array.
*
- * @param $msg
+ * @param string $msg
* @param array $data
+ *
* @return array
*/
function civicrm_api3_create_error($msg, $data = array()) {
// we will show sql to privileged user only (not sure of a specific
// security hole here but seems sensible - perhaps should apply to the trace as well?)
if (isset($data['sql']) && CRM_Core_Permission::check('Administer CiviCRM')) {
- $data['debug_information'] = $data['sql']; // Isn't this redundant?
+ // Isn't this redundant?
+ $data['debug_information'] = $data['sql'];
}
else {
unset($data['sql']);
}
/**
- * Format array in result output styple
+ * Format array in result output style.
*
* @param array|int $values values generated by API operation (the result)
* @param array $params
$allFields = array_keys($apiFields['values']);
}
$paramFields = array_keys($params);
- $undefined = array_diff($paramFields, $allFields, array_keys($_COOKIE), array('action', 'entity', 'debug', 'version', 'check_permissions', 'IDS_request_uri', 'IDS_user_agent', 'return', 'sequential', 'rowCount', 'option_offset', 'option_limit', 'custom', 'option_sort', 'options', 'prettyprint'));
+ $undefined = array_diff($paramFields, $allFields, array_keys($_COOKIE), array(
+ 'action',
+ 'entity',
+ 'debug',
+ 'version',
+ 'check_permissions',
+ 'IDS_request_uri',
+ 'IDS_user_agent',
+ 'return',
+ 'sequential',
+ 'rowCount',
+ 'option_offset',
+ 'option_limit',
+ 'custom',
+ 'option_sort',
+ 'options',
+ 'prettyprint',
+ ));
if ($undefined) {
$result['undefined_fields'] = array_merge($undefined);
}
$result['values'] = $values;
}
if (!empty($params['options']['metadata'])) {
- // we've made metadata an array but only supporting 'fields' atm
+ // We've made metadata an array but only supporting 'fields' atm.
if (in_array('fields', (array) $params['options']['metadata']) && $action !== 'getfields') {
- $fields = civicrm_api3($entity, 'getfields', array('action' => substr($action, 0, 3) == 'get' ? 'get' : 'create'));
+ $fields = civicrm_api3($entity, 'getfields', array(
+ 'action' => substr($action, 0, 3) == 'get' ? 'get' : 'create',
+ ));
$result['metadata']['fields'] = $fields['values'];
}
}
- // Report deprecations
+ // Report deprecations.
$deprecated = _civicrm_api3_deprecation_check($entity, $result);
- // Always report "update" action as deprecated
+ // Always report "update" action as deprecated.
if (!is_string($deprecated) && ($action == 'getactions' || $action == 'update')) {
$deprecated = ((array) $deprecated) + array('update' => 'The "update" action is deprecated. Use "create" with an id instead.');
}
if ($deprecated) {
- // Metadata-level deprecations or wholesale entity deprecations
+ // Metadata-level deprecations or wholesale entity deprecations.
if ($entity == 'entity' || $action == 'getactions' || is_string($deprecated)) {
$result['deprecated'] = $deprecated;
}
}
/**
- * Load the DAO of the entity
+ * Load the DAO of the entity.
+ *
* @param $entity
+ *
* @return bool
*/
function _civicrm_api3_load_DAO($entity) {
}
/**
- * return the DAO of the function or Entity
+ * Return the DAO of the function or Entity.
+ *
* @param string $name
* Either a function of the api (civicrm_{entity}_create or the entity name.
* return the DAO name to manipulate this function
* eg. "civicrm_api3_contact_create" or "Contact" will return "CRM_Contact_BAO_Contact"
+ *
* @return mixed|string
*/
function _civicrm_api3_get_DAO($name) {
}
/**
- * return the DAO of the function or Entity
+ * Return the DAO of the function or Entity.
+ *
* @param string $name
* Is either a function of the api (civicrm_{entity}_create or the entity name.
* return the DAO name to manipulate this function
* eg. "civicrm_contact_create" or "Contact" will return "CRM_Contact_BAO_Contact"
+ *
* @return mixed
*/
function _civicrm_api3_get_BAO($name) {
}
/**
- * Recursive function to explode value-separated strings into arrays
+ * Recursive function to explode value-separated strings into arrays.
+ *
* @param $values
*/
function _civicrm_api3_separate_values(&$values) {
_civicrm_api3_separate_values($value);
}
elseif (is_string($value)) {
- if ($key == 'case_type_id') {// this is to honor the way case API was originally written
+ // This is to honor the way case API was originally written.
+ if ($key == 'case_type_id') {
$value = trim(str_replace($sp, ',', $value), ',');
}
elseif (strpos($value, $sp) !== FALSE) {
}
/**
- * This is a legacy wrapper for api_store_values which will check the suitable fields using getfields
- * rather than DAO->fields
+ * This is a legacy wrapper for api_store_values.
*
- * Getfields has handling for how to deal with uniquenames which dao->fields doesn't
+ * It checks suitable fields using getfields rather than DAO->fields.
+ *
+ * Getfields has handling for how to deal with unique names which dao->fields doesn't
*
* Note this is used by BAO type create functions - eg. contribution
+ *
* @param string $entity
* @param array $params
* @param array $values
_civicrm_api3_store_values($fields, $params, $values);
}
/**
+ * Store values.
*
* @param array $fields
* @param array $params
}
/**
- * The API supports 2 types of get requestion. The more complex uses the BAO query object.
+ * Get function for query object api.
+ *
+ * The API supports 2 types of get request. The more complex uses the BAO query object.
* This is a generic function for those functions that call it
*
* At the moment only called by contact we should extend to contribution &
*
* Ideally this would be merged with _civicrm_get_query_object but we need to resolve differences in what the
* 2 variants call
+ *
* @param $entity
* @param array $params
* As passed into api get or getcount function.
}
/**
- * get dao query object based on input params
+ * Get dao query object based on input params.
+ *
* Ideally this would be merged with _civicrm_get_using_query_object but we need to resolve differences in what the
* 2 variants call
*
* @param array $params
* @param string $mode
* @param string $entity
+ *
* @return array
* [CRM_Core_DAO|CRM_Contact_BAO_Query]
*/
}
/**
- * Function transfers the filters being passed into the DAO onto the params object
+ * Function transfers the filters being passed into the DAO onto the params object.
+ *
* @param CRM_Core_DAO $dao
* @param array $params
* @param bool $unique
}
if (!empty($options['return']) && is_array($options['return']) && empty($options['is_count'])) {
$dao->selectAdd();
- $options['return']['id'] = TRUE;// ensure 'id' is included
+ // Ensure 'id' is included.
+ $options['return']['id'] = TRUE;
$allfields = _civicrm_api3_get_unique_name_array($dao);
$returnMatched = array_intersect(array_keys($options['return']), $allfields);
foreach ($returnMatched as $returnValue) {
$dao->selectAdd($returnValue);
}
- $unmatchedFields = array_diff(// not already matched on the field names
+ // Not already matched on the field names.
+ $unmatchedFields = array_diff(
array_keys($options['return']),
$returnMatched
);
$returnUniqueMatched = array_intersect(
$unmatchedFields,
- array_flip($allfields)// but a match for the field keys
+ // But a match for the field keys.
+ array_flip($allfields)
);
foreach ($returnUniqueMatched as $uniqueVal) {
$dao->selectAdd($allfields[$uniqueVal]);
}
/**
- * Apply filters (e.g. high, low) to DAO object (prior to find)
+ * Apply filters (e.g. high, low) to DAO object (prior to find).
+ *
* @param string $filterField
* Field name of filter.
* @param string $filterValue
/**
* Get sort, limit etc options from the params - supporting old & new formats.
- * get returnproperties for legacy
+ *
+ * Get returnProperties for legacy
*
* @param array $params
* Params array as passed into civicrm_api.
* @param bool $queryObject
- * Is this supporting a queryobject api (e.g contact) - if so we support more options.
+ * Is this supporting a queryObject api (e.g contact) - if so we support more options.
* for legacy report & return a unique fields array
*
* @param string $entity
}
/**
- * Apply options (e.g. sort, limit, order by) to DAO object (prior to find)
+ * Apply options (e.g. sort, limit, order by) to DAO object (prior to find).
*
* @param array $params
* Params array as passed into civicrm_api.
}
/**
- * build fields array. This is the array of fields as it relates to the given DAO
+ * Build fields array.
+ *
+ * This is the array of fields as it relates to the given DAO
* returns unique fields as keys by default but if set but can return by DB fields
*
* @param CRM_Core_DAO $bao
}
/**
- * build fields array. This is the array of fields as it relates to the given DAO
+ * Build fields array.
+ *
+ * This is the array of fields as it relates to the given DAO
* returns unique fields as keys by default but if set but can return by DB fields
*
* @param CRM_Core_DAO $bao
}
/**
- * Converts an DAO object to an array
+ * Converts an DAO object to an array.
*
* @param CRM_Core_DAO $dao
* Object to convert.
}
/**
+ * Determine if custom fields need to be retrieved.
+ *
* We currently retrieve all custom fields or none at this level so if we know the entity
* && it can take custom fields & there is the string 'custom' in their return request we get them all, they are filtered on the way out
* @todo filter so only required fields are queried
return FALSE;
}
$options = _civicrm_api3_get_options_from_params($params);
- //we check for possibility of 'custom' => 1 as well as specific custom fields
+ // We check for possibility of 'custom' => 1 as well as specific custom fields.
$returnString = implode('', $options['return']) . implode('', array_keys($options['return']));
if (stristr($returnString, 'custom')) {
return TRUE;
}
}
/**
- * Converts an object to an array
+ * Converts an object to an array.
*
* @param object $dao
* (reference) object to convert.
}
/**
- * Wrapper for _civicrm_object_to_array when api supports unique fields
+ * Wrapper for _civicrm_object_to_array when api supports unique fields.
+ *
* @param $dao
* @param $values
+ *
* @return array
*/
function _civicrm_api3_object_to_array_unique_fields(&$dao, &$values) {
}
/**
+ * Format custom parameters.
*
* @param array $params
* @param array $values
}
/**
+ * Format parameters for create action.
+ *
* @param array $params
* @param $entity
*/
}
/**
- * we can't rely on downstream to add separators to checkboxes so we'll check here. We should look at pushing to BAO function
+ * We can't rely on downstream to add separators to checkboxes so we'll check here.
+ *
+ * We should look at pushing to BAO function
* and / or validate function but this is a safe place for now as it has massive test coverage & we can keep the change very specific
* note that this is specifically tested in the GRANT api test case so later refactoring should use that as a checking point
*
* @todo - we are probably skipping handling disabled options as presumably getoptions is not giving us them. This should be non-regressive but might
* be fixed in future
*
- * @param $checkboxFieldValue
- * @param $customFieldLabel
- * @param $entity
- *
+ * @param mixed $checkboxFieldValue
+ * @param string $customFieldLabel
+ * @param string $entity
*/
function formatCheckBoxField(&$checkboxFieldValue, $customFieldLabel, $entity) {
if (is_string($checkboxFieldValue) && stristr($checkboxFieldValue, CRM_Core_DAO::VALUE_SEPARATOR)) {
- // we can assume it's pre-formatted
+ // We can assume it's pre-formatted.
return;
}
$options = civicrm_api($entity, 'getoptions', array('field' => $customFieldLabel, 'version' => 3));
if (!empty($options['is_error'])) {
- //the check is precautionary - can probably be removed later
+ // The check is precautionary - can probably be removed later.
return;
}
}
/**
+ * This function ensures that we have the right input parameters.
+ *
* @deprecated
- * This function ensures that we have the right input parameters
*
* This function is only called when $dao is passed into verify_mandatory.
* The practice of passing $dao into verify_mandatory turned out to be
- * unsatisfactory as the required fields @ the dao level is so diffent to the abstract
+ * unsatisfactory as the required fields @ the dao level is so different to the abstract
* api level. Hence the intention is to remove this function
- * & the associated param from viery_mandatory
+ * & the associated param from verify_mandatory
*
* @param array $params
* Associative array of property name/value.
* @daoName string DAO to check params agains
*
* @return bool
- * Sshould the missing fields be returned as an array (core error created as default)
+ * Should the missing fields be returned as an array (core error created as default)
* true if all fields present, depending on $result a core error is created of an array of missing fields is returned
*/
function _civicrm_api3_check_required_fields($params, $daoName, $return = FALSE) {
}
/**
- * Function to do a 'standard' api get - when the api is only doing a $bao->find then use this
+ * Function to do a 'standard' api get - when the api is only doing a $bao->find then use this.
*
* @param string $bao_name
* Name of BAO.
}
/**
- * Function to do a 'standard' api create - when the api is only doing a $bao::create then use this
+ * Function to do a 'standard' api create - when the api is only doing a $bao::create then use this.
*
* @param string $bao_name
* Name of BAO Class.
* @param array $params
*
* @throws API_Exception
- * @return CRM_Core_DAO|NULL an instance of the BAO
+ *
+ * @return CRM_Core_DAO|NULL
+ * An instance of the BAO
*/
function _civicrm_api3_basic_create_fallback($bao_name, &$params) {
$dao_name = get_parent_class($bao_name);
}
/**
- * Function to do a 'standard' api del - when the api is only doing a $bao::del then use this
- * if api::del doesn't exist it will try DAO delete method
+ * Function to do a 'standard' api del.
+ *
+ * When the api is only doing a $bao::del then use this if api::del doesn't exist it will try DAO delete method.
*
* @param string $bao_name
* @param array $params
}
/**
- * Get custom data for the given entity & Add it to the returnArray as 'custom_123' = 'custom string' AND 'custom_123_1' = 'custom string'
+ * Get custom data for the given entity & Add it to the returnArray.
+ *
+ * This looks like 'custom_123' = 'custom string' AND
+ * 'custom_123_1' = 'custom string'
* Where 123 is field value & 1 is the id within the custom group data table (value ID)
*
* @param array $returnArray
}
/**
- * Validate fields being passed into API. This function relies on the getFields function working accurately
+ * Validate fields being passed into API.
+ *
+ * This function relies on the getFields function working accurately
* for the given API. If error mode is set to TRUE then it will also check
* foreign keys
*
* As of writing only date was implemented.
+ *
* @param string $entity
* @param string $action
* @param array $params
* Response from getfields all variables are the same as per civicrm_api.
* @param bool $errorMode
* ErrorMode do intensive post fail checks?.
+ *
* @throws Exception
*/
function _civicrm_api3_validate_fields($entity, $action, &$params, $fields, $errorMode = FALSE) {
/**
* Validate date fields being passed into API.
+ *
* It currently converts both unique fields and DB field names to a mysql date.
* @todo - probably the unique field handling & the if exists handling is now done before this
* function is reached in the wrapper - can reduce this code down to assume we
* Uniquename of field being checked.
* @param array $fieldInfo
* Array of fields from getfields function.
+ *
* @throws Exception
*/
function _civicrm_api3_validate_date(&$params, &$fieldName, &$fieldInfo) {
}
/**
- * convert date into BAO friendly date
- * we accept 'whatever strtotime accepts'
+ * Convert date into BAO friendly date.
+ *
+ * We accept 'whatever strtotime accepts'
*
* @param string $dateValue
* @param string $fieldName
* Uniquename of field being checked.
* @param array $fieldInfo
* Array of fields from getfields function.
+ *
* @throws \API_Exception
*/
function _civicrm_api3_validate_constraint(&$fieldValue, &$fieldName, &$fieldInfo) {
* Params from civicrm_api.
* @param string $fieldName
* Uniquename of field being checked.
+ *
* @throws Exception
*/
function _civicrm_api3_validate_unique_key(&$params, &$fieldName) {
* @param array $params
* Params from civicrm_api, including:.
* - 'values': an array of records to save
- * - all other items: keys which identify new/pre-existing records
+ * - all other items: keys which identify new/pre-existing records.
+ *
* @return array|int
*/
function _civicrm_api3_generic_replace($entity, $params) {
}
/**
+ * Replace base parameters.
+ *
* @param array $params
*
- * @return mixed
+ * @return array
*/
function _civicrm_api3_generic_replace_base_params($params) {
$baseParams = $params;
}
/**
- * returns fields allowable by api
+ * Returns fields allowable by api.
*
* @param $entity
* String Entity to query.
* @return array
*/
function _civicrm_api_get_fields($entity, $unique = FALSE, &$params = array()) {
- $unsetIfEmpty = array('dataPattern', 'headerPattern', 'default', 'export', 'import');
+ $unsetIfEmpty = array(
+ 'dataPattern',
+ 'headerPattern',
+ 'default',
+ 'export',
+ 'import',
+ );
$dao = _civicrm_api3_get_DAO($entity);
if (empty($dao)) {
return array();
}
/**
- * Return an array of fields for a given entity - this is the same as the BAO function but
- * fields are prefixed with 'custom_' to represent api params
+ * Return an array of fields for a given entity.
+ *
+ * This is the same as the BAO function but fields are prefixed with 'custom_' to represent api params.
+ *
* @param $entity
* @param array $params
+ *
* @return array
*/
function _civicrm_api_get_custom_fields($entity, &$params) {
}
/**
- * Translate the custom field data_type attribute into a std 'type'
+ * Translate the custom field data_type attribute into a std 'type'.
+ *
* @param $dataType
+ *
* @return int
*/
function _getStandardTypeFromCustomDataType($dataType) {
/**
- * Fill params array with alternate (alias) values where a field has an alias and that is filled & the main field isn't
+ * Fill params array with alternate (alias) values where a field has an alias and that is filled & the main field isn't.
+ *
* If multiple aliases the last takes precedence
*
* Function also swaps unique fields for non-unique fields & vice versa.
+ *
* @param $apiRequest
* @param $fields
*/
/**
* Validate integer fields being passed into API.
- * It currently converts the incoming value 'user_contact_id' into the id of the currently logged in user
+ *
+ * It currently converts the incoming value 'user_contact_id' into the id of the currently logged in user.
*
* @param array $params
* Params from civicrm_api.
* @param array $fieldInfo
* Array of fields from getfields function.
* @param string $entity
+ *
* @throws API_Exception
*/
function _civicrm_api3_validate_integer(&$params, &$fieldName, &$fieldInfo, $entity) {
}
/**
- * Determine a contact ID using a string expression
+ * Determine a contact ID using a string expression.
*
* @param string $contactIdExpr
* E.g. "user_contact_id" or "@user:username".
+ *
* @return int|NULL|'unknown-user'
*/
function _civicrm_api3_resolve_contactID($contactIdExpr) {
- //if value = 'user_contact_id' replace value with logged in user id
+ // If value = 'user_contact_id' replace value with logged in user id.
if ($contactIdExpr == "user_contact_id") {
return CRM_Core_Session::getLoggedInContactID();
}
}
/**
- * Validate html (check for scripting attack)
+ * Validate html (check for scripting attack).
+ *
* @param array $params
* @param string $fieldName
* @param array $fieldInfo
/**
* Validate string fields being passed into API.
+ *
* @param array $params
* Params from civicrm_api.
* @param string $fieldName
* @param array $fieldInfo
* Array of fields from getfields function.
* @param string $entity
+ *
* @throws API_Exception
* @throws Exception
*/
}
/**
- * Validate & swap out any pseudoconstants / options
+ * Validate & swap out any pseudoconstants / options.
*
* @param mixed $fieldValue
* @param string $entity : api entity name
* @param string $fieldName : field name used in api call (not necessarily the canonical name)
* @param array $fieldInfo : getfields meta-data
+ *
* @throws \API_Exception
*/
function _civicrm_api3_api_match_pseudoconstant(&$fieldValue, $entity, $fieldName, $fieldInfo) {
if (!$options) {
if (strtolower($entity) == 'profile' && !empty($fieldInfo['entity'])) {
- // we need to get the options from the entity the field relates to
+ // We need to get the options from the entity the field relates to.
$entity = $fieldInfo['entity'];
}
- $options = civicrm_api($entity, 'getoptions', array('version' => 3, 'field' => $fieldInfo['name'], 'context' => 'validate'));
+ $options = civicrm_api($entity, 'getoptions', array(
+ 'version' => 3,
+ 'field' => $fieldInfo['name'],
+ 'context' => 'validate',
+ ));
$options = CRM_Utils_Array::value('values', $options, array());
}
- // If passed a value-separated string, explode to an array, then re-implode after matching values
+ // If passed a value-separated string, explode to an array, then re-implode after matching values.
$implode = FALSE;
if (is_string($fieldValue) && strpos($fieldValue, CRM_Core_DAO::VALUE_SEPARATOR) !== FALSE) {
$fieldValue = CRM_Utils_Array::explodePadded($fieldValue);
$implode = TRUE;
}
- // If passed multiple options, validate each
+ // If passed multiple options, validate each.
if (is_array($fieldValue)) {
foreach ($fieldValue as &$value) {
if (!is_array($value)) {
}
/**
- * Validate & swap a single option value for a field
+ * Validate & swap a single option value for a field.
*
* @param string $value field value
* @param array $options array of options for this field
* @param string $fieldName field name used in api call (not necessarily the canonical name)
+ *
* @throws API_Exception
*/
function _civicrm_api3_api_match_pseudoconstant_value(&$value, $options, $fieldName) {
}
/**
- * Returns the canonical name of a field
+ * Returns the canonical name of a field.
*
* @param $entity
* api entity name (string should already be standardized - no camelCase).
}
/**
+ * Check if the function is deprecated.
+ *
* @param string $entity
* @param array $result
+ *
* @return string|array|null
*/
function _civicrm_api3_deprecation_check($entity, $result = array()) {
}
/**
+ * Get the actual field value.
+ *
* In some case $params[$fieldName] holds Array value in this format Array([operator] => [value])
* So this function returns the actual field value
*
* @param array $params
* @param string $fieldName
+ *
* @return mixed
*/
function _civicrm_api3_field_value_check(&$params, $fieldName) {
require_once 'CiviTest/CiviUnitTestCase.php';
+/**
+ * Class CRM_Contribute_BAO_ContributionRecurTest
+ */
class CRM_Contribute_BAO_ContributionRecurTest extends CiviUnitTestCase {
protected $_params = array();
CRM_Core_DAO::executeQuery('SELECT id FROM civicrm_contact WHERE MATCH(first_name,last_name) AGAINST ("joe")');
}
+ /**
+ * @return mixed
+ */
public function supportsFts() {
return version_compare(CRM_Core_DAO::singleValueQuery('SELECT VERSION()'), '5.6.0', '>=');
}
*/
class CRM_Core_MenuTest extends CiviUnitTestCase {
+ /**
+ * @return array
+ */
public function pathArguments() {
$cases = array(); // array(0 => string $input, 1 => array $expectedOutput)
//$cases[] = array(NULL, array());
* Class CRM_Core_Page_RedirectTest
*/
class CRM_Core_Page_RedirectTest extends CiviUnitTestCase {
+ /**
+ * Get example data.
+ *
+ * @return array
+ */
+ /**
+ * @return array
+ */
public function examples() {
$cases = array();
// $cases[] = array(string $requestPath, string $requestArgs, string $pageArgs, string $expectedUrl)
$this->cids = array();
}
+ /**
+ * @return array
+ */
public function dataCreateStyle() {
return array(
array('sql-insert'),
);
}
+ /**
+ * @return array
+ */
public function dataCreateAndCommitStyles() {
return array(
array('sql-insert', 'implicit-commit'),
} // else: implicit-commit
}
+ /**
+ * @param $arg1
+ * @param $arg2
+ */
public function _preCommit($arg1, $arg2) {
$this->callbackLog[] = array('_preCommit', $arg1, $arg2);
}
+ /**
+ * @param $arg1
+ * @param $arg2
+ */
public function _postCommit($arg1, $arg2) {
$this->callbackLog[] = array('_postCommit', $arg1, $arg2);
}
+ /**
+ * @param $arg1
+ * @param $arg2
+ */
public function _preRollback($arg1, $arg2) {
$this->callbackLog[] = array('_preRollback', $arg1, $arg2);
}
+ /**
+ * @param $arg1
+ * @param $arg2
+ */
public function _postRollback($arg1, $arg2) {
$this->callbackLog[] = array('_postRollback', $arg1, $arg2);
}
$test->log[] = 'b-inner';
}
+/**
+ * @return array
+ */
function hooktesta_civicrm_testRunHooks_merge() {
return array('from-module-a1', 'from-module-a2');
}
return array();
}
+/**
+ * @return null
+ */
function hooktestd_civicrm_testRunHooks_merge() {
return NULL;
}
+/**
+ * @return array
+ */
function hookteste_civicrm_testRunHooks_merge() {
return array('from-module-e');
}
parent::setUp();
}
+ /**
+ * @return array
+ */
public function htmlToTextExamples() {
$cases = array(); // array(0 => string $html, 1 => string $text)
$this->assertEquals($expected, $actual);
}
+ /**
+ * @return array
+ */
public function booleanDataProvider() {
$cases = array(); // array(0 => $input, 1 => $expectedOutput)
$cases[] = array(TRUE, TRUE);
require_once 'CiviTest/CiviUnitTestCase.php';
+/**
+ * Class CRM_Utils_TimeTest
+ */
class CRM_Utils_TimeTest extends CiviUnitTestCase {
+ /**
+ * Equal cases.
+ *
+ * @return array
+ */
public function equalCases() {
$cases = array(); // array(0 => $timeA, 1 => $timeB, 2 => $threshold, 3 => $expectedResult)
$cases[] = array('2012-04-01 12:00:00', '2012-04-01 12:00:00', 0, 1);
}
/**
+ * Test equals.
+ *
* @param string $timeA
* @param string $timeB
* @param int $threshold
* @param bool $expectedResult
+ *
* @dataProvider equalCases
*/
public function testEquals($timeA, $timeB, $threshold, $expectedResult) {
require_once 'CiviTest/CiviUnitTestCase.php';
+/**
+ * Class CRM_Utils_versionCheckTest
+ */
class CRM_Utils_versionCheckTest extends CiviUnitTestCase {
/**
\CRM_Core_DAO_AllCoreTables::init(TRUE);
}
+ /**
+ * @return array
+ */
public function okDataProvider() {
$cases = array();
return $cases;
}
+ /**
+ * @return array
+ */
public function badDataProvider() {
$cases = array();
*/
class TransactionSubscriberTest extends \CiviUnitTestCase {
+ /**
+ * Get transaction options.
+ *
+ * @return array
+ */
public function transactionOptions() {
$r = array();
// $r[] = array(string $entity, string $action, array $params, bool $isTransactional, bool $isForceRollback, bool $isNested);
}
/**
- * Ensure that API parameters "is_transactional" and "force_rollback" are parsed correctly
+ * Ensure that API parameters "is_transactional" and "force_rollback" are parsed correctly.
+ *
* @dataProvider transactionOptions
+ *
* @param $version
* @param $entity
* @param $action
- * @param $params
- * @param $isTransactional
- * @param $isForceRollback
- * @param $isNested
+ * @param array $params
+ * @param bool $isTransactional
+ * @param bool $isForceRollback
+ * @param bool $isNested
+ *
* @throws \API_Exception
*/
public function testTransactionOptions($version, $entity, $action, $params, $isTransactional, $isForceRollback, $isNested) {
require_once 'CiviTest/CiviCaseTestCase.php';
+/**
+ * Class SequenceListenerTest
+ *
+ * @package Civi\CCase
+ */
class SequenceListenerTest extends \CiviCaseTestCase {
public function setUp() {
);
}
+ /**
+ * @param $expected
+ * @param $actual
+ * @param int $tolerance
+ */
public function assertApproxTime($expected, $actual, $tolerance = 1) {
$diff = abs(strtotime($expected) - strtotime($actual));
$this->assertTrue($diff <= $tolerance, sprintf("Check approx time equality. expected=[%s] actual=[%s] tolerance=[%s]",
}
}
+ /**
+ * @return string
+ */
protected function prepareTestSession() {
$result = parent::prepareTestSession();
}
/**
- * Assert that two numbers are approximately equal
+ * Assert that two numbers are approximately equal.
*
* @param int|float $expected
* @param int|float $actual
}
/**
+ * Assert attributes are equal.
+ *
* @param $expectedValues
* @param $actualValues
- * @param null $message
+ * @param string $message
*
* @throws PHPUnit_Framework_AssertionFailedError
*/
}
/**
- * Check that api returned 'is_error' => 0
- * else provide full message
+ * Check that api returned 'is_error' => 0.
+ *
* @param array $apiResult
* Api result.
* @param string $prefix
}
/**
- * Check that api returned 'is_error' => 1
- * else provide full message
+ * Check that api returned 'is_error' => 1.
*
* @param array $apiResult
* Api result.
}
/**
- * Check that a deleted item has been deleted
+ * Check that a deleted item has been deleted.
+ *
* @param $entity
* @param $id
*/
/**
* Create test generated example in api/v3/examples.
+ *
* To turn this off (e.g. on the server) set
* define(DONT_DOCUMENT_TEST_CONFIG ,1);
* in your settings file
+ *
* @param array $params
* Array as passed to civicrm_api function.
* @param array $result
/**
* Helper function to delete custom field
+ *
* @deprecated use function on parent class
+ *
+ * @param $params
*/
public static function deleteField($params) {
- require_once 'CRM/Core/BAO/CustomField.php';
CRM_Core_BAO_CustomField::deleteField($params);
}
/**
* Helper function to delete custom group
+ *
* @deprecated use function on parent class
+ *
+ * @param $params
+ *
* @return bool
* true if Group deleted, false otherwise
*/
public static function deleteGroup($params) {
- require_once 'CRM/Core/BAO/CustomGroup.php';
$deleteCustomGroup = CRM_Core_BAO_CustomGroup::deleteGroup($params, TRUE);
return $deleteCustomGroup;
}
require_once 'CiviTest/CiviSeleniumTestCase.php';
+/**
+ * Class WebTest_Activity_AddRecurringActivityTest
+ */
class WebTest_Activity_AddRecurringActivityTest extends CiviSeleniumTestCase {
protected function setUp() {
require_once 'CiviTest/CiviSeleniumTestCase.php';
+/**
+ * Class WebTest_Event_AddRecurringEventTest
+ */
class WebTest_Event_AddRecurringEventTest extends CiviSeleniumTestCase {
protected function setUp() {
parent::setUp();
}
+ /**
+ * @return array
+ */
public function testStandalonePledgeAdd() {
$this->webtestLogin();
<?php
/**
- * File for the TestActionSchedule class
+ * @file
+ * File for the TestActionSchedule class
*
* (PHP 5)
*
protected $_entity = 'action_schedule';
protected $_apiversion = 3;
-
/**
- * Test setup for every test
- *
- * Connect to the database, truncate the tables that will be used
- * and redirect stdin to a temporary file
+ * Test setup for every test.
*/
public function setUp() {
- // Connect to the database
parent::setUp();
$this->useTransaction(TRUE);
}
+ /**
+ * Test simple create action schedule.
+ */
public function testSimpleActionScheduleCreate() {
$oldCount = CRM_Core_DAO::singleValueQuery('select count(*) from civicrm_action_schedule');
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
- $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
$scheduledStatus = CRM_Core_OptionGroup::getValue('activity_status', 'Scheduled', 'name');
$mappingId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_ActionMapping', 'activity_type', 'id', 'entity_value');
$activityTypeId = CRM_Core_OptionGroup::getValue('activity_type', "Meeting", 'name');
'mapping_id' => $mappingId,
);
$actionSchedule = $this->callAPISuccess('action_schedule', 'create', $params);
- $this->assertTrue(is_numeric($actionSchedule['id']), "In line " . __LINE__);
- $this->assertTrue($actionSchedule['id'] > 0, "In line " . __LINE__);
+ $this->assertTrue(is_numeric($actionSchedule['id']));
+ $this->assertTrue($actionSchedule['id'] > 0);
$newCount = CRM_Core_DAO::singleValueQuery('select count(*) from civicrm_action_schedule');
$this->assertEquals($oldCount + 1, $newCount);
}
/**
- * Check if required fields are not passed
+ * Check if required fields are not passed.
*/
public function testActionScheduleCreateWithoutRequired() {
$params = array(
}
/**
- *
+ * Test create with scheduled dates.
*/
public function testActionScheduleWithScheduledDatesCreate() {
$oldCount = CRM_Core_DAO::singleValueQuery('select count(*) from civicrm_action_schedule');
'subject' => 'Test subject',
);
$actionSchedule = $this->callAPISuccess('action_schedule', 'create', $params);
- $this->assertTrue(is_numeric($actionSchedule['id']), "In line " . __LINE__);
- $this->assertTrue($actionSchedule['id'] > 0, "In line " . __LINE__);
+ $this->assertTrue(is_numeric($actionSchedule['id']));
+ $this->assertTrue($actionSchedule['id'] > 0);
$this->assertEquals($actionSchedule['values'][$actionSchedule['id']]['start_action_offset'][0], $params['start_action_offset']);
$newCount = CRM_Core_DAO::singleValueQuery('select count(*) from civicrm_action_schedule');
$this->assertEquals($oldCount + 1, $newCount);
protected $_apiversion = 3;
protected $_entity = 'loc_block';
+ /**
+ * Set up.
+ */
public function setUp() {
parent::setUp();
$this->useTransaction(TRUE);
}
+ /**
+ * Test creating location block.
+ */
public function testCreateLocBlock() {
$email = $this->callAPISuccess('email', 'create', array(
'contact_id' => 'null',
- 'location_type_id' => 1,
'email' => 'test@loc.block',
));
$phone = $this->callAPISuccess('phone', 'create', array(
$description = 'Create locBlock with existing entities';
$result = $this->callAPIAndDocument($this->_entity, 'create', $params, __FUNCTION__, __FILE__, $description, 'simpleCreate');
$id = $result['id'];
- $this->assertEquals(1, $result['count'], 'In line ' . __LINE__);
- $this->assertNotNull($result['values'][$id]['id'], 'In line ' . __LINE__);
+ $this->assertEquals(1, $result['count']);
+ $this->assertNotNull($result['values'][$id]['id']);
$this->getAndCheck($params, $id, $this->_entity);
}
+ /**
+ * Test creating location block entities.
+ */
public function testCreateLocBlockEntities() {
$params = array(
'email' => array(
$description = "Create entities and locBlock in 1 api call";
$result = $this->callAPIAndDocument($this->_entity, 'create', $params, __FUNCTION__, __FILE__, $description, 'createEntities');
$id = $result['id'];
- $this->assertEquals(1, $result['count'], 'In line ' . __LINE__);
+ $this->assertEquals(1, $result['count']);
- // Now check our results using the return param 'all'
+ // Now check our results using the return param 'all'.
$getParams = array(
'id' => $id,
'return' => 'all',
);
- // Can't use callAPISuccess with getsingle
+ // Can't use callAPISuccess with getsingle.
$result = $this->callAPIAndDocument($this->_entity, 'get', $getParams, __FUNCTION__, __FILE__, 'Get entities and location block in 1 api call', 'getEntities', 'get');
$result = array_pop($result['values']);
- $this->assertNotNull($result['email_id'], 'In line ' . __LINE__);
- $this->assertNotNull($result['phone_id'], 'In line ' . __LINE__);
- $this->assertNotNull($result['phone_2_id'], 'In line ' . __LINE__);
- $this->assertNotNull($result['address_id'], 'In line ' . __LINE__);
- $this->assertEquals($params['email']['email'], $result['email']['email'], 'In line ' . __LINE__);
- $this->assertEquals($params['phone_2']['phone'], $result['phone_2']['phone'], 'In line ' . __LINE__);
- $this->assertEquals($params['address']['street_address'], $result['address']['street_address'], 'In line ' . __LINE__);
- // Delete block
- $result = $this->callAPISuccess($this->_entity, 'delete', array('id' => $id));
+ $this->assertNotNull($result['email_id']);
+ $this->assertNotNull($result['phone_id']);
+ $this->assertNotNull($result['phone_2_id']);
+ $this->assertNotNull($result['address_id']);
+ $this->assertEquals($params['email']['email'], $result['email']['email']);
+ $this->assertEquals($params['phone_2']['phone'], $result['phone_2']['phone']);
+ $this->assertEquals($params['address']['street_address'], $result['address']['street_address']);
+
+ $this->callAPISuccess($this->_entity, 'delete', array('id' => $id));
}
}
/**
* Class contains api test cases for "civicrm_note"
- *
*/
class api_v3_NoteTest extends CiviUnitTestCase {
public function setUp() {
$this->_apiversion = 3;
- // Connect to the database
+ // Connect to the database.
parent::setUp();
$this->useTransaction(TRUE);
///////////////// civicrm_note_get methods
/**
- * Check retrieve note with empty parameter array
+ * Check retrieve note with empty parameter array.
+ *
* Error expected
*/
public function testGetWithEmptyParams() {
}
/**
- * Check retrieve note with missing patrameters
+ * Check retrieve note with missing parameters.
+ *
* Error expected
*/
public function testGetWithoutEntityId() {
$params = array(
'entity_table' => 'civicrm_contact',
);
- $note = $this->callAPISuccess('note', 'get', $params);
+ $this->callAPISuccess('note', 'get', $params);
}
/**
- * Check civicrm_note_get
+ * Check civicrm_note get.
*/
public function testGet() {
$entityId = $this->_noteID;
'entity_table' => 'civicrm_contact',
'entity_id' => $entityId,
);
- $result = $this->callAPIAndDocument('note', 'get', $params, __FUNCTION__, __FILE__);
+ $this->callAPIAndDocument('note', 'get', $params, __FUNCTION__, __FILE__);
}
-
- ///////////////// civicrm_note_create methods
-
/**
- * Check create with empty parameter array
+ * Check create with empty parameter array.
+ *
* Error Expected
*/
public function testCreateWithEmptyNoteField() {
$this->_params['note'] = "";
- $result = $this->callAPIFailure('note', 'create', $this->_params,
- 'Mandatory key(s) missing from params array: note');
+ $this->callAPIFailure('note', 'create', $this->_params,
+ 'Mandatory key(s) missing from params array: note'
+ );
}
/**
- * Check create with partial params
+ * Check create with partial params.
+ *
* Error expected
*/
public function testCreateWithoutEntityId() {
unset($this->_params['entity_id']);
- $result = $this->callAPIFailure('note', 'create', $this->_params,
+ $this->callAPIFailure('note', 'create', $this->_params,
'Mandatory key(s) missing from params array: entity_id');
}
/**
- * Check create with partially empty params
+ * Check create with partially empty params.
+ *
* Error expected
*/
public function testCreateWithEmptyEntityId() {
$this->_params['entity_id'] = "";
- $result = $this->callAPIFailure('note', 'create', $this->_params,
+ $this->callAPIFailure('note', 'create', $this->_params,
'Mandatory key(s) missing from params array: entity_id');
}
/**
- * Check civicrm_note_create
+ * Check civicrm note create.
*/
public function testCreate() {
}
/**
- * Check civicrm_note_create - tests used of default set to now
+ * Check civicrm_note_create - tests used of default set to .
*/
public function testCreateWithoutModifiedDate() {
unset($this->_params['modified_date']);
));
}
-
- ///////////////// civicrm_note_update methods
-
/**
- * Check update with empty parameter array
+ * Check update with empty parameter array.
+ *
* Please don't copy & paste this - is of marginal value
* better to put time into the function on Syntax Conformance class that tests this
*/
public function testUpdateWithEmptyParams() {
- $note = $this->callAPIFailure('note', 'create', array());
+ $this->callAPIFailure('note', 'create', array());
}
/**
- * Check update with missing parameter (contact id)
+ * Check update with missing parameter (contact id).
+ *
* Error expected
*/
public function testUpdateWithoutContactId() {
'entity_id' => $this->_contactID,
'entity_table' => 'civicrm_contact',
);
- $note = $this->callAPIFailure('note', 'create', $params,
+ $this->callAPIFailure('note', 'create', $params,
'Mandatory key(s) missing from params array: note'
);
}
/**
- * Check civicrm_note_update
+ * Check civicrm_note update.
*/
public function testUpdate() {
$params = array(
'subject' => 'Hello World',
);
- //Update Note
+ // Update Note.
$this->callAPISuccess('note', 'create', $params);
$note = $this->callAPISuccess('Note', 'Get', array());
$this->assertEquals($note['id'], $this->_noteID, 'in line ' . __LINE__);
$this->assertEquals('Note1', $note['values'][$this->_noteID]['note'], 'in line ' . __LINE__);
}
- ///////////////// civicrm_note_delete methods
-
-
/**
- * Check delete with empty parametes array
- * Error expected
+ * Check delete with empty parameters array.
+ *
+ * Error expected.
*/
public function testDeleteWithEmptyParams() {
- $deleteNote = $this->callAPIFailure('note', 'delete', array(), 'Mandatory key(s) missing from params array: id');
+ $this->callAPIFailure('note', 'delete', array(), 'Mandatory key(s) missing from params array: id');
}
/**
- * Check delete with wrong id
+ * Check delete with wrong id.
+ *
* Error expected
*/
public function testDeleteWithWrongID() {
$params = array(
'id' => 0,
);
- $deleteNote = $this->callAPIFailure('note', 'delete', $params, 'Mandatory key(s) missing from params array: id');
+ $this->callAPIFailure('note', 'delete', $params, 'Mandatory key(s) missing from params array: id');
}
/**
- * Check civicrm_note_delete
+ * Check civicrm_note delete.
*/
public function testDelete() {
$additionalNote = $this->noteCreate($this->_contactID);
'id' => $additionalNote['id'],
);
- $result = $this->callAPIAndDocument('note', 'delete', $params, __FUNCTION__, __FILE__);
+ $this->callAPIAndDocument('note', 'delete', $params, __FUNCTION__, __FILE__);
}
}
/**
- * Test civicrm_activity_create() using example code
+ * Test civicrm note create() using example code.
*/
function testNoteCreateExample() {
require_once 'api/v3/examples/Note/Create.php';
- $result = UF_match_get_example();
- $expectedResult = UF_match_get_expectedresult();
+ $result = Note_get_example();
+ $expectedResult = Note_get_expectedresult();
$this->assertEquals($result, $expectedResult);
}
public $DBResetRequired = TRUE;
+ /**
+ * @var int
+ */
+ protected $priceFieldID;
+
+ /**
+ * Setup function.
+ */
public function setUp() {
parent::setUp();
- // put stuff here that should happen before all tests in this unit
- $priceSetparams = array(
- # [domain_id] =>
+ // Put stuff here that should happen before all tests in this unit.
+ $priceSetParams = array(
'name' => 'default_goat_priceset',
- 'title' => 'Goat accomodation',
+ 'title' => 'Goat accommodation',
'is_active' => 1,
'help_pre' => "Where does your goat sleep",
'help_post' => "thank you for your time",
'is_reserved' => 1,
);
- $price_set = $this->callAPISuccess('price_set', 'create', $priceSetparams);
+ $price_set = $this->callAPISuccess('price_set', 'create', $priceSetParams);
$this->priceSetID = $price_set['id'];
- $priceFieldparams = array(
+ $priceFieldParams = array(
'price_set_id' => $this->priceSetID,
'name' => 'grassvariety',
'label' => 'Grass Variety',
'is_enter_qty' => 1,
'is_active' => 1,
);
- $priceField = $this->callAPISuccess('price_field', 'create', $priceFieldparams);
+ $priceField = $this->callAPISuccess('price_field', 'create', $priceFieldParams);
$this->priceFieldID = $priceField['id'];
$this->_params = array(
'price_field_id' => $this->priceFieldID,
- 'name' => 'ryegrass',
+ 'name' => 'rye grass',
'label' => 'juicy and healthy',
'amount' => 1,
);
$membershipOrgId = $this->organizationCreate(NULL);
$this->_membershipTypeID = $this->membershipTypeCreate(array('member_of_contact_id' => $membershipOrgId));
- $priceSetparams1 = array(
+ $priceSetParams1 = array(
'name' => 'priceset',
'title' => 'Priceset with Multiple Terms',
'is_active' => 1,
'is_quick_config' => 1,
'is_reserved' => 1,
);
- $price_set1 = $this->callAPISuccess('price_set', 'create', $priceSetparams1);
+ $price_set1 = $this->callAPISuccess('price_set', 'create', $priceSetParams1);
$this->priceSetID1 = $price_set1['id'];
- $priceFieldparams1 = array(
+ $priceFieldParams1 = array(
'price_set_id' => $this->priceSetID1,
'name' => 'memtype',
'label' => 'memtype',
'is_enter_qty' => 1,
'is_active' => 1,
);
- $priceField1 = $this->callAPISuccess('price_field', 'create', $priceFieldparams1);
+ $priceField1 = $this->callAPISuccess('price_field', 'create', $priceFieldParams1);
$this->priceFieldID1 = $priceField1['id'];
}
+ /**
+ * Tear down function.
+ *
+ * @throws \Exception
+ */
public function tearDown() {
$tablesToTruncate = array(
'civicrm_contact',