'type' => 'next',
'name' => ts('Save'),
'spacing' => '',
- 'isDefault' => FALSE
+ 'isDefault' => FALSE,
),
)
);
CRM_Core_Session::setStatus(
ts('The %1 role was assigned one or more permissions that may prove dangerous for users of that role to have. Please reconsider assigning %2 to them.', array(
1 => $wp_roles->role_names[$role],
- 2 => implode(', ', $warningPermissionNames)
+ 2 => implode(', ', $warningPermissionNames),
)),
ts('Unsafe Permission Settings')
);
array(
'title' => ts('Access Control'),
'url' => CRM_Utils_System::url('civicrm/admin/access', 'reset=1'),
- )
+ ),
);
CRM_Utils_System::appendBreadCrumb($breadCrumb);
'url' => CRM_Utils_System::url('civicrm/admin/access',
'reset=1'
),
- )
+ ),
);
CRM_Utils_System::appendBreadCrumb($breadCrumb);
CRM_Utils_System::setTitle(ts('Assign Users to Roles'));
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2014
* $Id$
- *
*/
/**
- * This class is for activity functions
- *
+ * This class is for activity functions.s
*/
class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity {
static $_importableFields = NULL;
/**
- * Check if there is absolute minimum of data to add the object
+ * Check if there is absolute minimum of data to add the object.
*
* @param array $params
* (reference ) an assoc array of name/value pairs.
*
- * @return boolean
+ * @return bool
*/
public static function dataExists(&$params) {
if (!empty($params['source_contact_id']) || !empty($params['id'])) {
}
/**
- * Fetch object based on array of properties
+ * Fetch object based on array of properties.
*
* @param array $params
* (reference ) an assoc array of name/value pairs.
}
/**
- * Delete the activity
+ * Delete the activity.
*
* @param array $params
* @param bool $moveToTrash
*
- * @return void
+ * @return mixed
*/
public static function deleteActivity(&$params, $moveToTrash = FALSE) {
// CRM-9137
}
/**
- * Delete activity assignment record
+ * Delete activity assignment record.
*
* @param int $activityId
* @param int $recordTypeID
- *
- * @return null
*/
public static function deleteActivityContact($activityId, $recordTypeID = NULL) {
$activityContact = new CRM_Activity_BAO_ActivityContact();
}
/**
- * Process the activities
+ * Process the activities.
*
* @param array $params
* Associated array of the submitted values.
*
* @throws CRM_Core_Exception
*
- * @return $this|null|object
+ * @return CRM_Activity_BAO_Activity|null|object
*/
public static function create(&$params) {
// check required params
}
/**
- * @param $activity
- * @param null $logMessage
+ * Create an activity.
+ *
+ * @todo elaborate on what this does.
+ *
+ * @param CRM_Core_DAO_Activity $activity
+ * @param string $logMessage
*
* @return bool
*/
}
/**
- * Get the list Activities
+ * Get the list Activities.
*
* @param array $input
* Array of parameters.
* - activity_type_id int|string the activitiy types we want to restrict by
*
* @return array
- * (reference) $values the relevant data object values of open activities
- *
+ * Relevant data object values of open activities
*/
public static function &getActivities($input) {
//step 1: Get the basic activity data
}
/**
- * Get the component id and name those are enabled and logged in
- * user has permission. To decide whether we are going to include
- * component related activities w/ core activity retrieve process.
+ * Get the component id and name if those are enabled and allowed.
+ *
+ * Checks whether logged in user has permission.
+ * To decide whether we are going to include
+ * component related activities with core activity retrieve process.
+ * (what did that just mean?)
*
* @return array
* Array of component id and name.
- **/
+ */
public static function activityComponents() {
$components = array();
$compInfo = CRM_Core_Component::getEnabledComponents();
}
/**
- * Get the activity Count
+ * Get the activity Count.
*
* @param array $input
* Array of parameters.
*
* @return int
* count of activities
- *
*/
public static function &getActivitiesCount($input) {
$input['count'] = TRUE;
}
/**
- * Get the activity sql clause to pick activities
+ * Get the activity sql clause to pick activities.
*
* @param array $input
* Array of parameters.
*
* @return int
* count of activities
- *
*/
public static function getActivitySQLClause($input) {
$params = array();
$includeCaseActivities = TRUE;
}
-
// build main activity table select clause
$sourceSelect = '';
}
/**
- * Send the message to all the contacts and also insert a
- * contact activity in each contacts record
+ * Send the message to all the contacts.
+ *
+ * Also insert a contact activity in each contacts record.
*
* @param array $contactDetails
* The array of contact details to send the email.
* @return array
* ( sent, activityId) if any email is sent and activityId
*/
- static function sendEmail(
+ public static function sendEmail(
&$contactDetails,
&$subject,
&$text,
$attachments = NULL,
$cc = NULL,
$bcc = NULL,
- $contactIds, // FIXME a param with no default shouldn't be last
+ // FIXME a param with no default shouldn't be last
+ $contactIds,
$additionalDetails = NULL
) {
// get the contact details of logged in contact, which we set as from email
}
}
-
// get token details for contacts, call only if tokens are used
$details = array();
if (!empty($returnProperties) || !empty($tokens) || !empty($allTokens)) {
}
/**
+ * Send SMS.
+ *
* @param array $contactDetails
* @param array $activityParams
* @param array $smsParams
* @return array
* @throws CRM_Core_Exception
*/
- static function sendSMS(
+ public static function sendSMS(
&$contactDetails,
&$activityParams,
&$smsParams = array(),
}
/**
- * Send the sms message to a specific contact
+ * Send the sms message to a specific contact.
*
* @param int $toID
* The contact id of the recipient.
* @param $tokenText
- * @param $tokenHtml
* @param array $smsParams
* The params used for sending sms.
* @param int $activityID
* @return bool|PEAR_Error
* true on success or PEAR_Error object
*/
- static function sendSMSMessage(
+ public static function sendSMSMessage(
$toID,
&$tokenText,
$smsParams = array(),
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
-
// add activity target record for every sms that is send
$activityTargetParams = array(
'activity_id' => $activityID,
}
/**
- * Send the message to a specific contact
+ * Send the message to a specific contact.
*
* @param string $from
* The name and email of the sender.
* @param null $cc
* @param null $bcc
*
- * @return boolean
- * true if successfull else false.
+ * @return bool
+ * TRUE if successful else FALSE.
*/
- static function sendMessage(
+ public static function sendMessage(
$from,
$fromID,
$toID,
}
/**
- * Combine all the importable fields from the lower levels object
+ * Combine all the importable fields from the lower levels object.
*
* The ordering is important, since currently we do not have a weight
* scheme. Adding weight is super important and should be done in the
}
/**
- * get the Activities of a target contact
+ * Get the Activities of a target contact.
*
* @param int $contactId
* Id of the contact whose activities need to find.
$assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
$targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
-
// First look for activities where contactId is one of the targets
$query = "
SELECT activity_id, record_type_id
}
/**
- * Add activity for Membership/Event/Contribution
+ * Add activity for Membership/Event/Contribution.
*
* @param object $activity
* (reference) particular component object.
* For Membership Signup or Renewal.
* @param int $targetContactID
*
- * @return bool
+ * @return bool|NULL
*/
- static function addActivity(
+ public static function addActivity(
&$activity,
$activityType = 'Membership Signup',
$targetContactID = NULL
elseif ($activity->__table == 'civicrm_contribution') {
//create activity record only for Completed Contributions
if ($activity->contribution_status_id != 1) {
- return;
+ return NULL;
}
$subject = NULL;
}
/**
- * Get Parent activity for currently viewed activity
+ * Get Parent activity for currently viewed activity.
*
* @param int $activityId
* Current activity id.
*
* @return int
- * $parentId Id of parent activity otherwise false.
+ * Id of parent activity otherwise false.
*/
public static function getParentActivity($activityId) {
static $parentActivities = array();
}
/**
- * Get total count of prior revision of currently viewd activity
+ * Get total count of prior revision of currently viewed activity.
*
* @param $activityID
* Current activity id.
}
/**
- * Get all prior activities of currently viewed activity
+ * Get all prior activities of currently viewed activity.
*
* @param $activityID
* Current activity id.
}
/**
- * Find the latest revision of a given activity
+ * Find the latest revision of a given activity.
*
* @param int $activityID
* Prior activity id.
}
/**
- * Create a follow up a given activity
+ * Create a follow up a given activity.
*
* @param int $activityId
* activity id of parent activity.
* @param array $params
*
- * @return $this|null|object
+ * @return CRM_Activity_BAO_Activity|null|object
*/
public static function createFollowupActivity($activityId, $params) {
if (!$activityId) {
- return;
+ return NULL;
}
$session = CRM_Core_Session::singleton();
*
* @return string|bool
* if file exists returns $activityTypeFile activity filename otherwise false.
- *
*/
public static function getFileForActivityTypeId($activityTypeId, $crmDir = 'Activity') {
$activityTypes = CRM_Case_PseudoConstant::caseActivityType(FALSE, TRUE);
}
/**
- * Restore the activity
+ * Restore the activity.
*
* @param array $params
*
- * @return void
+ * @return CRM_Activity_DAO_Activity
*/
public static function restoreActivity(&$params) {
$activity = new CRM_Activity_DAO_Activity();
}
/**
- * Get the exportable fields for Activities
+ * Get the exportable fields for Activities.
*
* @param string $name
* If it is called by case $name = Case else $name = Activity.
'type' => CRM_Utils_Type::T_STRING,
);
-
$Activityfields = array(
- 'activity_type' => array('title' => ts('Activity Type'), 'name' => 'activity_type', 'type' => CRM_Utils_Type::T_STRING),
- 'activity_status' => array('title' => ts('Activity Status'), 'name' => 'activity_status', 'type' => CRM_Utils_Type::T_STRING),
+ 'activity_type' => array(
+ 'title' => ts('Activity Type'),
+ 'name' => 'activity_type',
+ 'type' => CRM_Utils_Type::T_STRING,
+ ),
+ 'activity_status' => array(
+ 'title' => ts('Activity Status'),
+ 'name' => 'activity_status',
+ 'type' => CRM_Utils_Type::T_STRING,
+ ),
);
$fields = array_merge($Activityfields, $exportableFields);
}
}
/**
- * Get the allowed profile fields for Activities
+ * Get the allowed profile fields for Activities.
*
* @return array
* array of activity profile Fields
}
/**
- * This function deletes the activity record related to contact record,
- * when there are no target and assignee record w/ other contact.
+ * This function deletes the activity record related to contact record.
+ *
+ * This is conditional on there being no target and assignee record
+ * with other contacts.
*
* @param int $contactId
* ContactId.
}
/**
- * Does user has sufficient permission for view/edit activity record?
+ * Does user has sufficient permission for view/edit activity record.
*
* @param int $activityId
* Activity record id.
* @param int $action
* Edit/view.
*
- * @return boolean
+ * @return bool
*/
public static function checkPermission($activityId, $action) {
$allow = FALSE;
}
/**
- * wrapper for ajax activity selector
+ * Wrapper for ajax activity selector.
*
* @param array $params
* Associated array for params record id.
*
* @return array
- * associated array of contact activities
+ * Associated array of contact activities
*/
public static function getContactActivitySelector(&$params) {
// format the params
}
/**
- * copy custom fields and attachments from an existing activity to another.
+ * Copy custom fields and attachments from an existing activity to another.
+ *
* @see CRM_Case_Page_AJAX::_convertToCaseActivity()
*
* @param array $params
}
foreach ($customValues as $key => $value) {
- if ($value !== NULL) { // CRM-10542
+ if ($value !== NULL) {
+ // CRM-10542
if (in_array($key, $htmlType)) {
$fileValues = CRM_Core_BAO_File::path($value, $params['activityID']);
$customParams["custom_{$key}_-1"] = array(
}
/**
+ * Get activity contact.
+ *
* @param int $activityId
* @param int $recordTypeID
* @param string $column
}
/**
+ * Get source contact id.
+ *
* @param int $activityId
*
* @return null
}
/**
+ * Set api filter.
+ *
+ * @todo Document what this is for.
+ *
* @param array $params
*/
public function setApiFilter(&$params) {
$status = array(ts('%count activities tagged', array('count' => $added, 'plural' => '%count activities tagged')));
if ($notAdded) {
$status[] = ts('%count activities already had this tag', array(
- 'count' => $notAdded,
- 'plural' => '%count activities already had this tag'
- ));
+ 'count' => $notAdded,
+ 'plural' => '%count activities already had this tag',
+ ));
}
$status = '<ul><li>' . implode('</li><li>', $status) . '</li></ul>';
CRM_Core_Session::setStatus($status, ts("Added Tag <em>%1</em>", array(1 => $this->_tags[$key])), 'success', array('expires' => 0));
);
$this->addRule('name', ts('Name already exists in Database.'), 'objectExists', array(
'CRM_Core_DAO_Mapping',
- $this->_id
+ $this->_id,
));
$this->addElement('text', 'description', ts('Description'),
// Address Standardization
$addrProviders = array(
- '' => '- select -'
- ) + CRM_Core_SelectValues::addressProvider();
+ '' => '- select -',
+ ) + CRM_Core_SelectValues::addressProvider();
$this->_varNames = array(
CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME => array(
return;
}
elseif ($this->_action & (CRM_Core_Action::UPDATE)) {
- $this->_mappingID =
- CRM_Core_DAO::getFieldValue('CRM_Core_DAO_ActionSchedule', $this->_id, 'mapping_id');
+ $this->_mappingID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_ActionSchedule', $this->_id, 'mapping_id');
if ($this->_context == 'event') {
$this->_compId = CRM_Utils_Request::retrieve('compId', 'Integer', $this);
}
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2014
* $Id$
- *
*/
/**
* This class generates form components generic to CiviCRM settings
- *
*/
class CRM_Admin_Form_Setting extends CRM_Core_Form {
/**
* Set default values for the form.
- * default values are retrieved from the database
*
- *
- * @return void
+ * Default values are retrieved from the database.
*/
public function setDefaultValues() {
if (!$this->_defaults) {
//Set defaults for autocomplete and contact reference options
$this->_defaults['autocompleteContactSearch'] = array(
- '1' => 1
- ) + $autoSearchFields;
+ '1' => 1,
+ ) + $autoSearchFields;
$this->_defaults['autocompleteContactReference'] = array(
- '1' => 1
- ) + $cRSearchFields;
+ '1' => 1,
+ ) + $cRSearchFields;
// we can handle all the ones defined in the metadata here. Others to be converted
foreach ($this->_settings as $setting => $group) {
}
/**
- * Build the form object
- *
- * @return void
+ * Build the form object.
*/
public function buildQuickForm() {
$session = CRM_Core_Session::singleton();
}
/**
- * Process the form submission
- *
- *
- * @return void
+ * Process the form submission.
*/
public function postProcess() {
// store the submitted values in an array
}
/**
+ * Common Process.
+ *
+ * @todo Document what I do.
+ *
* @param array $params
*/
public function commonProcess(&$params) {
* add the rules (mainly global rules) for form.
* All local rules are added near the element
*
- * @param null
- *
* @return void
*/
public function addRules() {
);
$this->addRule('name', ts('Name already exists in Database.'), 'objectExists', array(
'CRM_Core_DAO_Tag',
- $this->_id
+ $this->_id,
));
$this->add('text', 'description', ts('Description'),
array(
'title' => ts('Word Replacements'),
'url' => $breadCrumbUrl,
- )
+ ),
);
CRM_Utils_System::appendBreadCrumb($breadCrumb);
}
*/
public function postProcess() {
$params = $this->controller->exportValues($this->_name);
- $this->_numStrings = sizeof($params['old']);
+ $this->_numStrings = count($params['old']);
$enabled['exactMatch'] = $enabled['wildcardMatch'] = $disabled['exactMatch'] = $disabled['wildcardMatch'] = array();
for ($i = 1; $i <= $this->_numStrings; $i++) {
$ret['illegal'] = TRUE;
$table = $template->fetch('CRM/Price/Page/table.tpl');
$ret['content'] = ts('Unable to disable the \'%1\' price set - it is currently in use by one or more active events, contribution pages or contributions.', array(
- 1 => $priceSet
+ 1 => $priceSet,
)) . "<br/> $table";
}
else {
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2014
* $Id$
- *
*/
/**
protected $_searchVoterFor;
/**
- * Processing needed for buildForm and later
- *
- * @return void
+ * Processing needed for buildForm and later.
*/
- function preProcess() {
+ public function preProcess() {
$this->_search = CRM_Utils_Array::value('search', $_GET);
$this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE);
$this->_surveyId = CRM_Utils_Request::retrieve('sid', 'Positive', $this);
}
/**
- * Build the form object
- *
- *
- * @return void
+ * Build the form object.
*/
public function buildQuickForm() {
if ($this->_search) {
* Set default values for the form. Note that in edit/view mode
* the default values are retrieved from the database
*
- * @param null
- *
* @return array
* array of default values
*/
/**
* Build the form object
*
- * @param null
- *
* @return void
*/
public function buildQuickForm() {
/**
* Process the form
*
- * @param null
- *
* @return void
*/
public function postProcess() {
if (!$this->_reportId && $survey->id && !empty($params['create_report'])) {
$activityStatus = CRM_Core_PseudoConstant::activityStatus('name');
$activityStatus = array_flip($activityStatus);
- $this->_params =
- array(
- 'name' => "survey_{$survey->id}",
- 'title' => $params['report_title'] ? $params['report_title'] : $this->_values['title'],
- 'status_id_op' => 'eq',
- 'status_id_value' => $activityStatus['Scheduled'], // reserved status
- 'survey_id_value' => array($survey->id),
- 'description' => ts('Detailed report for canvassing, phone-banking, walk lists or other surveys.'),
- );
+ $this->_params = array(
+ 'name' => "survey_{$survey->id}",
+ 'title' => $params['report_title'] ? $params['report_title'] : $this->_values['title'],
+ 'status_id_op' => 'eq',
+ 'status_id_value' => $activityStatus['Scheduled'], // reserved status
+ 'survey_id_value' => array($survey->id),
+ 'description' => ts('Detailed report for canvassing, phone-banking, walk lists or other surveys.'),
+ );
//Default value of order by
- $this->_params['order_bys'] =
- array(
- 1 => array(
- 'column' => 'sort_name',
- 'order' => 'ASC',
- ),
- );
+ $this->_params['order_bys'] = array(
+ 1 => array(
+ 'column' => 'sort_name',
+ 'order' => 'ASC',
+ ),
+ );
// for WalkList or default
$displayFields = array(
'id',
if (CRM_Core_OptionGroup::getValue('activity_type', 'WalkList') ==
$this->_values['activity_type_id']
) {
- $this->_params['order_bys'] =
- array(
- 1 => array(
- 'column' => 'street_name',
- 'order' => 'ASC',
- ),
- 2 => array(
- 'column' => 'street_number_odd_even',
- 'order' => 'ASC',
- ),
- 3 => array(
- 'column' => 'street_number',
- 'order' => 'ASC',
- ),
- 4 => array(
- 'column' => 'sort_name',
- 'order' => 'ASC',
- ),
- );
+ $this->_params['order_bys'] = array(
+ 1 => array(
+ 'column' => 'street_name',
+ 'order' => 'ASC',
+ ),
+ 2 => array(
+ 'column' => 'street_number_odd_even',
+ 'order' => 'ASC',
+ ),
+ 3 => array(
+ 'column' => 'street_number',
+ 'order' => 'ASC',
+ ),
+ 4 => array(
+ 'column' => 'sort_name',
+ 'order' => 'ASC',
+ ),
+ );
}
elseif (CRM_Core_OptionGroup::getValue('activity_type', 'PhoneBank') ==
$this->_values['activity_type_id']
*
* @return void
*/
- function preProcess() {
+ public function preProcess() {
$values = $this->controller->exportValues('Search');
$this->_task = $values['task'];
foreach (array(
'surveyId',
'contactIds',
- 'interviewerId'
+ 'interviewerId',
) as $fld) {
$this->{"_$fld"} = $this->get($fld);
}
$this->addElement('select', "order_bys[{$i}][column]", ts('Order by Column'), $options);
$this->addElement('select', "order_bys[{$i}][order]", ts('Order by Order'), array(
'ASC' => 'Ascending',
- 'DESC' => 'Descending'
+ 'DESC' => 'Descending',
));
}
if (!empty($this->_resultOptions)) {
$this->add('select', "field[$contactId][result]", ts('Result'),
array(
- '' => ts('- select -')
+ '' => ts('- select -'),
) +
array_combine($this->_resultOptions, $this->_resultOptions)
);
'name' => ts('Done'),
'subName' => 'interview',
'isDefault' => TRUE,
- )
+ ),
);
$buttons[] = array(
else {
$defaults['order_bys'] =
array(
- 1 =>
- array(
- 'column' => 'contact_a.sort_name',
- 'order' => 'ASC',
- ),
+ 1 => array(
+ 'column' => 'contact_a.sort_name',
+ 'order' => 'ASC',
+ ),
);
}
return $defaults;
foreach (array(
'surveyId',
'contactIds',
- 'interviewerId'
+ 'interviewerId',
) as $fld) {
$this->controller->set($fld, $this->{"_$fld"});
}
}
// vote is done through ajax
- return;
}
/**
//format multi-select group and contact types.
foreach (array(
'group',
- 'contact_type'
+ 'contact_type',
) as $param) {
$paramValue = CRM_Utils_Array::value($param, $params);
if ($paramValue) {
foreach (array(
'campaign_survey_id',
'survey_interviewer_id',
- 'campaign_search_voter_for'
+ 'campaign_search_voter_for',
) as $fld) {
$voterClauseParams[$fld] = CRM_Utils_Array::value($fld, $params);
}
array(
'value' => '',
'title' => ts('- select -'),
- )
+ ),
);
foreach ($campaigns as $value => $title) {
$class = NULL;
array(
'value' => '',
'title' => ts('- select -'),
- )
+ ),
);
foreach ($campGroups as $grpId => $title) {
$groups[] = array(
/**
* Retrieve campaigns as for campaign dashboard.
*
- **/
+ */
public function campaignList() {
//get the search criteria params.
$searchParams = explode(',', CRM_Utils_Array::value('searchCriteria', $_POST));
'sort',
'offset',
'rowCount',
- 'sortOrder'
+ 'sortOrder',
) as $sortParam) {
$params[$sortParam] = $$sortParam;
}
/**
* Retrieve survey for survey dashboard.
*
- **/
+ */
public function surveyList() {
//get the search criteria params.
$searchParams = explode(',', CRM_Utils_Array::value('searchCriteria', $_POST));
'sort',
'offset',
'rowCount',
- 'sortOrder'
+ 'sortOrder',
) as $sortParam) {
$params[$sortParam] = $$sortParam;
}
/**
* Retrieve petitions for petition dashboard.
*
- **/
+ */
public function petitionList() {
//get the search criteria params.
$searchParams = explode(',', CRM_Utils_Array::value('searchCriteria', $_POST));
'sort',
'offset',
'rowCount',
- 'sortOrder'
+ 'sortOrder',
) as $sortParam) {
$params[$sortParam] = $$sortParam;
}
/**
* Create case contact record
*
- * @param array case_id, contact_id
+ * @param array $params
+ * case_id, contact_id
*
* @return object
*/
/**
* Delet case contact record
*
- * @param int case_id
+ * @param int $caseID
*
* @return Void
*/
*
* @return int|NULL
*/
- static function mergeCases(
+ public static function mergeCases(
$mainContactId, $mainCaseId = NULL, $otherContactId = NULL,
$otherCaseId = NULL, $changeClient = FALSE) {
$moveToTrash = TRUE;
* @param bool $checkComponent
* Do we need to check component enabled.
*
- * @return boolean
+ * @return bool
*/
public static function checkPermission($activityId, $operation, $actTypeId = NULL, $contactId = NULL, $checkComponent = TRUE) {
$allow = FALSE;
* @param int $activityID
* Activity id.
*
- * @return boolean
+ * @return bool
*/
public static function isCaseActivity($activityID) {
$isCaseActivity = FALSE;
* @param array $props
* Whatever is known about this dao object.
*
- * @return Array|bool
+ * @return array|bool
*/
public static function buildOptions($fieldName, $context = NULL, $props = array()) {
$className = __CLASS__;
*
* @return void
*/
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
}
'query' => "reset=1&action=add&atype=$atype&context=standalone",
'ref' => 'new-case',
'title' => ts('Case'),
- )
+ ),
));
}
}
/**
* Class constructor
*/
- function __construct($controller, $action = CRM_Core_Action::NONE) {
+ public function __construct($controller, $action = CRM_Core_Action::NONE) {
parent::__construct($controller, $action);
$this->_pages = array();
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2014
* $Id$
- *
*/
class CRM_Contact_BAO_Contact extends CRM_Contact_DAO_Contact {
*
* @var array
*/
- static $_commPrefs = array('do_not_phone', 'do_not_email', 'do_not_mail', 'do_not_sms', 'do_not_trade');
+ static $_commPrefs = array(
+ 'do_not_phone',
+ 'do_not_email',
+ 'do_not_mail',
+ 'do_not_sms',
+ 'do_not_trade',
+ );
/**
* Types of greetings
*
* @var array
*/
- static $_greetingTypes = array('addressee', 'email_greeting', 'postal_greeting');
+ static $_greetingTypes = array(
+ 'addressee',
+ 'email_greeting',
+ 'postal_greeting',
+ );
/**
* Static field for all the contact information that we can potentially import
static $_exportableFields = NULL;
/**
- * Class constructor
- *
- * @return \CRM_Contact_DAO_Contact
- */
- /**
+ * Class constructor.
*/
public function __construct() {
parent::__construct();
}
/**
- * Takes an associative array and creates a contact object
+ * Takes an associative array and creates a contact object.
*
- * the function extract all the params it needs to initialize the create a
+ * The function extracts all the params it needs to initialize the create a
* contact object. the params array could contain additional unused name/value
* pairs
*
* @param array $params
- * (reference ) an assoc array of name/value pairs.
+ * (reference) an assoc array of name/value pairs.
*
- * @return CRM_Contact_BAO_Contact
+ * @return CRM_Contact_BAO_Contact|CRM_Core_Error
+ * Created or updated contact object or error object.
+ * (error objects are being phased out in favour of exceptions)
*/
public static function add(&$params) {
$contact = new CRM_Contact_DAO_Contact();
return;
}
- //fix for validate contact sub type CRM-5143
+ // Fix for validate contact sub type CRM-5143.
if (isset($params['contact_sub_type'])) {
if (empty($params['contact_sub_type'])) {
$params['contact_sub_type'] = 'null';
}
}
else {
- // reset the value
- // CRM-101XX
+ // Reset the value.
+ // CRM-101XX.
$params['contact_sub_type'] = 'null';
}
- //fixed contact source
+ // Fixed contact source.
if (isset($params['contact_source'])) {
$params['source'] = $params['contact_source'];
}
- //fix for preferred communication method
+ // Fix for preferred communication method.
$prefComm = CRM_Utils_Array::value('preferred_communication_method', $params);
if ($prefComm && is_array($prefComm)) {
unset($params['preferred_communication_method']);
if ($contact->contact_type == 'Individual') {
$allNull = FALSE;
- //format individual fields
+ // Format individual fields.
CRM_Contact_BAO_Individual::format($params, $contact);
}
elseif ($contact->contact_type == 'Household') {
}
}
- // privacy block
$privacy = CRM_Utils_Array::value('privacy', $params);
if ($privacy &&
is_array($privacy) &&
}
}
- // since hash was required, make sure we have a 0 value for it, CRM-1063
- // fixed in 1.5 by making hash optional
- // only do this in create mode, not update
+ // Since hash was required, make sure we have a 0 value for it (CRM-1063).
+ // @todo - does this mean we can remove this block?
+ // Fixed in 1.5 by making hash optional, only do this in create mode, not update.
if ((!array_key_exists('hash', $contact) || !$contact->hash) && !$contact->id) {
$allNull = FALSE;
$contact->hash = md5(uniqid(rand(), TRUE));
}
if ($contact->contact_type == 'Individual' && (isset($params['current_employer']) || isset($params['employer_id']))) {
- // create current employer
+ // Create current employer.
$newEmployer = !empty($params['employer_id']) ? $params['employer_id'] : CRM_Utils_Array::value('current_employer', $params);
$newContact = FALSE;
CRM_Contact_BAO_Contact_Utils::createCurrentEmployerRelationship($contact->id, $newEmployer, $employerId, $newContact);
}
else {
- //unset if employer id exits
if ($employerId) {
CRM_Contact_BAO_Contact_Utils::clearCurrentEmployer($contact->id, $employerId);
}
}
}
- //update cached employee name
+ // Update cached employer name.
if ($contact->contact_type == 'Organization') {
CRM_Contact_BAO_Contact_Utils::updateCurrentEmployer($contact->id);
}
}
/**
- * Create contact
+ * Create contact.
+ *
* takes an associative array and creates a contact object and all the associated
* derived objects (i.e. individual, location, email, phone etc)
*
* If we need to invoke hooks.
*
* @param bool $skipDelete
+ * Unclear parameter, passed to website create
+ *
+ * @todo explain this parameter
*
* @throws Exception
- * @return CRM_Contact_BAO_Contact
+ * @return CRM_Contact_BAO_Contact|CRM_Core_Error
+ * Created or updated contribution object. We are deprecating returning an error in
+ * favour of exceptions
*/
public static function &create(&$params, $fixAddress = TRUE, $invokeHooks = TRUE, $skipDelete = FALSE) {
$contact = NULL;
$config = CRM_Core_Config::singleton();
- // CRM-6942: set preferred language to the current language if it’s unset (and we’re creating a contact)
+ // CRM-6942: set preferred language to the current language if it’s unset (and we’re creating a contact).
if (empty($params['contact_id']) && empty($params['preferred_language'])) {
$params['preferred_language'] = $config->lcMessages;
}
- // CRM-9739: set greeting & addressee if unset and we’re creating a contact
+ // CRM-9739: set greeting & addressee if unset and we’re creating a contact.
if (empty($params['contact_id'])) {
foreach (self::$_greetingTypes as $greeting) {
if (empty($params[$greeting . '_id'])) {
- if ($defaultGreetingTypeId =
- CRM_Contact_BAO_Contact_Utils::defaultGreeting($params['contact_type'], $greeting)
+ if ($defaultGreetingTypeId
+ = CRM_Contact_BAO_Contact_Utils::defaultGreeting($params['contact_type'], $greeting)
) {
$params[$greeting . '_id'] = $defaultGreetingTypeId;
}
$contact = self::add($params);
if (!$contact) {
- // not dying here is stupid, since we get into wierd situation and into a bug that
+ // Not dying here is stupid, since we get into wierd situation and into a bug that
// is impossible to figure out for the user or for us
// CRM-7925
CRM_Core_Error::fatal();
$params['contact_id'] = $contact->id;
if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MULTISITE_PREFERENCES_NAME, 'is_enabled')) {
- // Enabling multisite causes the contact to be added to the domain group
+ // Enabling multisite causes the contact to be added to the domain group.
$domainGroupID = CRM_Core_BAO_Domain::getGroupId();
if (!empty($domainGroupID)) {
if (!empty($params['group']) && is_array($params['group'])) {
}
}
- //add location Block data
+ // Add location Block data.
$blocks = CRM_Core_BAO_Location::create($params, $fixAddress);
foreach ($blocks as $name => $value) {
$contact->$name = $value;
}
}
-
// update the UF user_unique_id if that has changed
CRM_Core_BAO_UFMatch::updateUFName($contact->id);
}
/**
- * Get the display name and image of a contact
+ * Get the display name and image of a contact.
*
* @param int $id
* The contactId.
*
- * @param bool $type
+ * @param bool $includeTypeInReturnParameters
+ * Should type be part of the returned array?
*
* @return array
* the displayName and contactImage for this contact
*/
- public static function getDisplayAndImage($id, $type = FALSE) {
+ public static function getDisplayAndImage($id, $includeTypeInReturnParameters = FALSE) {
//CRM-14276 added the * on the civicrm_contact table so that we have all the contact info available
$sql = "
SELECT civicrm_contact.*,
CRM_Utils_Hook::alterDisplayName($displayName, $id, $dao);
- return $type ? array(
+ return $includeTypeInReturnParameters ? array(
$displayName,
$image,
$dao->contact_type,
}
/**
+ * Create last viewed link to recently updated contact.
+ *
* @param array $crudLinkSpec
- * With keys:.
- * - action: int, CRM_Core_Action::UPDATE or CRM_Core_Action::VIEW [default: VIEW]
- * - entity_table: string, eg "civicrm_contact"
- * - entity_id: int
+ * - action: int, CRM_Core_Action::UPDATE or CRM_Core_Action::VIEW [default: VIEW]
+ * - entity_table: string, eg "civicrm_contact"
+ * - entity_id: int
+ *
* @return array|NULL
* NULL if unavailable, or
* [path: string, query: string, title: string]
public function createDefaultCrudLink($crudLinkSpec) {
switch ($crudLinkSpec['action']) {
case CRM_Core_Action::VIEW:
+
return array(
'title' => $this->display_name,
'path' => 'civicrm/contact/view',
* (reference) the default values, some of which need to be resolved.
* @param bool $reverse
* True if we want to resolve the values in the reverse direction (value -> name).
- *
- * @return void
*/
public static function resolveDefaults(&$defaults, $reverse = FALSE) {
- // hack for birth_date
+ // Hack for birth_date.
if (!empty($defaults['birth_date'])) {
if (is_array($defaults['birth_date'])) {
$defaults['birth_date'] = CRM_Utils_Date::format($defaults['birth_date'], '-');
);
}
- //kill the reference.
+ // Kill the reference.
unset($values);
}
}
}
/**
- * Fetch object based on array of properties
+ * Fetch object based on array of properties.
*
* @param array $params
* (reference ) an assoc array of name/value pairs.
}
/**
- * Get the display name of a contact
+ * Get the display name of a contact.
*
* @param int $id
* Id of the contact.
}
/**
- * Delete a contact and all its associated records
+ * Delete a contact and all its associated records.
*
* @param int $id
* Id of the contact to delete.
* @param bool $skipUndelete
* Whether to force contact delete or not.
*
- * @return boolean
- * true if contact deleted, false otherwise
+ * @return bool
+ * Was contact deleted?
*/
public static function deleteContact($id, $restore = FALSE, $skipUndelete = FALSE) {
return TRUE;
}
-
// currently we only clear employer cache.
// we are not deleting inherited membership if any.
if ($contact->contact_type == 'Organization') {
}
/**
- * Delete the image of a contact
+ * Delete the image of a contact.
*
* @param int $id
* Id of the contact.
*
- * @return boolean
- * true if contact image is deleted
+ * @return bool
+ * Was contact image deleted?
*/
public static function deleteContactImage($id) {
if (!$id) {
}
/**
- * Return relative path
+ * Return relative path.
+ *
* @todo make this a method of $config->userSystem (i.e. UF classes) rather than a static function
*
* @param string $absolutePath
* Absolute path.
*
- * @return String
+ * @return string
* Relative url of uploaded image
*/
public static function getRelativePath($absolutePath) {
}
/**
- * Return proportional height and width of the image
+ * Return proportional height and width of the image.
*
* @param int $imageWidth
* Width of image.
* @param int $imageHeight
* Height of image.
*
- * @return Array
- * thumb dimension of image
+ * @return array
+ * Thumb dimension of image
*/
public static function getThumbSize($imageWidth, $imageHeight) {
$thumbWidth = 100;
}
/**
- * Validate type of contact image
+ * Validate type of contact image.
*
* @param array $params
* @param string $imageIndex
* @param string $opType
* Type of operation like fatal, bounce etc.
*
- * @return boolean
+ * @return bool
* true if valid image extension
*/
public static function processImageParams(
}
/**
- * Extract contact id from url for deleting contact image
+ * Extract contact id from url for deleting contact image.
*/
public static function processImage() {
}
/**
- * Function to set is_delete true or restore deleted contact
+ * Function to set is_delete true or restore deleted contact.
*
* @param int $contact
* Contact DAO object.
* @param bool $restore
* True to set the is_delete = 1 else false to restore deleted contact,
* i.e. is_delete = 0
- *
- * @return void
*/
public static function contactTrashRestore($contact, $restore = FALSE) {
$op = ($restore ? 'restore' : 'trash');
*
* @return string
* contact_type if $id found else null ""
- *
- *
*/
public static function getContactType($id) {
return CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $id, 'contact_type');
*
* @return string
* contact_sub_type if $id found else null ""
- *
- *
*/
public static function getContactSubType($id, $implodeDelimiter = NULL) {
$subtype = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $id, 'contact_sub_type');
* Id of the contact whose contact sub/contact type is needed.
*
* @return array
- *
- *
*/
public static function getContactTypes($id) {
$params = array('id' => $id);
if ($contact) {
$contactTypes = array();
- if ($contact->contact_sub_type)
+ if ($contact->contact_sub_type) {
$contactTypes = explode(CRM_Core_DAO::VALUE_SEPARATOR, trim($contact->contact_sub_type, CRM_Core_DAO::VALUE_SEPARATOR));
+ }
array_unshift($contactTypes, $contact->contact_type);
return $contactTypes;
}
/**
- * Combine all the importable fields from the lower levels object
+ * Combine all the importable fields from the lower levels object.
*
* The ordering is important, since currently we do not have a weight
* scheme. Adding weight is super important
* @return array
* array of importable Fields
*/
- static function importableFields(
+ public static function importableFields(
$contactType = 'Individual',
$status = FALSE,
$showAll = FALSE,
}
/**
- * Combine all the exportable fields from the lower levels object
+ * Combine all the exportable fields from the lower levels object.
*
- * currentlty we are using importable fields as exportable fields
+ * Currently we are using importable fields as exportable fields
*
* @param int|string $contactType contact Type
* @param bool $status
if (!$fields) {
$fields = CRM_Contact_DAO_Contact::export();
- // the fields are meant for contact types
- if (in_array($contactType, array('Individual', 'Household', 'Organization', 'All'))) {
+ // The fields are meant for contact types.
+ if (in_array($contactType, array(
+ 'Individual',
+ 'Household',
+ 'Organization',
+ 'All',
+ )
+ )) {
$fields = array_merge($fields, CRM_Core_OptionValue::getFields('', $contactType));
}
// add current employer for individuals
CRM_Core_DAO_Worldregion::export()
);
-
$fields = array_merge($fields,
CRM_Contact_DAO_Contact::export()
);
}
/**
- * Get the all contact details(Hierarchical)
+ * Get the all contact details (Hierarchical).
*
* @param int $contactId
* Contact id.
* @param array $fields
* Fields array.
*
- * @return $values array contains the contact details
+ * @return array
+ * Contact details
*/
public static function getHierContactDetails($contactId, &$fields) {
$params = array(array('contact_id', '=', $contactId, 0, 0));
$returnProperties = self::makeHierReturnProperties($fields, $contactId);
- // we dont know the contents of return properties, but we need the lower level ids of the contact
- // so add a few fields
+ // We don't know the contents of return properties, but we need the lower
+ // level ids of the contact so add a few fields.
$returnProperties['first_name'] =
$returnProperties['organization_name'] =
$returnProperties['household_name'] =
}
/**
- * Given a set of flat profile style field names, create a hierarchy
- * for query to use and crete the right sql
+ * Given a set of flat profile style field names, create a hierarchy.
+ *
+ * This is for the query to use, create the right sql.
*
* @param $fields
* @param int $contactId
* Contact id.
*
* @return array
- * a hierarchical property tree if appropriate
+ * A hierarchical property tree if appropriate
*/
public static function &makeHierReturnProperties($fields, $contactId = NULL) {
$locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id');
}
/**
- * Return the primary location type of a contact
+ * Return the primary location type of a contact.
*
* $params int $contactId contact_id
* $params boolean $isPrimaryExist if true, return primary contact location type otherwise null
}
/**
- * Get the display name, primary email and location type of a contact
+ * Get the display name, primary email and location type of a contact.
*
* @param int $id
* Id of the contact.
* Specifies the default group to which contact is added.
* @param int $ufGroupId
* Uf group id (profile id).
- * @param ctype
+ * @param string $ctype
* @param bool $visibility
* Basically lets us know where this request is coming from.
* if via a profile from web, we restrict what groups are changed
* @return int
* contact id created/edited
*/
- static function createProfileContact(
+ public static function createProfileContact(
&$params,
&$fields,
$contactID = NULL,
}
/**
+ * Format profile contact parameters.
+ *
* @param array $params
* @param $fields
* @param int $contactID
*
* @return array
*/
- static function formatProfileContactParams(
+ public static function formatProfileContactParams(
&$params,
&$fields,
$contactID = NULL,
}
/**
- * Find the get contact details
- * does not respect ACLs for now, which might need to be rectified at some
- * stage based on how its used
+ * Find the get contact details.
+ *
+ * This function does not respect ACLs for now, which might need to be rectified at some
+ * stage based on how its used.
*
* @param string $mail
* Primary email address of the contact.
FROM civicrm_contact
INNER JOIN civicrm_email ON ( civicrm_contact.id = civicrm_email.contact_id )";
-
if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MULTISITE_PREFERENCES_NAME, 'uniq_email_per_site')) {
// try to find a match within a site (multisite).
$groups = CRM_Core_BAO_Domain::getChildGroupIds();
}
/**
- * Find the contact details associated with an OpenID
+ * Find the contact details associated with an OpenID.
*
* @param string $openId
* OpenId of the contact.
}
/**
- * Funtion to get primary email of the contact
+ * Get primary email of the contact.
*
* @param int $contactID
* Contact id.
*
* @return string
- * >email email address if present else null
+ * Email address if present else null
*/
public static function getPrimaryEmail($contactID) {
// fetch the primary email
}
/**
- * Funtion to get primary OpenID of the contact
+ * Function to get primary OpenID of the contact.
*
* @param int $contactID
* Contact id.
}
/**
- * Given the list of params in the params array, fetch the object
- * and store the values in the values array
+ * Fetch the object and store the values in the values array.
*
* @param array $params
* Input parameters to find object.
* @param array $values
* Output values of the object.
*
- * @return CRM_Contact_BAO_Contact|null the found object or null
+ * @return CRM_Contact_BAO_Contact|null
+ * The found object or null
*/
public static function getValues(&$params, &$values) {
$contact = new CRM_Contact_BAO_Contact();
}
/**
- * Given the component name and returns
- * the count of participation of contact
+ * Given the component name and returns the count of participation of contact.
*
* @param string $component
* Input component name.
return CRM_Core_BAO_EntityTag::getContactTags($contactId, TRUE);
case 'rel':
+
return CRM_Contact_BAO_Relationship::getRelationship($contactId,
CRM_Contact_BAO_Relationship::CURRENT,
0, 1
);
case 'group':
+
return CRM_Contact_BAO_GroupContact::getContactGroup($contactId, "Added", NULL, TRUE);
case 'log':
}
/**
- * Process greetings and cache
+ * Process greetings and cache.
*
* @param object $contact
* Contact object after save.
* @param bool $useDefaults
* Use default greeting values.
- *
- * @return void
*/
public static function processGreetings(&$contact, $useDefaults = FALSE) {
if ($useDefaults) {
}
/**
- * Retrieve display name of contact that address is shared
- * based on $masterAddressId or $contactId .
+ * Retrieve display name of contact that address is shared.
+ *
+ * This is based on $masterAddressId or $contactId .
*
* @param int $masterAddressId
* Master id.
}
/**
- * Get the creation/modification times for a contact
+ * Get the creation/modification times for a contact.
*
* @param int $contactId
*
- * @return array('created_date' => $, 'modified_date' => $)
+ * @return array
+ * Dates - ('created_date' => $, 'modified_date' => $)
*/
public static function getTimestamps($contactId) {
$timestamps = CRM_Core_DAO::executeQuery(
}
/**
- * Generate triggers to update the timestamp on the corresponding civicrm_contact row,
- * on insert/update/delete to a table that extends civicrm_contact.
+ * Generate triggers to update the timestamp.
+ *
+ * The corresponding civicrm_contact row is updated on insert/update/delete
+ * to a table that extends civicrm_contact.
* Don't regenerate triggers for all such tables if only asked for one table.
*
* @param array $info
* Array of all core or all custom table names extending civicrm_contact
* @param string $contactRefColumn
* 'contact_id' if processing core tables, 'entity_id' if processing custom tables
- * @return void
*
* @link https://issues.civicrm.org/jira/browse/CRM-15602
* @see triggerInfo
}
/**
- * Get a list of triggers for the contact table
+ * Get a list of triggers for the contact table.
*
* @see hook_civicrm_triggerInfo
* @see CRM_Core_DAO::triggerRebuild
}
/**
- * Check if contact is being used in civicrm_domain
- * based on $contactId
+ * Check if contact is being used in civicrm_domain based on $contactId.
*
* @param int $contactId
* Contact id.
* true if present else false.
*/
public static function checkDomainContact($contactId) {
- if (!$contactId)
+ if (!$contactId) {
return FALSE;
+ }
$domainId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Domain', $contactId, 'id', 'contact_id');
if ($domainId) {
/**
* Get options for a given contact field.
+ *
* @see CRM_Core_DAO::buildOptions
*
* TODO: Should we always assume chainselect? What fn should be responsible for controlling that flow?
*
* @param string $fieldName
* @param string $context
- * @see CRM_Core_DAO::buildOptionsContext.
+ * @see CRM_Core_DAO::buildOptionsContext
* @param array $props
* whatever is known about this dao object.
*
}
/**
- * Delete a contact-related object that has an 'is_primary' field
+ * Delete a contact-related object that has an 'is_primary' field.
+ *
* Ensures that is_primary gets assigned to another object if available
* Also calls pre/post hooks
*
- * @var $type : object type
- * @var $id : object id
+ * @var object $type
+ * @var int $id
* @return bool
*/
public static function deleteObjectWithPrimary($type, $id) {
* @param string $inputCheck
* Checksum to match against.
*
- * @return boolean
+ * @return bool
* true if valid, else false
*/
public static function validChecksum($contactID, $inputCheck) {
'relationship_type_id' => $relTypeId . '_a_b',
'contact_check' => array($organization => TRUE),
);
- list($valid, $invalid, $duplicate,
- $saved, $relationshipIds
- ) = CRM_Contact_BAO_Relationship::createMultiple($relationshipParams, $cid);
-
+ list($valid, $invalid, $duplicate, $saved, $relationshipIds)
+ = CRM_Contact_BAO_Relationship::createMultiple($relationshipParams, $cid);
// In case we change employer, clean previous employer related records.
if (!$previousEmployerID && !$newContact) {
// check permission on acl basis.
if (in_array($task, array(
'view',
- 'edit'
+ 'edit',
))) {
$aclPermission = CRM_Core_Permission::VIEW;
if ($task == 'edit') {
foreach ($returnProperties as $property => $ignore) {
$value = (in_array($property, array(
'city',
- 'street_address'
+ 'street_address',
))) ? 'address' : $property;
switch ($property) {
case 'sort_name':
* @param string $greetingType
* Greeting type.
*
- * @return int
- * or null
+ * @return int|NULL
*/
public static function defaultGreeting($contactType, $greetingType) {
- $contactTypeFilters = array('Individual' => 1, 'Household' => 2, 'Organization' => 3);
+ $contactTypeFilters = array(
+ 'Individual' => 1,
+ 'Household' => 2,
+ 'Organization' => 3,
+ );
if (!isset($contactTypeFilters[$contactType])) {
- return;
+ return NULL;
}
$filter = $contactTypeFilters[$contactType];
* @param array $params
* (reference ) an assoc array of name/value pairs.
*
- * @return boolean
+ * @return bool
*/
public static function dataExists(&$params) {
// return if no data present
* @return array
* (total, added, notAdded) count of contacts added to group
*/
- static function addContactsToGroup(
+ public static function addContactsToGroup(
$contactIds,
$groupId,
$method = 'Admin',
$tracking = NULL
) {
-
CRM_Utils_Hook::pre('create', 'GroupContact', $groupId, $contactIds);
list($numContactsAdded,
* @return array
* (total, removed, notRemoved) count of contacts removed to group
*/
- static function removeContactsFromGroup(
+ public static function removeContactsFromGroup(
&$contactIds,
$groupId,
$method = 'Admin',
*
* @param bool $excludeHidden
*
- * @return array
- * (reference )|int $values the relevant data object values for the contact or
- * the total count when $count is TRUE
- *
- * $access public
+ * @return array (reference)|int $values
+ * the relevant data object values for the contact or
+ * the total count when $count is TRUE
*/
- static function &getContactGroup(
+ public static function &getContactGroup(
$contactId,
$status = NULL,
$numGroupContact = NULL,
* @return array
* (total, added, notAdded) count of contacts added to group
*/
- static function bulkAddContactsToGroup(
+ public static function bulkAddContactsToGroup(
$contactIDs,
$groupID,
$method = 'Admin',
*
* @param string $fieldName
* @param string $context
- * @see CRM_Core_DAO::buildOptionsContext.
+ * @see CRM_Core_DAO::buildOptionsContext
* @param array $props
* whatever is known about this dao object.
*
- * @return Array|bool
+ * @return array|bool
*/
public static function buildOptions($fieldName, $context = NULL, $props = array()) {
$params = array();
* @param $groupIDs
* Of group that we are checking against.
*
- * @return boolean
+ * @return bool
* TRUE if we did not regenerate, FALSE if we did
*/
public static function check($groupIDs) {
* Check to see if we have cache entries for this group
* if not, regenerate, else return
*
- * @param int /array $groupID groupID of group that we are checking against
+ * @param int /array $groupIDs groupIDs of group that we are checking against
* if empty, all groups are checked
* @param int $limit
* Limits the number of groups we evaluate.
*
- * @return boolean
+ * @return bool
* TRUE if we did not regenerate, FALSE if we did
*/
public static function loadAll($groupIDs = NULL, $limit = 0) {
CRM_Contact_BAO_ProximityQuery::fixInputParams($ssParams);
}
-
$returnProperties = array();
if (CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_SavedSearch', $savedSearchID, 'mapping_id')) {
$fv = CRM_Contact_BAO_SavedSearch::getFormValues($savedSearchID);
// we split it up and store custom class
// so temp tables are not destroyed if they are used
// hence customClass is defined above at top of function
- $customClass =
- CRM_Contact_BAO_SearchCustom::customClass($ssParams['customSearchID'], $savedSearchID);
+ $customClass = CRM_Contact_BAO_SearchCustom::customClass($ssParams['customSearchID'], $savedSearchID);
$searchSQL = $customClass->contactIDs();
$searchSQL = str_replace('ORDER BY contact_a.id ASC', '', $searchSQL);
$idName = 'contact_id';
else {
$formValues = CRM_Contact_BAO_SavedSearch::getFormValues($savedSearchID);
- $query =
- new CRM_Contact_BAO_Query(
+ $query
+ = new CRM_Contact_BAO_Query(
$ssParams, $returnProperties, NULL,
FALSE, FALSE, 1,
TRUE, TRUE,
);
$query->_useDistinct = FALSE;
$query->_useGroupBy = FALSE;
- $searchSQL =
- $query->searchQuery(
+ $searchSQL
+ = $query->searchQuery(
0, 0, NULL,
FALSE, FALSE,
FALSE, TRUE,
*/
public static function contactGroup($contactID, $showHidden = FALSE) {
if (empty($contactID)) {
- return;
+ return NULL;
}
if (is_array($contactID)) {
}
$prevContactID = $dao->contact_id;
if (!array_key_exists($dao->contact_id, $contactGroup)) {
- $contactGroup[$dao->contact_id] =
- array('group' => array(), 'groupTitle' => array());
+ $contactGroup[$dao->contact_id]
+ = array('group' => array(), 'groupTitle' => array());
}
- $contactGroup[$dao->contact_id]['group'][] =
- array(
+ $contactGroup[$dao->contact_id]['group'][]
+ = array(
'id' => $dao->group_id,
'title' => $dao->title,
'description' => $dao->description,
*/
public static function format(&$params, &$contact) {
if (!self::dataExists($params)) {
- return;
+ return NULL;
}
// "null" value for example is passed by dedupe merge in order to empty.
if ($date = CRM_Utils_Array::value('birth_date', $params)) {
if (in_array($format, array(
'dd-mm',
- 'mm/dd'
+ 'mm/dd',
))) {
$separator = '/';
if ($format == 'dd-mm') {
$date = $date . $separator . '1902';
}
elseif (in_array($format, array(
- 'yy-mm'
+ 'yy-mm',
))) {
$date = $date . '-01';
}
elseif (in_array($format, array(
- 'M yy'
+ 'M yy',
))) {
$date = $date . '-01';
}
elseif (in_array($format, array(
- 'yy'
+ 'yy',
))) {
$date = $date . '-01-01';
}
if ($date = CRM_Utils_Array::value('deceased_date', $params)) {
if (in_array($format, array(
'dd-mm',
- 'mm/dd'
+ 'mm/dd',
))) {
$separator = '/';
if ($format == 'dd-mm') {
$date = $date . $separator . '1902';
}
elseif (in_array($format, array(
- 'yy-mm'
+ 'yy-mm',
))) {
$date = $date . '-01';
}
elseif (in_array($format, array(
- 'M yy'
+ 'M yy',
))) {
$date = $date . '-01';
}
elseif (in_array($format, array(
- 'yy'
+ 'yy',
))) {
$date = $date . '-01-01';
}
* @param array $params
* (reference ) an assoc array of name/value pairs.
*
- * @return boolean
+ * @return bool
*/
public static function dataExists(&$params) {
if ($params['contact_type'] == 'Individual') {
*
* @return \CRM_Contact_BAO_Query
*/
- function __construct(
+ public function __construct(
$params = NULL, $returnProperties = NULL, $fields = NULL,
$includeContactIds = FALSE, $strict = FALSE, $mode = 1,
$skipPermission = FALSE, $searchDescendentGroups = TRUE,
$this->_pseudoConstantsSelect[$name]['element'] = $name;
if ($tableName == 'email_greeting') {
- $this->_pseudoConstantsSelect[$name]['join'] =
- " LEFT JOIN civicrm_option_group option_group_email_greeting ON (option_group_email_greeting.name = 'email_greeting')";
+ $this->_pseudoConstantsSelect[$name]['join']
+ = " LEFT JOIN civicrm_option_group option_group_email_greeting ON (option_group_email_greeting.name = 'email_greeting')";
$this->_pseudoConstantsSelect[$name]['join'] .=
" LEFT JOIN civicrm_option_value email_greeting ON (contact_a.email_greeting_id = email_greeting.value AND option_group_email_greeting.id = email_greeting.option_group_id ) ";
}
elseif ($tableName == 'postal_greeting') {
- $this->_pseudoConstantsSelect[$name]['join'] =
- " LEFT JOIN civicrm_option_group option_group_postal_greeting ON (option_group_postal_greeting.name = 'postal_greeting')";
+ $this->_pseudoConstantsSelect[$name]['join']
+ = " LEFT JOIN civicrm_option_group option_group_postal_greeting ON (option_group_postal_greeting.name = 'postal_greeting')";
$this->_pseudoConstantsSelect[$name]['join'] .=
" LEFT JOIN civicrm_option_value postal_greeting ON (contact_a.postal_greeting_id = postal_greeting.value AND option_group_postal_greeting.id = postal_greeting.option_group_id ) ";
}
elseif ($tableName == 'addressee') {
- $this->_pseudoConstantsSelect[$name]['join'] =
- " LEFT JOIN civicrm_option_group option_group_addressee ON (option_group_addressee.name = 'addressee')";
+ $this->_pseudoConstantsSelect[$name]['join']
+ = " LEFT JOIN civicrm_option_group option_group_addressee ON (option_group_addressee.name = 'addressee')";
$this->_pseudoConstantsSelect[$name]['join'] .=
" LEFT JOIN civicrm_option_value addressee ON (contact_a.addressee_id = addressee.value AND option_group_addressee.id = addressee.option_group_id ) ";
}
$tName = substr($tableName, 8);
if (in_array($tName, array('country', 'state_province', 'county'))) {
if ($tName == 'state_province') {
- $this->_pseudoConstantsSelect['state_province_name'] =
- array(
- 'pseudoField' => "{$tName}",
- 'idCol' => "{$tName}_id",
- 'bao' => 'CRM_Core_BAO_Address',
- 'table' => "civicrm_{$tName}",
- 'join' => " LEFT JOIN civicrm_{$tName} ON civicrm_address.{$tName}_id = civicrm_{$tName}.id ",
- );
-
- $this->_pseudoConstantsSelect[$tName] =
- array(
- 'pseudoField' => 'state_province_abbreviation',
- 'idCol' => "{$tName}_id",
- 'table' => "civicrm_{$tName}",
- 'join' => " LEFT JOIN civicrm_{$tName} ON civicrm_address.{$tName}_id = civicrm_{$tName}.id ",
- );
+ $this->_pseudoConstantsSelect['state_province_name'] = array(
+ 'pseudoField' => "{$tName}",
+ 'idCol' => "{$tName}_id",
+ 'bao' => 'CRM_Core_BAO_Address',
+ 'table' => "civicrm_{$tName}",
+ 'join' => " LEFT JOIN civicrm_{$tName} ON civicrm_address.{$tName}_id = civicrm_{$tName}.id ",
+ );
+
+ $this->_pseudoConstantsSelect[$tName] = array(
+ 'pseudoField' => 'state_province_abbreviation',
+ 'idCol' => "{$tName}_id",
+ 'table' => "civicrm_{$tName}",
+ 'join' => " LEFT JOIN civicrm_{$tName} ON civicrm_address.{$tName}_id = civicrm_{$tName}.id ",
+ );
}
else {
- $this->_pseudoConstantsSelect[$name] =
- array(
- 'pseudoField' => "{$tName}_id",
- 'idCol' => "{$tName}_id",
- 'bao' => 'CRM_Core_BAO_Address',
- 'table' => "civicrm_{$tName}",
- 'join' => " LEFT JOIN civicrm_{$tName} ON civicrm_address.{$tName}_id = civicrm_{$tName}.id ",
- );
+ $this->_pseudoConstantsSelect[$name] = array(
+ 'pseudoField' => "{$tName}_id",
+ 'idCol' => "{$tName}_id",
+ 'bao' => 'CRM_Core_BAO_Address',
+ 'table' => "civicrm_{$tName}",
+ 'join' => " LEFT JOIN civicrm_{$tName} ON civicrm_address.{$tName}_id = civicrm_{$tName}.id ",
+ );
}
$this->_select["{$tName}_id"] = "civicrm_address.{$tName}_id as {$tName}_id";
// this is either phone, email or IM
list($elementName, $elementType) = explode('-', $elementName);
-
if (($elementName != 'phone') && ($elementName != 'im')) {
$cond = self::getPrimaryCondition($elementType);
}
);
if (substr_count($a, 'state_province_name') > 0) {
- $this->_pseudoConstantsSelect["{$name}-{$elementFullName}"] =
- array('pseudoField' => "{$pf}_id", 'idCol' => "{$tName}_id", 'bao' => 'CRM_Core_BAO_Address');
+ $this->_pseudoConstantsSelect["{$name}-{$elementFullName}"] = array(
+ 'pseudoField' => "{$pf}_id",
+ 'idCol' => "{$tName}_id",
+ 'bao' => 'CRM_Core_BAO_Address',
+ );
$this->_pseudoConstantsSelect["{$name}-{$elementFullName}"]['select'] = "`$tName`.name as `{$name}-{$elementFullName}`";
}
else {
- $this->_pseudoConstantsSelect["{$name}-{$elementFullName}"] =
- array('pseudoField' => 'state_province_abbreviation', 'idCol' => "{$tName}_id");
+ $this->_pseudoConstantsSelect["{$name}-{$elementFullName}"] = array(
+ 'pseudoField' => 'state_province_abbreviation',
+ 'idCol' => "{$tName}_id",
+ );
$this->_pseudoConstantsSelect["{$name}-{$elementFullName}"]['select'] = "`$tName`.abbreviation as `{$name}-{$elementFullName}`";
}
}
case 'civicrm_state_province':
$this->_pseudoConstantsSelect["{$name}-{$elementFullName}"]['table'] = $tName;
- $this->_pseudoConstantsSelect["{$name}-{$elementFullName}"]['join'] =
- "\nLEFT JOIN $tableName `$tName` ON `$tName`.id = $aName.state_province_id";
+ $this->_pseudoConstantsSelect["{$name}-{$elementFullName}"]['join']
+ = "\nLEFT JOIN $tableName `$tName` ON `$tName`.id = $aName.state_province_id";
if ($addWhere) {
$this->_whereTables["{$name}-address"] = $addressJoin;
}
case 'civicrm_country':
$this->_pseudoConstantsSelect["{$name}-{$elementFullName}"]['table'] = $newName;
- $this->_pseudoConstantsSelect["{$name}-{$elementFullName}"]['join'] =
- "\nLEFT JOIN $tableName `$tName` ON `$tName`.id = $aName.country_id";
+ $this->_pseudoConstantsSelect["{$name}-{$elementFullName}"]['join']
+ = "\nLEFT JOIN $tableName `$tName` ON `$tName`.id = $aName.country_id";
if ($addWhere) {
$this->_whereTables["{$name}-address"] = $addressJoin;
}
case 'civicrm_county':
$this->_pseudoConstantsSelect["{$name}-{$elementFullName}"]['table'] = $newName;
- $this->_pseudoConstantsSelect["{$name}-{$elementFullName}"]['join'] =
- "\nLEFT JOIN $tableName `$tName` ON `$tName`.id = $aName.county_id";
+ $this->_pseudoConstantsSelect["{$name}-{$elementFullName}"]['join']
+ = "\nLEFT JOIN $tableName `$tName` ON `$tName`.id = $aName.county_id";
if ($addWhere) {
$this->_whereTables["{$name}-address"] = $addressJoin;
}
*
* @return array
*/
- static function convertFormValues(&$formValues, $wildcard = 0, $useEquals = FALSE, $apiEntity = NULL) {
+ public static function convertFormValues(&$formValues, $wildcard = 0, $useEquals = FALSE, $apiEntity = NULL) {
$params = array();
if (empty($formValues)) {
return $params;
*
* @return array|null
*/
- static function &fixWhereValues($id, &$values, $wildcard = 0, $useEquals = FALSE, $apiEntity = NULL) {
+ public static function &fixWhereValues($id, &$values, $wildcard = 0, $useEquals = FALSE, $apiEntity = NULL) {
// skip a few search variables
static $skipWhere = NULL;
static $likeNames = NULL;
$op = "LIKE";
$value = "%{$value}%";
-
$useAllTagTypes = $this->getWhereValues('all_tag_types', $grouping);
$tagTypesText = $this->getWhereValues('tag_types_text', $grouping);
$tTable = "`civicrm_tag-" . $value . "`";
if ($useAllTagTypes[2]) {
- $this->_tables[$etTable] =
- $this->_whereTables[$etTable] =
- " LEFT JOIN civicrm_entity_tag {$etTable} ON ( {$etTable}.entity_id = contact_a.id)
- LEFT JOIN civicrm_tag {$tTable} ON ( {$etTable}.tag_id = {$tTable}.id )";
+ $this->_tables[$etTable] = $this->_whereTables[$etTable]
+ = " LEFT JOIN civicrm_entity_tag {$etTable} ON ( {$etTable}.entity_id = contact_a.id)
+ LEFT JOIN civicrm_tag {$tTable} ON ( {$etTable}.tag_id = {$tTable}.id )";
// search tag in cases
$etCaseTable = "`civicrm_entity_case_tag-" . $value . "`";
$tCaseTable = "`civicrm_case_tag-" . $value . "`";
- $this->_tables[$etCaseTable] =
- $this->_whereTables[$etCaseTable] =
- " LEFT JOIN civicrm_case_contact ON civicrm_case_contact.contact_id = contact_a.id
- LEFT JOIN civicrm_case
+ $this->_tables[$etCaseTable] = $this->_whereTables[$etCaseTable]
+ = " LEFT JOIN civicrm_case_contact ON civicrm_case_contact.contact_id = contact_a.id
+ LEFT JOIN civicrm_case
ON (civicrm_case_contact.case_id = civicrm_case.id
AND civicrm_case.is_deleted = 0 )
- LEFT JOIN civicrm_entity_tag {$etCaseTable} ON ( {$etCaseTable}.entity_table = 'civicrm_case' AND {$etCaseTable}.entity_id = civicrm_case.id )
- LEFT JOIN civicrm_tag {$tCaseTable} ON ( {$etCaseTable}.tag_id = {$tCaseTable}.id )";
+ LEFT JOIN civicrm_entity_tag {$etCaseTable} ON ( {$etCaseTable}.entity_table = 'civicrm_case' AND {$etCaseTable}.entity_id = civicrm_case.id )
+ LEFT JOIN civicrm_tag {$tCaseTable} ON ( {$etCaseTable}.tag_id = {$tCaseTable}.id )";
// search tag in activities
$etActTable = "`civicrm_entity_act_tag-" . $value . "`";
$tActTable = "`civicrm_act_tag-" . $value . "`";
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
- $this->_tables[$etActTable] =
- $this->_whereTables[$etActTable] =
- " LEFT JOIN civicrm_activity_contact
+ $this->_tables[$etActTable] = $this->_whereTables[$etActTable]
+ = " LEFT JOIN civicrm_activity_contact
ON ( civicrm_activity_contact.contact_id = contact_a.id AND civicrm_activity_contact.record_type_id = {$targetID} )
- LEFT JOIN civicrm_activity
+ LEFT JOIN civicrm_activity
ON ( civicrm_activity.id = civicrm_activity_contact.activity_id
AND civicrm_activity.is_deleted = 0 AND civicrm_activity.is_current_revision = 1 )
- LEFT JOIN civicrm_entity_tag as {$etActTable} ON ( {$etActTable}.entity_table = 'civicrm_activity' AND {$etActTable}.entity_id = civicrm_activity.id )
- LEFT JOIN civicrm_tag {$tActTable} ON ( {$etActTable}.tag_id = {$tActTable}.id )";
+ LEFT JOIN civicrm_entity_tag as {$etActTable} ON ( {$etActTable}.entity_table = 'civicrm_activity' AND {$etActTable}.entity_id = civicrm_activity.id )
+ LEFT JOIN civicrm_tag {$tActTable} ON ( {$etActTable}.tag_id = {$tActTable}.id )";
$this->_where[$grouping][] = "({$tTable}.name $op '" . $value . "' OR {$tCaseTable}.name $op '" . $value . "' OR {$tActTable}.name $op '" . $value . "')";
$this->_qill[$grouping][] = ts('Tag %1 %2', array(1 => $tagTypesText[2], 2 => $op)) . ' ' . $value;
$names = CRM_Utils_Array::value($value, $tagNames);
}
-
$useAllTagTypes = $this->getWhereValues('all_tag_types', $grouping);
$tagTypesText = $this->getWhereValues('tag_types_text', $grouping);
$etTable = "`civicrm_entity_tag-" . $value . "`";
if ($useAllTagTypes[2]) {
- $this->_tables[$etTable] =
- $this->_whereTables[$etTable] =
- " LEFT JOIN civicrm_entity_tag {$etTable} ON ( {$etTable}.entity_id = contact_a.id AND {$etTable}.entity_table = 'civicrm_contact') ";
+ $this->_tables[$etTable] = $this->_whereTables[$etTable]
+ = " LEFT JOIN civicrm_entity_tag {$etTable} ON ( {$etTable}.entity_id = contact_a.id AND {$etTable}.entity_table = 'civicrm_contact') ";
// search tag in cases
$etCaseTable = "`civicrm_entity_case_tag-" . $value . "`";
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
- $this->_tables[$etCaseTable] =
- $this->_whereTables[$etCaseTable] =
- " LEFT JOIN civicrm_case_contact ON civicrm_case_contact.contact_id = contact_a.id
- LEFT JOIN civicrm_case
+ $this->_tables[$etCaseTable] = $this->_whereTables[$etCaseTable]
+ = " LEFT JOIN civicrm_case_contact ON civicrm_case_contact.contact_id = contact_a.id
+ LEFT JOIN civicrm_case
ON (civicrm_case_contact.case_id = civicrm_case.id
AND civicrm_case.is_deleted = 0 )
- LEFT JOIN civicrm_entity_tag {$etCaseTable} ON ( {$etCaseTable}.entity_table = 'civicrm_case' AND {$etCaseTable}.entity_id = civicrm_case.id ) ";
+ LEFT JOIN civicrm_entity_tag {$etCaseTable} ON ( {$etCaseTable}.entity_table = 'civicrm_case' AND {$etCaseTable}.entity_id = civicrm_case.id ) ";
// search tag in activities
$etActTable = "`civicrm_entity_act_tag-" . $value . "`";
- $this->_tables[$etActTable] =
- $this->_whereTables[$etActTable] =
- " LEFT JOIN civicrm_activity_contact
+ $this->_tables[$etActTable] = $this->_whereTables[$etActTable]
+ = " LEFT JOIN civicrm_activity_contact
ON ( civicrm_activity_contact.contact_id = contact_a.id AND civicrm_activity_contact.record_type_id = {$targetID} )
- LEFT JOIN civicrm_activity
+ LEFT JOIN civicrm_activity
ON ( civicrm_activity.id = civicrm_activity_contact.activity_id
AND civicrm_activity.is_deleted = 0 AND civicrm_activity.is_current_revision = 1 )
- LEFT JOIN civicrm_entity_tag as {$etActTable} ON ( {$etActTable}.entity_table = 'civicrm_activity' AND {$etActTable}.entity_id = civicrm_activity.id ) ";
+ LEFT JOIN civicrm_entity_tag as {$etActTable} ON ( {$etActTable}.entity_table = 'civicrm_activity' AND {$etActTable}.entity_id = civicrm_activity.id ) ";
// CRM-10338
if (in_array($op, array('IS NULL', 'IS NOT NULL', 'IS EMPTY', 'IS NOT EMPTY'))) {
$this->_qill[$grouping][] = ts('Tag %1 %2', array(1 => $op, 2 => $tagTypesText[2])) . ' ' . $names;
}
else {
- $this->_tables[$etTable] =
- $this->_whereTables[$etTable] =
- " LEFT JOIN civicrm_entity_tag {$etTable} ON ( {$etTable}.entity_id = contact_a.id AND {$etTable}.entity_table = 'civicrm_contact') ";
+ $this->_tables[$etTable] = $this->_whereTables[$etTable]
+ = " LEFT JOIN civicrm_entity_tag {$etTable} ON ( {$etTable}.entity_id = contact_a.id AND {$etTable}.entity_table = 'civicrm_contact') ";
// CRM-10338
if (in_array($op, array('IS NULL', 'IS NOT NULL', 'IS EMPTY', 'IS NOT EMPTY'))) {
$this->_useDistinct = TRUE;
- $this->_tables['civicrm_note'] =
- $this->_whereTables['civicrm_note'] =
- " LEFT JOIN civicrm_note ON ( civicrm_note.entity_table = 'civicrm_contact' AND contact_a.id = civicrm_note.entity_id ) ";
+ $this->_tables['civicrm_note'] = $this->_whereTables['civicrm_note']
+ = " LEFT JOIN civicrm_note ON ( civicrm_note.entity_table = 'civicrm_contact' AND contact_a.id = civicrm_note.entity_id ) ";
$strtolower = function_exists('mb_strtolower') ? 'mb_strtolower' : 'strtolower';
$n = trim($value);
* @param $values
* @param bool $fromStateProvince
*
- * @return array
+ * @return array|NULL
*/
public function country(&$values, $fromStateProvince = TRUE) {
list($name, $op, $value, $grouping, $wildcard) = $values;
if (!empty($stateValues)) {
// return back to caller if there are state province values
// since that handles this case
- return;
+ return NULL;
}
}
}
}
-
$this->dateQueryBuilder($values, 'contact_a', 'log_date', $fieldName, $fieldTitle);
self::$_openedPanes[ts('Change Log')] = TRUE;
$relationshipTempTable = NULL;
if (self::$_relType == 'reciprocal' && empty($targetGroup)) {
$where = array();
- self::$_relationshipTempTable =
- $relationshipTempTable =
- CRM_Core_DAO::createTempTableName('civicrm_rel');
+ self::$_relationshipTempTable = $relationshipTempTable = CRM_Core_DAO::createTempTableName('civicrm_rel');
if ($nameClause) {
$where[$grouping][] = " sort_name $nameClause ";
}
}
}
-
$relTypeInd = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, 'null', NULL, 'Individual');
$relTypeOrg = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, 'null', NULL, 'Organization');
$relTypeHou = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, 'null', NULL, 'Household');
}
}
-
//check to see if the target contact is in specified group
if ($targetGroup) {
//add contacts from static groups
- $this->_tables['civicrm_relationship_group_contact'] =
- $this->_whereTables['civicrm_relationship_group_contact'] =
- " LEFT JOIN civicrm_group_contact civicrm_relationship_group_contact ON civicrm_relationship_group_contact.contact_id = contact_b.id AND civicrm_relationship_group_contact.status = 'Added'";
- $groupWhere[] =
- "( civicrm_relationship_group_contact.group_id IN (" .
+ $this->_tables['civicrm_relationship_group_contact'] = $this->_whereTables['civicrm_relationship_group_contact']
+ = " LEFT JOIN civicrm_group_contact civicrm_relationship_group_contact ON civicrm_relationship_group_contact.contact_id = contact_b.id AND civicrm_relationship_group_contact.status = 'Added'";
+ $groupWhere[] = "( civicrm_relationship_group_contact.group_id IN (" .
implode(",", $targetGroup[2]) . ") ) ";
//add contacts from saved searches
*
* @return array
*/
- static function apiQuery(
+ public static function apiQuery(
$params = NULL,
$returnProperties = NULL,
$fields = NULL,
*
* @return CRM_Core_DAO
*/
- function searchQuery(
+ public function searchQuery(
$offset = 0, $rowCount = 0, $sort = NULL,
$count = FALSE, $includeContactIds = FALSE,
$sortByChar = FALSE, $groupContacts = FALSE,
* Only get deleted contacts.
* @param bool $count
* Return Count only.
- *
- * @return null
*/
public function generatePermissionClause($onlyDeleted = FALSE, $count = FALSE) {
if (!$this->_skipPermission) {
// make sure contribution is completed - CRM-4989
$completedWhere = $where . " AND civicrm_contribution.contribution_status_id = 1 ";
-
$summary = array();
$summary['total'] = array();
$summary['total']['count'] = $summary['total']['amount'] = $summary['total']['avg'] = "n/a";
'do_not_mail' => 1,
'do_not_sms' => 1,
'do_not_trade' => 1,
- 'location' =>
- array(
- '1' => array(
- 'location_type' => 1,
- 'street_address' => 1,
- 'city' => 1,
- 'state_province' => 1,
- 'postal_code' => 1,
- 'postal_code_suffix' => 1,
- 'country' => 1,
- 'phone-Phone' => 1,
- 'phone-Mobile' => 1,
- 'phone-Fax' => 1,
- 'phone-1' => 1,
- 'phone-2' => 1,
- 'phone-3' => 1,
- 'im-1' => 1,
- 'im-2' => 1,
- 'im-3' => 1,
- 'email-1' => 1,
- 'email-2' => 1,
- 'email-3' => 1,
- ),
- '2' => array(
- 'location_type' => 1,
- 'street_address' => 1,
- 'city' => 1,
- 'state_province' => 1,
- 'postal_code' => 1,
- 'postal_code_suffix' => 1,
- 'country' => 1,
- 'phone-Phone' => 1,
- 'phone-Mobile' => 1,
- 'phone-1' => 1,
- 'phone-2' => 1,
- 'phone-3' => 1,
- 'im-1' => 1,
- 'im-2' => 1,
- 'im-3' => 1,
- 'email-1' => 1,
- 'email-2' => 1,
- 'email-3' => 1,
- ),
+ 'location' => array(
+ '1' => array(
+ 'location_type' => 1,
+ 'street_address' => 1,
+ 'city' => 1,
+ 'state_province' => 1,
+ 'postal_code' => 1,
+ 'postal_code_suffix' => 1,
+ 'country' => 1,
+ 'phone-Phone' => 1,
+ 'phone-Mobile' => 1,
+ 'phone-Fax' => 1,
+ 'phone-1' => 1,
+ 'phone-2' => 1,
+ 'phone-3' => 1,
+ 'im-1' => 1,
+ 'im-2' => 1,
+ 'im-3' => 1,
+ 'email-1' => 1,
+ 'email-2' => 1,
+ 'email-3' => 1,
),
+ '2' => array(
+ 'location_type' => 1,
+ 'street_address' => 1,
+ 'city' => 1,
+ 'state_province' => 1,
+ 'postal_code' => 1,
+ 'postal_code_suffix' => 1,
+ 'country' => 1,
+ 'phone-Phone' => 1,
+ 'phone-Mobile' => 1,
+ 'phone-1' => 1,
+ 'phone-2' => 1,
+ 'phone-3' => 1,
+ 'im-1' => 1,
+ 'im-2' => 1,
+ 'im-3' => 1,
+ 'email-1' => 1,
+ 'email-2' => 1,
+ 'email-3' => 1,
+ ),
+ ),
);
}
return self::$_defaultHierReturnProperties;
* @param $fieldTitle
* @param bool $appendTimeStamp
*/
- function dateQueryBuilder(
+ public function dateQueryBuilder(
&$values, $tableName, $fieldName,
$dbFieldName, $fieldTitle,
$appendTimeStamp = TRUE
* @param $fieldTitle
* @param null $options
*/
- function numberRangeBuilder(
+ public function numberRangeBuilder(
&$values,
$tableName, $fieldName,
$dbFieldName, $fieldTitle,
$displayValue = $options ? $options[$value] : $value;
$secondDisplayValue = $options ? $options[$secondValue] : $secondValue;
- $this->_qill[$grouping][] =
- "$fieldTitle - $firstPhrase \"$displayValue\" " . ts('AND') . " $secondPhrase \"$secondDisplayValue\"";
+ $this->_qill[$grouping][]
+ = "$fieldTitle - $firstPhrase \"$displayValue\" " . ts('AND') . " $secondPhrase \"$secondDisplayValue\"";
}
else {
$this->_where[$grouping][] = "{$tableName}.{$dbFieldName} $firstOP {$value}";
$displayValue = $options ? $options[$value] : $value;
$this->_qill[$grouping][] = "$fieldTitle - $phrase \"$displayValue\"";
}
-
- return;
}
/**
* Data type of the field.
*
* @return string
- * where clause for the query
+ * Where clause for the query.
*/
public static function buildClause($field, $op, $value = NULL, $dataType = NULL) {
$op = trim($op);
* @return void
* adds the where clause and qill to the query object
*/
- function optionValueQuery(
+ public function optionValueQuery(
$name,
$op,
$value,
/**
* Convert the pseudo constants id's to their names
*
- * @param CRM_Core_DAO dao
+ * @param CRM_Core_DAO $dao
* @param bool $return
*
- * @return array
+ * @return array|NULL
*/
public function convertToPseudoNames(&$dao, $return = FALSE) {
if (empty($this->_pseudoConstantsSelect)) {
- return;
+ return NULL;
}
$values = array();
foreach ($this->_pseudoConstantsSelect as $key => $value) {
* Include pseudo fields LEFT JOIN
* @param string|array $sort can be a object or string
*
- * @return array
+ * @return array|NULL
*/
public function includePseudoFieldsJoin($sort) {
if (!$sort || empty($this->_pseudoConstantsSelect)) {
- return;
+ return NULL;
}
$sort = is_string($sort) ? $sort : $sort->orderBy();
$present = array();
return array($presentClause, $presentSimpleFromClause);
}
- static function buildQillForFieldValue($daoName, $fieldName, $fieldValue, $op, $pseduoExtraParam = array()) {
+ public static function buildQillForFieldValue($daoName, $fieldName, $fieldValue, $op, $pseduoExtraParam = array()) {
$pseduoOptions = CRM_Core_PseudoConstant::get($daoName, $fieldName, $pseduoExtraParam = array());
$qillOperators = CRM_Core_SelectValues::getSearchBuilderOperators();
if ($fieldName == 'activity_type_id') {
$op = key($fieldValue);
$fieldValue = $fieldValue[$op];
}
- foreach ((array)$fieldValue as $val) {
+ foreach ((array) $fieldValue as $val) {
$qillString[] = $pseduoOptions[$val];
}
$fieldValue = implode(', ', $qillString);
*
* @param array $params
* (reference ) an assoc array of name/value pairs.
- * @param int $contactId
- * This is contact id for adding relationship.
* @param array $ids
* The array that holds all the db ids.
+ * @param int $contactId
+ * This is contact id for adding relationship.
*
* @return CRM_Contact_BAO_Relationship
*/
public static function add(&$params, $ids = array(), $contactId = NULL) {
- $relationshipId =
- CRM_Utils_Array::value('relationship', $ids, CRM_Utils_Array::value('id', $params));
+ $relationshipId = CRM_Utils_Array::value('relationship', $ids, CRM_Utils_Array::value('id', $params));
$hook = 'create';
if ($relationshipId) {
* @param array $params
* (reference ) an assoc array of name/value pairs.
*
- * @return boolean
+ * @return bool
*/
public static function dataExists(&$params) {
// return if no data present
* @return array
* array reference of all relationship types with context to current contact.
*/
- static function getContactRelationshipType(
+ public static function getContactRelationshipType(
$contactId = NULL,
$contactSuffix = NULL,
$relationshipId = NULL,
*
* @param $action
*
- * @return null
*/
public static function disableEnableRelationship($id, $action) {
$relationship = self::clearCurrentEmployer($id, $action);
* @param int $relationshipTypeId
* Relationship type id.
*
- * @return boolean
+ * @return bool
* true if it is valid relationship else false
*/
public static function checkRelationshipType($contact_a, $contact_b, $relationshipTypeId) {
* @param int $relationshipId
* This is relationship id for the contact.
*
- * @return boolean
+ * @return bool
* true if record exists else false
*/
public static function checkDuplicateRelationship(&$params, $id, $contactId = 0, $relationshipId = 0) {
* @return array|int
* relationship records
*/
- static function getRelationship(
+ public static function getRelationship(
$contactId = NULL,
$status = 0, $numRelationship = 0,
$count = 0, $relationshipId = 0,
* Api input array.
* @param null $direction
*
- * @return array
+ * @return array|void
*/
public static function membershipTypeToRelationshipTypes(&$params, $direction = NULL) {
$membershipType = civicrm_api3('membership_type', 'getsingle', array(
));
$relationshipTypes = $membershipType['relationship_type_id'];
if (empty($relationshipTypes)) {
- return;
+ return NULL;
}
// if we don't have any contact data we can only filter on type
if (empty($params['contact_id']) && empty($params['contact_id_a']) && empty($params['contact_id_a'])) {
$params['relationship_type_id'] = array('IN' => $relationshipTypes);
- return;
+ return NULL;
}
else {
$relationshipDirections = (array) $membershipType['relationship_direction'];
$emailParams['weight'] = CRM_Utils_Weight::getDefaultWeight('CRM_Core_DAO_OptionValue', $fieldValues);
}
-
//reset default within domain.
$emailParams['reset_default_for'] = array('domain_id' => CRM_Core_Config::domainID());
//make location type required for inline edit
$form->addSelect("address[$blockId][location_type_id]", array(
'entity' => 'address',
- 'class' => 'eight'
+ 'class' => 'eight',
) + $js, $inlineEdit);
if (!$inlineEdit) {
'postal_code' => array(
ts('Zip / Postal Code'),
array_merge($attributes['postal_code'], array('class' => 'crm_postal_code')),
- NULL
+ NULL,
),
'postal_code_suffix' => array(
ts('Postal Code Suffix'),
array('size' => 4, 'maxlength' => 12, 'class' => 'crm_postal_code_suffix'),
- NULL
+ NULL,
),
'country_id' => array(ts('Country'), $attributes['country_id'], 'country'),
'state_province_id' => array(ts('State/Province'), $attributes['state_province_id'], NULL),
if (in_array($nameWithoutID, array(
'street_number',
'street_name',
- 'street_unit'
+ 'street_unit',
)) && !empty($addressOptions['street_address_parsing'])
) {
$continue = FALSE;
$profileLinks = CRM_Core_BAO_UFGroup::getCreateLinks(array(
'new_individual',
'new_organization',
- 'new_household'
+ 'new_household',
), 'shared_address');
$form->addEntityRef("address[$blockId][master_contact_id]", ts('Share With'), array('create' => $profileLinks));
}
'name' => $shareAddressContactNames[$addressValue['master_id']]['name'],
'options' => CRM_Core_BAO_Address::getValues(array(
'entity_id' => $master_cid,
- 'contact_id' => $master_cid
+ 'contact_id' => $master_cid,
)),
'master_id' => $addressValue['master_id'],
);
'street_number',
'street_number_suffix',
'street_name',
- 'street_unit'
+ 'street_unit',
) as $fld) {
if (in_array($fld, array(
'street_name',
- 'street_unit'
+ 'street_unit',
))) {
$streetAddress .= ' ';
}
$form->addSelect("email[$blockId][location_type_id]", array(
'entity' => 'email',
'class' => 'eight',
- 'placeholder' => NULL
+ 'placeholder' => NULL,
));
$multipleBulk = CRM_Core_BAO_Email::isMultipleBulkMail();
$form->addSelect("im[$blockId][location_type_id]", array(
'entity' => 'im',
'class' => 'eight',
- 'placeholder' => NULL
+ 'placeholder' => NULL,
));
//IM box
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2014
* $Id$
- *
*/
/**
class CRM_Contact_Form_Edit_Phone {
/**
- * Build the form object elements for a phone object
+ * Build the form object elements for a phone object.
*
* @param CRM_Core_Form $form
* Reference to the form object.
* Block number to build.
* @param bool $blockEdit
* Is it block edit.
- *
- * @return void
*/
public static function buildQuickForm(&$form, $addressBlockCount = NULL, $blockEdit = FALSE) {
// passing this via the session is AWFUL. we need to fix this
$form->addSelect("phone[$blockId][phone_type_id]", array(
'entity' => 'phone',
'class' => 'eight',
- 'placeholder' => NULL
+ 'placeholder' => NULL,
));
//main phone number with crm_phone class
$form->addSelect("phone[$blockId][location_type_id]", array(
'entity' => 'phone',
'class' => 'eight',
- 'placeholder' => NULL
+ 'placeholder' => NULL,
));
//is_Primary radio
* @param string $groupElementType
*
*/
- static function buildQuickForm(
+ public static function buildQuickForm(
&$form,
$contactId = 0,
$type = self::ALL,
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2014
* $Id$
- *
*/
/**
* It delegates the work to lower level subclasses and integrates the changes
* back in. It also uses a lot of functionality with the CRM API's, so any change
* made here could potentially affect the API etc. Be careful, be aware, use unit tests.
- *
*/
class CRM_Contact_Form_RelatedContact extends CRM_Core_Form {
protected $_defaults = array();
/**
- * Build all the data structures needed to build the form
- *
- * @return void
+ * Build all the data structures needed to build the form.
*/
public function preProcess() {
// reset action from the session
}
/**
- * 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.
*
- * @return void
+ * Note that in edit/view mode the default values are retrieved from the
+ * database
*/
public function setDefaultValues() {
return $this->_defaults;
}
/**
- * Build the form object
- *
- * @return void
+ * Build the form object.
*/
public function buildQuickForm() {
$params = array();
/**
* Form submission of new/edit contact is processed.
- *
- *
- * @return void
*/
public function postProcess() {
// store the submitted values in an array
foreach (array(
'phone',
'email',
- 'address'
+ 'address',
) as $locFld) {
if (!empty($this->_defaults[$locFld]) && $this->_defaults[$locFld][1]['location_type_id']) {
$params[$locFld][1]['is_primary'] = $this->_defaults[$locFld][1]['is_primary'];
'url' => CRM_Utils_System::url('civicrm/contact/search/custom/list',
'reset=1'
),
- )
+ ),
);
CRM_Utils_System::appendBreadCrumb($breadCrumb);
/**
* Construct the search query
*/
- function all(
+ public function all(
$offset = 0, $rowcount = 0, $sort = NULL,
$includeContactIDs = FALSE, $justIDs = FALSE
) {
*
* @return string
*/
- function all(
+ public function all(
$offset = 0, $rowcount = 0, $sort = NULL,
$includeContactIDs = FALSE, $justIDs = FALSE
) {
*
* @return string
*/
- function all(
+ public function all(
$offset = 0, $rowcount = 0, $sort = NULL,
$includeContactIDs = FALSE, $justIDs = FALSE
) {
*
* @return string
*/
- function all(
+ public function all(
$offset = 0, $rowcount = 0, $sort = NULL,
$includeContactIDs = FALSE, $justIDs = FALSE
) {
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2014
* $Id$
- *
*/
/**
* This class generates form components for search-result tasks
- *
*/
class CRM_Contact_Form_Task extends CRM_Core_Form {
static protected $_searchFormValues;
/**
- * Build all the data structures needed to build the form
- *
- * @param
- *
- * @return void
+ * Build all the data structures needed to build the form.
*/
public function preProcess() {
self::preProcessCommon($this);
}
/**
+ * Common pre-processing function.
+ *
* @param CRM_Core_Form $form
* @param bool $useTable
*/
}
}
-
if (CRM_Utils_Array::value('radio_ts', self::$_searchFormValues) == 'ts_sel'
&& ($form->_action != CRM_Core_Action::COPY)
) {
}
/**
- * Get the contact id for custom search
- * we are not using prev/next table incase of custom search
+ * Get the contact id for custom search.
+ *
+ * we are not using prev/next table in case of custom search
*/
public function getContactIds() {
// need to perform action on all contacts
/**
- * Set default values for the form. Relationship that in edit/view action
- * the default values are retrieved from the database
+ * Set default values for the form. Relationship that in edit/view action.
*
+ * The default values are retrieved from the database.
*
* @return array
*/
}
/**
- * add the rules for form.
- *
- * @return void
+ * Add the rules for form.
*/
public function addRules() {
}
/**
- * Build the form object
- *
- * @return void
+ * Build the form object.
*/
public function buildQuickForm() {
$this->addDefaultButtons(ts('Confirm Action'));
}
/**
- * Process the form after the input has been submitted and validated
- *
- *
- * @return void
+ * Process the form after the input has been submitted and validated.
*/
public function postProcess() {
}
/**
- * Simple shell that derived classes can call to add buttons to
- * the form with a customized title for the main Submit
+ * Simple shell that derived classes can call to add form buttons.
+ *
+ * Allows customized title for the main Submit
*
* @param string $title
* Title of the main button.
* Button type for the form after processing.
* @param string $backType
* @param bool $submitOnce
- *
- * @return void
*/
public function addDefaultButtons($title, $nextType = 'next', $backType = 'back', $submitOnce = FALSE) {
$this->addButtons(array(
/**
* Replace ids of household members in $this->_contactIds with the id of their household.
- * CRM-8338
*
- *
- * @return void
+ * CRM-8338
*/
public function mergeContactIdsByHousehold() {
if (empty($this->_contactIds)) {
$this->add('select', 'relationship_type_id', ts('Relationship Type'),
array(
- '' => ts('- select -')
+ '' => ts('- select -'),
) +
CRM_Contact_BAO_Relationship::getRelationType("Household"), TRUE
);
'count' => $valid,
'plural' => '%count %2 %3 relationships created',
2 => $relationship,
- 3 => $house
- ))
+ 3 => $house,
+ )),
);
if ($duplicate) {
$status[] = ts('%count was skipped because the contact is already %2 %3', array(
'count' => $duplicate,
'plural' => '%count were skipped because the contacts are already %2 %3',
2 => $relationship,
- 3 => $house
+ 3 => $house,
));
}
if ($invalid) {
$status[] = ts('%count relationship was not created because the contact is not of the right type for this relationship', array(
'count' => $invalid,
- 'plural' => '%count relationships were not created because the contact is not of the right type for this relationship'
+ 'plural' => '%count relationships were not created because the contact is not of the right type for this relationship',
));
}
$status = '<ul><li>' . implode('</li><li>', $status) . '</li></ul>';
CRM_Core_Session::setStatus($status, ts('Relationship created.', array(
'count' => $valid,
- 'plural' => 'Relationships created.'
+ 'plural' => 'Relationships created.',
)), 'success', array('expires' => 0));
}
}
$contact_type = '<img src="' . $config->resourceBase . 'i/contact_';
- $searchRows[$contactID]['type'] = CRM_Contact_BAO_Contact_Utils::getImage($result->contact_sub_type ?
- $result->contact_sub_type : $result->contact_type
+ $searchRows[$contactID]['type'] = CRM_Contact_BAO_Contact_Utils::getImage($result->contact_sub_type ? $result->contact_sub_type : $result->contact_type
);
}
// more than one contact deleted
$message = ts('One of the selected contacts has an address record that is shared with 1 other contact.', array(
'plural' => 'One or more selected contacts have address records which are shared with %count other contacts.',
- 'count' => $sharedAddressCount
+ 'count' => $sharedAddressCount,
));
}
else {
// only one contact deleted
$message = ts('This contact has an address record which is shared with 1 other contact.', array(
'plural' => 'This contact has an address record which is shared with %count other contacts.',
- 'count' => $sharedAddressCount
+ 'count' => $sharedAddressCount,
));
}
CRM_Core_Session::setStatus($message . ' ' . ts('Shared addresses will not be removed or altered but will no longer be shared.'), ts('Shared Addesses Owner'));
$status = ts('%1 has been restored from the trash.', array(
1 => $name,
'plural' => '%count contacts restored from trash.',
- 'count' => $deleted
+ 'count' => $deleted,
));
}
elseif ($this->_skipUndelete) {
$status = ts('%1 has been permanently deleted.', array(
1 => $name,
'plural' => '%count contacts permanently deleted.',
- 'count' => $deleted
+ 'count' => $deleted,
));
}
else {
$status = ts('%1 has been moved to the trash.', array(
1 => $name,
'plural' => '%count contacts moved to trash.',
- 'count' => $deleted
+ 'count' => $deleted,
));
}
$session->setStatus($status, $title, 'success');
AND e.is_primary = 1
AND c.id IN ( $contactIDs )";
-
$rows = array();
$dao = CRM_Core_DAO::executeQuery($query);
while ($dao->fetch()) {
'=',
1,
0,
- 0
+ 0,
);
}
}
$context = $this->get('context');
if (in_array($context, array(
'smog',
- 'amtg'
+ 'amtg',
))) {
$urlParams = 'reset=1&force=1&context=smog&gid=';
$urlParams .= ($context == 'smog') ? $this->get('gid') : $this->get('amtgID');
$url = CRM_Utils_System::url('civicrm/contact/' . $fragment, $path);
$session->replaceUserContext($url);
- return;
}
/**
*
* @return void
*/
- function preProcess() {
+ public function preProcess() {
$this->_id = NULL;
// get the submitted values of the search form
CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Group', 'title'), TRUE
);
-
$this->addElement('textarea', 'description', ts('Description'),
CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Group', 'description')
);
if ($result) {
CRM_Core_Session::setStatus(ts('%count email was found on hold and updated.', array(
'count' => $result,
- 'plural' => '%count emails were found on hold and updated.'
+ 'plural' => '%count emails were found on hold and updated.',
)), ts('Emails Restored'), 'success');
}
else {
CRM_Core_Session::setStatus(ts('The selected contact does not have an email on hold.', array(
'count' => $result,
- 'plural' => 'None of the selected contacts have an email on hold.'
+ 'plural' => 'None of the selected contacts have an email on hold.',
)), ts('No Emails to Restore'), 'info');
}
}
if (!empty($groups)) {
$this->addElement('select', 'groups', ts('Add imported records to existing group(s)'), $groups, array(
'multiple' => "multiple",
- 'class' => 'crm-select2'
+ 'class' => 'crm-select2',
));
}
'groupAdditions',
'tagAdditions',
'unMatchCount',
- 'unparsedAddressCount'
+ 'unparsedAddressCount',
);
foreach ($properties as $property) {
$this->assign($property, $this->get($property));
*
* @return mixed
*/
- function run(
+ public function run(
$tableName,
&$mapper,
$mode = self::MODE_PREVIEW,
* Given a list of the importable field keys that the user has selected
* set the active fields array to this list
*
- * @param array mapped array of values
- *
- * @return void
+ * @param array $fieldKeys
+ * Mapped array of values.
*/
public function setActiveFields($fieldKeys) {
$this->_activeFieldCount = count($fieldKeys);
}
$value = array(
- $this->_activeFields[$i]->_name =>
- $this->_activeFields[$i]->_value,
- 'location_type_id' =>
- $this->_activeFields[$i]->_hasLocationType,
+ $this->_activeFields[$i]->_name => $this->_activeFields[$i]->_value,
+ 'location_type_id' => $this->_activeFields[$i]->_hasLocationType,
);
if (isset($this->_activeFields[$i]->_phoneType)) {
* @param string $dataPattern
* @param bool $hasLocationType
*/
- function addField(
+ public function addField(
$name, $title, $type = CRM_Utils_Type::T_INT,
$headerPattern = '//', $dataPattern = '//',
$hasLocationType = FALSE
/**
* Class constructor
*/
- function __construct(
+ public function __construct(
&$mapperKeys, $mapperLocType = NULL, $mapperPhoneType = NULL, $mapperImProvider = NULL, $mapperRelated = NULL, $mapperRelatedContactType = NULL, $mapperRelatedContactDetails = NULL, $mapperRelatedContactLocType = NULL, $mapperRelatedContactPhoneType = NULL, $mapperRelatedContactImProvider = NULL,
$mapperWebsiteType = NULL, $mapperRelatedContactWebsiteType = NULL
) {
}
//Relationship importables
- $this->_relationships = $relations =
- CRM_Contact_BAO_Relationship::getContactRelationshipType(
+ $this->_relationships = $relations
+ = CRM_Contact_BAO_Relationship::getContactRelationshipType(
NULL, NULL, NULL, $this->_contactType,
FALSE, 'label', TRUE, $this->_contactSubType
);
* @param array $values
* The array of values belonging to this line.
*
- * @return boolean
+ * @return bool
*/
public function mapField(&$values) {
return CRM_Import_Parser::VALID;
* @param array $values
* The array of values belonging to this line.
*
- * @return boolean
+ * @return bool
* the result of this processing
*/
public function preview(&$values) {
* @param array $values
* The array of values belonging to this line.
*
- * @return boolean
+ * @return boo
* the result of this processing
*/
public function summary(&$values) {
*
* @param bool $doGeocodeAddress
*
- * @return boolean
+ * @return bool
* the result of this processing
*/
public function import($onDuplicate, &$values, $doGeocodeAddress = FALSE) {
$newContact = $this->createContact($formatted, $contactFields, $onDuplicate, $contactId);
}
// else skip does nothing and just returns an error code.
-
-
if ($cid) {
$contact = array(
'contact_id' => $cid,
/**
* called when action is browse
*
- * @return null
+ * @return void
*/
public function browse() {
// get the primary city, state and zip for the contact
/**
* called when action is browse
*
- * @return null
+ * @return void
*/
public function browse() {
$controller = new CRM_Core_Controller_Simple('CRM_Tag_Form_Tag', ts('Contact Tags'), $this->_action);
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2014
* $Id: Selector.php 11510 2007-09-18 09:21:34Z lobo $
- *
*/
/**
* This class is used to retrieve and display a range of
* contacts that match the given criteria (specifically for
* results of advanced search options.
- *
*/
class CRM_Contact_Selector_Custom extends CRM_Contact_Selector {
protected $_customSearchClass;
/**
- * Class constructor
+ * Class constructor.
*
* @param $customSearchClass
* @param array $formValues
*
* @return \CRM_Contact_Selector_Custom
*/
- function __construct(
+ public function __construct(
$customSearchClass,
$formValues = NULL,
$params = NULL,
/**
* This method returns the links that are given for each search row.
- * currently the links added for each row are
*
+ * Currently the links added for each row are
* - View
* - Edit
*
}
/**
- * Returns the column headers as an array of tuples:
- * (name, sortName (key to the sort array))
+ * Returns the column headers as an array of tuples.
+ *
+ * Keys are name, sortName, key to the sort array.
*
* @param string $action
* The action being performed.
/**
* Returns total number of rows for the query.
*
- * @param
+ * @param null $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.
}
/**
- * Given the current formValues, gets the query in local
- * language
- *
- * @param array (
- * reference) $formValues submitted formValues
+ * Given the current formValues, gets the query in local language.
*
* @return array
* which contains an array of strings
}
/**
+ * Get summary.
+ *
* @return mixed
*/
public function getSummary() {
}
/**
+ * Do nothing.
+ *
* @return null
*/
public function alphabetQuery() {
}
/**
+ * Generate contact ID query.
+ *
* @param array $params
* @param $action
* @param int $sortID
*
* @return Object
*/
- public function &contactIDQuery($params, $action, $sortID, $displayRelationshipType = NULL, $queryOperator = 'AND') {
+ public function contactIDQuery($params, $action, $sortID, $displayRelationshipType = NULL, $queryOperator = 'AND') {
$params = array();
$sql = $this->_search->contactIDs($params);
}
/**
- * @param $rows
+ * Add actions.
+ *
+ * @param array $rows
*/
public function addActions(&$rows) {
$links = self::links($this->_key);
}
/**
- * @param $rows
+ * Remove actions.
+ *
+ * @param array $rows
*/
public function removeActions(&$rows) {
foreach ($rows as $rid => & $rValue) {
/**
* Class constructor
*/
- function __construct($controller, $action = CRM_Core_Action::NONE) {
+ public function __construct($controller, $action = CRM_Core_Action::NONE) {
parent::__construct($controller, $action);
$this->_pages = array();
'title' => ts('Contribution Page'),
'name' => 'contribution_page',
'where' => 'civicrm_contribution_page.title',
- 'data_type' => CRM_Utils_Type::T_STRING
- ));
+ 'data_type' => CRM_Utils_Type::T_STRING,
+ )
+ );
$contributionNote = array(
- 'contribution_note' =>
- array(
- 'title' => ts('Contribution Note'),
- 'name' => 'contribution_note',
- 'data_type' => CRM_Utils_Type::T_TEXT,
- ),
+ 'contribution_note' => array(
+ 'title' => ts('Contribution Note'),
+ 'name' => 'contribution_note',
+ 'data_type' => CRM_Utils_Type::T_TEXT,
+ ),
);
$contributionRecurId = array(
* (reference) store ids of duplicate contribs.
* @param int $id
*
- * @return boolean
+ * @return bool
* true if duplicate, false otherwise
*/
public static function checkDuplicate($input, &$duplicates, $id = NULL) {
WHERE membership_id=$membership->id
ORDER BY id DESC
LIMIT 1;";
- $dao = new CRM_Core_DAO;
+ $dao = new CRM_Core_DAO();
$dao->query($sql);
if ($dao->fetch()) {
if (!empty($dao->membership_type_id)) {
*
* @param bool $isNotCancelled
*
- * @return boolean
+ * @return bool
*/
public static function isCancelSubscriptionSupported($contributionId, $isNotCancelled = TRUE) {
$cacheKeyString = "$contributionId";
* @param array $props
* whatever is known about this dao object.
*
- * @return Array|bool
+ * @return array|bool
*/
public static function buildOptions($fieldName, $context = NULL, $props = array()) {
$className = __CLASS__;
* associated array
*
*/
- static function processConfirm(
+ public static function processConfirm(
&$form,
&$paymentParams,
&$premiumParams,
1 => array(
'email' => $params['email'],
'location_type_id' => $billingLocTypeId,
- )
+ ),
);
}
if (!in_array($type, array(
'paypal',
'google',
- 'csv'
+ 'csv',
))
) {
// return the params as is
// if this is a recurring contribution then process it first
if ($params['trxn_type'] == 'subscrpayment') {
// see if a recurring record already exists
- $recurring = new CRM_Contribute_BAO_ContributionRecur;
+ $recurring = new CRM_Contribute_BAO_ContributionRecur();
$recurring->processor_id = $params['processor_id'];
if (!$recurring->find(TRUE)) {
- $recurring = new CRM_Contribute_BAO_ContributionRecur;
+ $recurring = new CRM_Contribute_BAO_ContributionRecur();
$recurring->invoice_id = $params['invoice_id'];
$recurring->find(TRUE);
}
'priceSetID' => CRM_Utils_Array::value('priceSetID', $values),
'title' => $title,
'isShare' => CRM_Utils_Array::value('is_share', $values),
+ 'thankyou_title' => CRM_Utils_Array::value('thankyou_title', $values),
);
if ($contributionTypeId = CRM_Utils_Array::value('financial_type_id', $values)) {
// get payment instrument id
if (!empty($query->_returnProperties['payment_instrument_id'])) {
- $query->_select['instrument_id'] = "contribution_payment_instrument.value as instrument_id";
+ $query->_select['instrument_id'] = "contribution_payment_instrument.value as instrument_id";
$query->_select['payment_instrument_id'] = "contribution_payment_instrument.value as payment_instrument_id";
$query->_element['instrument_id'] = $query->_element['payment_instrument_id'] = 1;
$query->_tables['civicrm_contribution'] = 1;
case 'financial_type':
$query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause($fields[$name]['where'], $op, $value, 'String');
- CRM_Core_Error::debug( '$query', $query->_where[$grouping] );
+ CRM_Core_Error::debug('$query', $query->_where[$grouping]);
list($op, $value) = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Contribute_DAO_Contribution', $name, $value, $op);
$query->_qill[$grouping][] = ts('%1 %2 %3', array(1 => $fields[$name]['title'], 2 => $op, 3 => $value));
$query->_tables['civicrm_contribution'] = $query->_whereTables['civicrm_contribution'] = 1;
$form->add('select', 'contribution_currency_type',
ts('Currency Type'),
array(
- '' => ts('- any -')
+ '' => ts('- any -'),
) +
CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'currency', array('labelColumn' => 'name')),
FALSE, array('class' => 'crm-select2')
$form->add('select', 'contribution_page_id',
ts('Contribution Page'),
array(
- '' => ts('- any -')
+ '' => ts('- any -'),
) +
CRM_Contribute_PseudoConstant::contributionPage(),
FALSE, array('class' => 'crm-select2')
$form->add('select', 'contribution_pcp_made_through_id',
ts('Personal Campaign Page'),
array(
- '' => ts('- any -')
+ '' => ts('- any -'),
) +
CRM_Contribute_PseudoConstant::pcPage(),
FALSE, array('class' => 'crm-select2')
public static function buildDateWhere(&$values, $query, $name, $field, $title) {
$fieldPart = strpos($name, $field);
if ($fieldPart === FALSE) {
- return;
+ return NULL;
}
// we only have recurring dates using this ATM so lets' short cut to find the table name
$table = 'contribution_recur';
* @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
- *
*/
class CRM_Contribute_Controller_ContributionPage 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);
-
-
$this->_stateMachine = new CRM_Contribute_StateMachine_ContributionPage($this, $action);
-
- // create and instantiate the pages
+ // Create and instantiate the pages.
$this->addPages($this->_stateMachine, $action);
-
- // add all the actions
$this->addActions();
}
}
$this->assign('mode', $this->_mode);
if ($this->_subscriptionDetails->contact_id) {
- list($this->_donorDisplayName, $this->_donorEmail) =
- CRM_Contact_BAO_Contact::getContactDetails($this->_subscriptionDetails->contact_id);
+ list($this->_donorDisplayName, $this->_donorEmail)
+ = CRM_Contact_BAO_Contact::getContactDetails($this->_subscriptionDetails->contact_id);
}
}
* Set default values for the form. Note that in edit/view mode
* the default values are retrieved from the database
*
- * @param null
- *
* @return array
* array of default values
*/
CRM_Core_Error::displaySessionError($cancelSubscription);
}
elseif ($cancelSubscription) {
- $activityParams =
- array(
+ $activityParams
+ = array(
'subject' => $this->_mid ? ts('Auto-renewal membership cancelled') : ts('Recurring contribution cancelled'),
'details' => $message,
);
$inputParams = array('id' => $this->_mid);
CRM_Member_BAO_Membership::getValues($inputParams, $tplParams);
$tplParams = $tplParams[$this->_mid];
- $tplParams['membership_status'] =
- CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipStatus', $tplParams['status_id']);
- $tplParams['membershipType'] =
- CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $tplParams['membership_type_id']);
+ $tplParams['membership_status']
+ = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipStatus', $tplParams['status_id']);
+ $tplParams['membershipType']
+ = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $tplParams['membership_type_id']);
$status = ts('The automatic renewal of your %1 membership has been cancelled as requested. This does not affect the status of your membership - you will receive a separate notification when your membership is up for renewal.', array(1 => $tplParams['membershipType']));
$msgTitle = 'Membership Renewal Cancelled';
$msgType = 'info';
$value,
array('title', 'receipt_from_name', 'receipt_from_email')
);
- $receiptFrom =
- '"' .
- CRM_Utils_Array::value('receipt_from_name', $value[$this->_subscriptionDetails->contribution_page_id]) .
+ $receiptFrom
+ = '"' . CRM_Utils_Array::value('receipt_from_name', $value[$this->_subscriptionDetails->contribution_page_id]) .
'" <' .
$value[$this->_subscriptionDetails->contribution_page_id]['receipt_from_email'] .
'>';
}
// send notification
- $sendTemplateParams =
- array(
+ $sendTemplateParams
+ = array(
'groupName' => $this->_mode == 'auto_renew' ? 'msg_tpl_workflow_membership' : 'msg_tpl_workflow_contribution',
'valueName' => $this->_mode == 'auto_renew' ? 'membership_autorenew_cancelled' : 'contribution_recurring_cancelled',
'contactId' => $this->_subscriptionDetails->contact_id,
$session->setStatus($status, $msgTitle, $msgType);
}
elseif (!$userID) {
- if ($status)
+ if ($status) {
CRM_Utils_System::setUFMessage($status);
- // keep result as 1, since we not displaying anything on the redirected page anyway
- return CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contribute/subscriptionstatus',
+ // keep result as 1, since we not displaying anything on the redirected page anyway
+ return CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contribute/subscriptionstatus',
"reset=1&task=cancel&result=1"));
+ }
}
}
}
$coreTypes = array('Contact', 'Organization');
$entities[] = array(
- 'entity_name' => array ('contact_1'),
+ 'entity_name' => array('contact_1'),
'entity_type' => 'OrganizationModel',
);
if ($member && $member['is_active']) {
$coreTypes[] = 'Membership';
$entities[] = array(
- 'entity_name' => array ('membership_1'),
+ 'entity_name' => array('membership_1'),
'entity_type' => 'MembershipModel',
);
}
-
- $allowCoreTypes = array_merge($coreTypes,
- CRM_Contact_BAO_ContactType::subTypes('Organization'));
+
+ $allowCoreTypes = array_merge($coreTypes, CRM_Contact_BAO_ContactType::subTypes('Organization'));
$allowSubTypes = array();
$this->addProfileSelector('onbehalf_profile_id', ts('Organization Profile'), $allowCoreTypes, $allowSubTypes, $entities);
'Contact',
'Individual',
'Organization',
- 'Household'
+ 'Household',
), CRM_Contact_BAO_ContactType::subTypes('Individual'));
$allowSubTypes = array();
$dao = CRM_Contribute_BAO_ContributionPage::create($params);
$ufJoinParams = array(
- 'onbehalf_profile_id' =>
- array(
- 'is_active' => 1,
- 'module' => 'OnBehalf',
- 'entity_table' => 'civicrm_contribution_page',
- 'entity_id' => $dao->id,
- ),
- 'honor_block_is_active' =>
- array(
- 'module' => 'soft_credit',
- 'entity_table' => 'civicrm_contribution_page',
- 'entity_id' => $dao->id,
- ),
+ 'onbehalf_profile_id' => array(
+ 'is_active' => 1,
+ 'module' => 'OnBehalf',
+ 'entity_table' => 'civicrm_contribution_page',
+ 'entity_id' => $dao->id,
+ ),
+ 'honor_block_is_active' => array(
+ 'module' => 'soft_credit',
+ 'entity_table' => 'civicrm_contribution_page',
+ 'entity_id' => $dao->id,
+ ),
);
foreach ($ufJoinParams as $index => $ufJoinParam) {
$form->addSelect("soft_credit_type[{$rowNumber}]", array(
'entity' => 'contribution_soft',
'field' => 'soft_credit_type_id',
- 'label' => ts('Type')
+ 'label' => ts('Type'),
));
if (!empty($form->_softCreditInfo['soft_credit'][$rowNumber]['soft_credit_id'])) {
$form->add('hidden', "soft_credit_id[{$rowNumber}]",
*
* @return void
*/
- function preProcess() {
+ public function preProcess() {
CRM_Contact_Form_Task_EmailCommon::preProcessFromAddress($this);
parent::preProcess();
$this->setMaxFileSize($uploadFileSize);
$this->addRule('uploadFile', ts('File size should be less than %1 MBytes (%2 bytes)', array(
1 => $uploadSize,
- 2 => $uploadFileSize
+ 2 => $uploadFileSize,
)), 'maxfilesize', $uploadFileSize);
$this->addRule('uploadFile', ts('A valid file must be uploaded.'), 'uploadedfile');
$this->addRule('uploadFile', ts('Input file must be in CSV format'), 'utf8File');
'validPledgePaymentRowCount',
'invalidPledgePaymentRowCount',
'downloadPledgePaymentErrorRecordsUrl',
- 'downloadSoftCreditErrorRecordsUrl'
+ 'downloadSoftCreditErrorRecordsUrl',
);
foreach ($properties as $property) {
$this->assign($property, $this->get($property));
*
* @return array
*/
- function &actionLinks() {
+ public function &actionLinks() {
// check if variable _actionsLinks is populated
if (!isset(self::$_actionLinks)) {
// helper variable for nicer formatting
'url' => CRM_Utils_System::url(CRM_Utils_System::currentPath(),
'reset=1'
),
- )
+ ),
);
// what action to take ?
*
* @return int[]
*/
- function getCampaignIds() {
+ public function getCampaignIds() {
// The unfiltered value from the session cannot be trusted, it needs to be
// processed to get a clean array of positive integers.
$ids = array();
* @param $whereClause
* @param array $whereParams
*/
- function pager($whereClause, $whereParams) {
+ public function pager($whereClause, $whereParams) {
$params['status'] = ts('Contribution %%StatusMessage%%');
$params['csvString'] = NULL;
*
* @return void
*/
- function view() {
+ public function view() {
$recur = new CRM_Contribute_DAO_ContributionRecur();
$recur->id = $this->_id;
if ($recur->find(TRUE)) {
/**
* called when action is browse
- *
- * @return null
*/
public function listContribution() {
$controller = new CRM_Core_Controller_Simple(
/**
* the main function that is called when the page
* loads, it decides the which action has to be taken for the page.
- *
- * @return null
*/
public function run() {
$invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings');
/**
* Class constructor
*/
- function __construct($controller, $action = CRM_Core_Action::NONE) {
+ public function __construct($controller, $action = CRM_Core_Action::NONE) {
parent::__construct($controller, $action);
$this->_pages = array();
* @return string
* the html string
*/
- static function formLink(
+ public static function formLink(
$links,
$mask,
$values,
/**
* Get the mask for a permission (view, edit or null)
*
- * @param string the permission
- *
* @return int
* the mask for the above permission
*/
/**
* Get all fields of the type Date
*/
-
public static function getDateFields() {
$allFields = CRM_Core_BAO_CustomField::getFields('');
$dateFields = array('birth_date' => ts('Birth Date'));
foreach (array(
'text',
'html',
- 'sms_text'
+ 'sms_text',
) as $elem) {
$$elem = $smarty->fetch("string:{$$elem}");
}
$smsParams = array(
'To' => $phoneNumber,
'provider_id' => $schedule->sms_provider_id,
- 'activity_subject' => $messageSubject
+ 'activity_subject' => $messageSubject,
);
$activityTypeID = CRM_Core_OptionGroup::getValue('activity_type',
'SMS',
$activityStatusID = FALSE;
if ($actionSchedule->record_activity) {
if ($mapping->entity == 'civicrm_membership') {
- $activityTypeID =
- CRM_Core_OptionGroup::getValue('activity_type', 'Membership Renewal Reminder', 'name');
+ $activityTypeID
+ = CRM_Core_OptionGroup::getValue('activity_type', 'Membership Renewal Reminder', 'name');
}
else {
- $activityTypeID =
- CRM_Core_OptionGroup::getValue('activity_type', 'Reminder Sent', 'name');
+ $activityTypeID
+ = CRM_Core_OptionGroup::getValue('activity_type', 'Reminder Sent', 'name');
}
- $activityStatusID =
- CRM_Core_OptionGroup::getValue('activity_status', 'Completed', 'name');
+ $activityStatusID
+ = CRM_Core_OptionGroup::getValue('activity_status', 'Completed', 'name');
}
if ($mapping->entity == 'civicrm_activity') {
'fee_amount',
'contact_email',
'contact_phone',
- 'balance'
+ 'balance',
);
$extraSelect = ', ov.label as event_type, ev.title, ev.id as event_id, ev.start_date, ev.end_date, ev.summary, ev.description, address.street_address, address.city, address.state_province_id, address.postal_code, email.email as contact_email, phone.phone as contact_phone ';
if ($toEmail || !(empty($toPhoneNumber) or $toDoNotSms)) {
$to['email'] = $toEmail;
$to['phone'] = $toPhoneNumber;
- $result =
- CRM_Core_BAO_ActionSchedule::sendReminder(
+ $result
+ = CRM_Core_BAO_ActionSchedule::sendReminder(
$dao->contactID,
$to,
$actionSchedule->id,
$activityParams = array(
'subject' => $actionSchedule->title,
'details' => $actionSchedule->body_html,
- 'source_contact_id' =>
- $session->get('userID') ? $session->get('userID') : $dao->contactID,
+ 'source_contact_id' => $session->get('userID') ? $session->get('userID') : $dao->contactID,
'target_contact_id' => $dao->contactID,
'activity_date_time' => date('YmdHis'),
'status_id' => $activityStatusID,
$valsqlInsertValues = CRM_Core_DAO::executeQuery($sqlInsertValues, array(
1 => array(
$actionSchedule->id,
- 'Integer'
- )
- ));
+ 'Integer',
+ ),
+ )
+ );
$arrValues = array();
while ($valsqlInsertValues->fetch()) {
);
foreach ($transactionPages as $trPage) {
$params[] = array("%${trPage}%", 'String');
- $where[] = 'path LIKE %' . sizeof($params);
+ $where[] = 'path LIKE %' . count($params);
}
$sql = "
* @param array $params
* Associated array of civicrm variables.
*
- * @return null
+ * @return void
*/
public static function create($params) {
self::add($params);
* @param array $params
* Associated array of civicrm variables.
*
- * @return null
+ * @return void
*/
public static function add(&$params) {
self::fixParams($params);
// also set a template url so js files can use this
// CRM-6194
$params['civiRelativeURL'] = CRM_Utils_System::url('CIVI_BASE_TEMPLATE');
- $params['civiRelativeURL'] =
- str_replace(
+ $params['civiRelativeURL']
+ = str_replace(
'CIVI_BASE_TEMPLATE',
'',
$params['civiRelativeURL']
* @param array $params
* Associated array of civicrm variables.
*
- * @return null
+ * @return void
*/
public static function fixParams(&$params) {
// in our old civicrm.settings.php we were using ISO code for country and
* @param array $values
* Associated array of civicrm variables stored in db.
*
- * @return null
+ * @return void
*/
public static function formatParams(&$params, &$values) {
if (empty($params) ||
$defaults = unserialize($domain->config_backend);
if ($defaults === FALSE || !is_array($defaults)) {
$defaults = array();
- return;
+ return FALSE;
}
$skipVars = self::skipVars();
list($oldURL, $oldDir, $oldSiteName, $oldSiteRoot) = self::getConfigSettings();
list($newURL, $newDir, $newSiteName, $newSiteRoot) = self::getBestGuessSettings();
-
// retrieve these values from the argument list
$variables = array('URL', 'Dir', 'SiteName', 'SiteRoot', 'Val_1', 'Val_2', 'Val_3');
$states = array('old', 'new');
* @param string $componentName
* Name of the component to be enabled, needs to be valid.
*
- * @return boolean
+ * @return bool
* true if valid component name and enabling succeeds, else false
*/
public static function enableComponent($componentName) {
}
// get enabled-components from DB and add to the list
- $enabledComponents =
- CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'enable_components', NULL, array());
+ $enabledComponents
+ = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'enable_components', NULL, array());
$enabledComponents[] = $componentName;
self::setEnabledComponents($enabledComponents);
}
// get enabled-components from DB and add to the list
- $enabledComponents =
- CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'enable_components', NULL, array());
+ $enabledComponents
+ = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'enable_components', NULL, array());
$enabledComponents = array_diff($enabledComponents, array($componentName));
self::setEnabledComponents($enabledComponents);
/**
* Get the location values of a domain
*
- * @param NULL
- *
* @return array
* Location::getValues
*/
* @param array $entityBlock
* Input parameters to find object.
*
- * @return boolean
+ * @return bool
*/
public static function &getValues($entityBlock) {
return CRM_Core_BAO_Block::getValues('email', $entityBlock);
*
* @throws Exception
*/
- static function filePostProcess(
+ public static function filePostProcess(
$data,
$fileTypeID,
$entityTable,
* @param $entityTable
* @param int $entityID
*/
- static function formatAttachment(
+ public static function formatAttachment(
&$formValues,
&$params,
$entityTable,
foreach ($currentAttachmentInfo as $fileKey => $fileValue) {
$fileID = $fileValue['fileID'];
$fileType = $fileValue['mime_type'];
- $eid = $entityID;
if ($fileID) {
if ($fileType == 'image/jpeg' ||
$fileType == 'image/pjpeg' ||
/**
* Get page orientations recognized by the DOMPDF package used to create PDF letters.
*
- * @param void
- *
* @return array
* array of page orientations
*/
/**
* Get font sizes supported by the TCPDF package used to create PDF labels.
*
- * @param void
- *
* @return array
* array of font sizes
*/
/**
* Get measurement units recognized by the TCPDF package used to create PDF labels.
*
- * @param void
- *
* @return array
* array of measurement units
*/
/**
* Get text alignment recognized by the TCPDF package used to create PDF labels.
*
- * @param void
- *
* @return array
* array of alignments
*/
/**
* Get text alignment recognized by the TCPDF package used to create PDF labels.
*
- * @param void
- *
* @return array
* array of alignments
*/
public static function addOrder(&$list, $returnURL) {
$filter = "option_group_id = " . self::_getGid();
CRM_Utils_Weight::addOrder($list, 'CRM_Core_DAO_OptionValue', 'id', $returnURL, $filter);
+ return $list;
}
/**
/**
* Return the name of the group for customized labels
*
- * @param void
- *
* @return void
*/
public static function customGroupName() {
/**
* Retrieve the default location_type
*
- * @param NULL
- *
* @return object
* The default location type object on success,
* null otherwise
* @param int $tableID
* @param int $userID
*/
- static function register(
+ public static function register(
$contactID,
$tableName,
$tableID,
static $mailSettings = array();
$domainID = CRM_Core_Config::domainID();
if (empty($mailSettings[$domainID]) || $reset) {
- $dao = new self;
+ $dao = new self();
$dao->is_default = 1;
$dao->domain_id = $domainID;
$dao->find(TRUE);
/**
* Return the "include message ID" flag from the default set of settings.
*
- * @return boolean
+ * @return bool
* default include message ID
*/
public static function includeMessageId() {
* @param int $id
* Mapping id.
*
- * @return boolean
+ * @return bool
*/
public static function del($id) {
// delete from mapping_field table
* @param string $mapTypeId
* mapping Type.
*
- * @return boolean
+ * @return bool
*/
public static function checkMapping($nameField, $mapTypeId) {
$mapping = new CRM_Core_DAO_Mapping();
foreach (array(
'groups',
'tags',
- 'notes'
+ 'notes',
) as $value) {
unset($fields['Individual'][$value]);
unset($fields['Household'][$value]);
$fields['Contact']['note_body'] = array('title' => $noteTitle . ': ' . ts('Body Only'), 'name' => 'note_body');
$fields['Contact']['note_subject'] = array(
'title' => $noteTitle . ': ' . ts('Subject Only'),
- 'name' => 'note_subject'
+ 'name' => 'note_subject',
);
}
}
$csRelationships = array();
if ($mappingType == 'Export') {
- $subTypeRelationshipTypes =
- CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, NULL, NULL, $val['parent'],
+ $subTypeRelationshipTypes
+ = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, NULL, NULL, $val['parent'],
FALSE, 'label', TRUE, $subType);
foreach ($subTypeRelationshipTypes as $key => $var) {
0,
);
}
-
-
return $fields;
}
$mappingFields->delete();
if (empty($params['mapper'])) {
- return;
+ return NULL;
}
//save record in mapping field table
/**
* Delete the Message Templates
*
- *
* @param int $messageTemplatesID
- *
- * @return object
+ * @return void
*/
public static function del($messageTemplatesID) {
// make sure messageTemplatesID is an integer
$smarty = CRM_Core_Smarty::singleton();
foreach (array(
'text',
- 'html'
+ 'html',
) as $elem) {
$$elem = $smarty->fetch("string:{$$elem}");
}
/**
* Revert a message template to its default subject+text+HTML state
*
- * @param int id id of the template
+ * @param int $id id of the template
*
* @return void
*/
public static function revert($id) {
- $diverted = new self;
+ $diverted = new CRM_Core_BAO_MessageTemplate();
$diverted->id = (int) $id;
$diverted->find(1);
CRM_Core_Error::fatal(ts('Did not find a message template with id of %1.', array(1 => $id)));
}
- $orig = new self;
+ $orig = new CRM_Core_BAO_MessageTemplate();
$orig->workflow_id = $diverted->workflow_id;
$orig->is_reserved = 1;
$orig->find(1);
else {
CRM_Core_Error::fatal(ts('No such message template: option group %1, option value %2.', array(
1 => $params['groupName'],
- 2 => $params['valueName']
+ 2 => $params['valueName'],
)));
}
}
// replace tokens in the three elements (in subject as if it was the text body)
$domain = CRM_Core_BAO_Domain::getDomain();
$hookTokens = array();
- $mailing = new CRM_Mailing_BAO_Mailing;
+ $mailing = new CRM_Mailing_BAO_Mailing();
$mailing->body_text = $text;
$mailing->body_html = $html;
$tokens = $mailing->getTokens();
$text = CRM_Utils_Token::replaceContactTokens($text, $contact, FALSE, $tokens['text'], FALSE, TRUE);
$html = CRM_Utils_Token::replaceContactTokens($html, $contact, FALSE, $tokens['html'], FALSE, TRUE);
-
$contactArray = array($contactID => $contact);
CRM_Utils_Hook::tokenValues($contactArray,
array($contactID),
$subject = "{strip}$subject{/strip}";
// parse the three elements with Smarty
-
-
$smarty = CRM_Core_Smarty::singleton();
foreach ($params['tplParams'] as $name => $value) {
$smarty->assign($name, $value);
foreach (array(
'subject',
'text',
- 'html'
+ 'html',
) as $elem) {
$$elem = $smarty->fetch("string:{$$elem}");
}
* @param object $note
* Either the id of the note to retrieve, or the CRM_Core_DAO_Note object itself.
*
- * @return boolean
+ * @return bool
* TRUE if the note should be displayed, otherwise FALSE
*
*/
* @param array $params
* (reference ) an assoc array of name/value pairs.
*
- * @return boolean
+ * @return bool
*/
public static function dataExists(&$params) {
// return if no data present
*
* @param int $optionGroupId
* Id of the Option Group to be deleted.
- *
- * @return void
- *
*/
public static function del($optionGroupId) {
// need to delete all option value field before deleting group
* @param int $optionGroupId
* Id of the Option Group.
*
- * @return String
+ * @return string
* title
- *
*/
public static function getTitle($optionGroupId) {
$optionGroup = new CRM_Core_DAO_OptionGroup();
AND v.is_active = 1
";
-
$dao = CRM_Core_DAO::executeQuery($sql);
while ($dao->fetch()) {
if (!$dao->value) {
$wherePrev = " WHERE pn.id < %1 AND pn.cacheKey = %2 {$where} ORDER BY ID DESC LIMIT 1";
$sqlPrev = $sql . $wherePrev;
-
$dao = CRM_Core_DAO::executeQuery($sqlPrev, $p);
if ($dao->fetch()) {
$pos['prev']['id1'] = $dao->entity_id1;
$sql = "DELETE FROM civicrm_prevnext_cache WHERE entity_table = %1";
$params = array(1 => array($entityTable, 'String'));
- $pair =
- !$isViceVersa ?
- "entity_id1 = %2 AND entity_id2 = %3" :
- "(entity_id1 = %2 AND entity_id2 = %3) OR (entity_id1 = %3 AND entity_id2 = %2)";
+ $pair = !$isViceVersa ? "entity_id1 = %2 AND entity_id2 = %3" : "(entity_id1 = %2 AND entity_id2 = %3) OR (entity_id1 = %3 AND entity_id2 = %2)";
$sql .= " AND ( {$pair} )";
$params[2] = array($id1, 'Integer');
$params[3] = array($id2, 'Integer');
* @param string $entity_table
* Entity table.
*
- * @return array
+ * @return array|NULL
*/
public static function getSelection($cacheKey, $action = 'get', $entity_table = 'civicrm_contact') {
if (!$cacheKey) {
- return;
+ return NULL;
}
$params = array();
* @param int $id
* Field Id.
*
- * @return boolean
+ * @return bool
*
*/
public static function del($id) {
*
* @param int $UFFieldId
*
- * @return boolean
+ * @return bool
* false if custom field are disabled else true
*/
public static function checkUFStatus($UFFieldId) {
* @param array $optional
* Array of types those are optional.
*
- * @return boolean
+ * @return bool
*/
public static function checkValidProfileType($ufGroupId, $required, $optional = NULL) {
if (!is_array($required) || empty($required)) {
- return;
+ return FALSE;
}
$ufGroup = new CRM_Core_DAO_UFGroup();
* @return string
* profile group_type
*
- * TODO Why is this function in this class? It seems to be about the UFGroup.
*/
public static function getProfileType($ufGroupId, $returnMixType = TRUE, $onlyPure = FALSE, $skipComponentType = FALSE) {
$ufGroup = new CRM_Core_DAO_UFGroup();
* True if only pure profiles are required.
* @param bool $skipComponentType
*
- * @return string
- * profile group_type
+ * @return string profile group_type
*
- * TODO Why is this function in this class? It seems to be about the UFGroup.
*/
public static function calculateProfileType($ufGroupType, $returnMixType = TRUE, $onlyPure = FALSE, $skipComponentType = FALSE) {
// profile types
*
* @param int $profileID
*
- * @return boolean
+ * @return bool
*/
public static function checkSearchableORInSelector($profileID) {
$result = FALSE;
'return' => 'field_name, is_required',
'options' => array(
'limit' => 0,
- )
+ ),
)
));
//check for valid fields ( fields that are present in billing block )
}
if (!in_array($prefixName, $validProfileFields)) {
- return;
+ return FALSE;
}
if (!empty($index) && (
));
//unset selected fields
foreach ($groupFieldList as $key => $value) {
- if (is_integer($key)) {
+ if (is_int($key)) {
unset($fields['Individual'][$value], $fields['Household'][$value], $fields['Organization'][$value]);
continue;
}
* configuration file and injects them into system wide
* configuration object.
*
- * @param $config
+ * @param CRM_Core_Config $config
* @param $oldMode
- *
- * @return array
- * collection of component settings
*/
public function add($config, $oldMode) {
foreach (get_class_vars(get_class($this)) as $key => $value) {
}
/**
- * TODO
+ * @param array $defaults
*/
public function setDefaults(&$defaults) {
foreach (get_class_vars(get_class($this)) as $key => $value) {
* Should we add a unique sequence number to the end of the key.
* @param bool $ignoreKey
* Should we not set a qfKey for this controller (for standalone forms).
- *
- * @internal param bool $whether controller is modal
*/
- function __construct(
+ public function __construct(
$title = NULL,
$modal = TRUE,
$mode = NULL,
// lets try to get it from the session and/or the request vars
// we do this early on in case there is a fatal error in retrieving the
// key and/or session
- $this->_entryURL =
- CRM_Utils_Request::retrieve('entryURL', 'String', $this);
+ $this->_entryURL
+ = CRM_Utils_Request::retrieve('entryURL', 'String', $this);
// add a unique validable key to the name
$name = CRM_Utils_System::getClassName($this);
* Helper function to add all the needed default actions. Note that the framework
* redefines all of the default QFC actions
*
- * @param string directory to store all the uploaded files
- * @param array names for the various upload buttons (note u can have more than 1 upload)
+ * @param string $uploadDirectory to store all the uploaded files
+ * @param array $uploadNames for the various upload buttons (note u can have more than 1 upload)
*
*
* @return void
/**
* Getter for embedded
*
- * @return boolean
+ * @return bool
* return the embedded value
*/
public function getEmbedded() {
/**
* Getter for skipRedirection
*
- * @return boolean
+ * @return bool
* return the skipRedirection value
*/
public function getSkipRedirection() {
/**
* Getter for print
*
- * @return boolean
+ * @return bool
* return the print value
*/
public function getPrint() {
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2014
* $Id$
- *
*/
class CRM_Core_Controller_Simple extends CRM_Core_Controller {
/**
- * Constructor
+ * Constructor.
*
* @param null $path
+ * The class Path of the form being implemented
* @param bool $title
- * @param string path the class Path of the form being implemented
+ * @param string $mode
* @param bool $imageUpload
* @param bool $addSequence
* Should we add a unique sequence number to the end of the key.
* Should we not set a qfKey for this controller (for standalone forms).
* @param bool $attachUpload
*
- *
* @return \CRM_Core_Controller_Simple
*/
- function __construct(
+ public function __construct(
$path,
$title,
$mode = NULL,
}
/**
+ * Set parent.
+ *
* @param $parent
*/
public function setParent($parent) {
}
/**
- * @return mixed
+ * Get template file name.
+ *
+ * @return string
*/
public function getTemplateFileName() {
// there is only one form here, so should be quite easy
}
/**
- * A wrapper for getTemplateFileName that includes calling the hook to
- * prevent us from having to copy & paste the logic of calling the hook
+ * A wrapper for getTemplateFileName.
+ *
+ * This includes calling the hook to prevent us from having to copy & paste
+ * the logic of calling the hook
*/
public function getHookedTemplateFileName() {
$pageTemplateFile = $this->getTemplateFileName();
$required = TRUE;
}
if (!$required && $dbName != 'contact_id') {
- $fkDAO = new $FKClassName;
+ $fkDAO = new $FKClassName();
if ($fkDAO->find(TRUE)) {
$this->$dbName = $fkDAO->id;
}
case CRM_Utils_Type::T_TIME:
CRM_Core_Error::fatal('T_TIME shouldnt be used.');
- //$object->$dbName='000000';
- //break;
+ //$object->$dbName='000000';
+ //break;
case CRM_Utils_Type::T_CCNUM:
$this->$dbName = '4111 1111 1111 1111';
break;
*
* @return array
*/
- static function &fields() {
+ public static function &fields() {
$result = NULL;
return $result;
}
/**
* Get/set an associative array of table columns
*
- * @param array key=>type array
* @return array
* (associative)
*/
* @param array $params
* (reference ) associative array of name/value pairs.
*
- * @return boolean
- * did we copy all null values into the object
+ * @return bool
+ * Did we copy all null values into the object
*/
public function copyValues(&$params) {
$fields = &$this->fields();
* @param string $fieldName
* The name of the field in the DAO.
*
- * @return boolean
+ * @return bool
* true if object exists
*/
public static function objectExists($value, $daoName, $daoID, $fieldName = 'name') {
* @param bool $i18nRewrite
* Whether to rewrite the query on multilingual setups.
*
- * @return boolean
+ * @return bool
* true if exists, else false
*/
public static function checkFieldExists($tableName, $columnName, $i18nRewrite = TRUE) {
* @param string $tableName
* @param string $constraint
*
- * @return boolean
+ * @return bool
* true if constraint exists, false otherwise
*/
public static function checkConstraintExists($tableName, $constraint) {
*
* @throws Exception
*
- * @return boolean
+ * @return bool
* true if CONSTRAINT keyword exists, false otherwise
*/
public static function schemaRequiresRebuilding($tables = array("civicrm_contact")) {
* @param string $tableName
* @param string $columnName
*
- * @return boolean
+ * @return bool
* true if in format, false otherwise
*/
public static function checkFKConstraintInFormat($tableName, $columnName) {
* @param string $columnName
* @param string $columnValue
*
- * @return boolean
+ * @return bool
* true if the value is always $columnValue, false otherwise
*/
public static function checkFieldHasAlwaysValue($tableName, $columnName, $columnValue) {
* @param string $tableName
* @param string $columnName
*
- * @return boolean
+ * @return bool
* true if if the value is always NULL, false otherwise
*/
public static function checkFieldIsAlwaysNull($tableName, $columnName) {
*
* @param string $tableName
*
- * @return boolean
+ * @return bool
* true if exists, else false
*/
public static function checkTableExists($tableName) {
* @param string $searchColumn
* Name of the column you want to search by.
*
- * @return boolean
+ * @return bool
* true if we found and updated the object, else false
*/
public static function setFieldValue($daoName, $searchValue, $setColumn, $setValue, $searchColumn = 'id') {
* @param bool $i18nRewrite
* @param bool $trapException
*
- * @return CRM_Core_DAO
+ * @return CRM_Core_DAO|object
* object that holds the results of the query
+ * NB - if this is defined as just returning a DAO phpstorm keeps pointing
+ * out all the properties that are not part of the DAO
*/
- static function &executeQuery(
+ public static function &executeQuery(
$query,
$params = array(),
$abort = TRUE,
if ($freeDAO ||
preg_match('/^(insert|update|delete|create|drop|replace)/i', $queryStr)
) {
- // we typically do this for insert/update/delete stataments OR if explicitly asked to
+ // we typically do this for insert/update/delete statements OR if explicitly asked to
// free the dao
$dao->free();
}
* the result of the query if any
*
*/
- static function &singleValueQuery(
+ public static function &singleValueQuery(
$query,
$params = array(),
$abort = TRUE,
* @return CRM_Core_DAO
* the newly created copy of the object
*/
- static function ©Generic($daoName, $criteria, $newData = NULL, $fieldsFix = NULL, $blockCopyOfDependencies = NULL) {
+ public static function ©Generic($daoName, $criteria, $newData = NULL, $fieldsFix = NULL, $blockCopyOfDependencies = NULL) {
$object = new $daoName();
if (!$newData) {
$object->id = $criteria['id'];
* an object of type referenced by daoName
*/
public static function commonRetrieveAll($daoName, $fieldIdName = 'id', $fieldId, &$details, $returnProperities = NULL) {
- require_once(str_replace('_', DIRECTORY_SEPARATOR, $daoName) . ".php");
+ require_once str_replace('_', DIRECTORY_SEPARATOR, $daoName) . ".php";
$object = new $daoName();
$object->$fieldIdName = $fieldId;
* @param int $numObjects
* @param bool $createOnly
*
- * @return
+ * @return object|array|NULL
+ * NULL if $createOnly. A single object if $numObjects==1. Otherwise, an array of multiple objects.
*/
- static function createTestObject(
+ public static function createTestObject(
$daoName,
$params = array(),
$numObjects = 1,
'CRM_Core_DAO_StateProvince',
'CRM_Core_DAO_Country',
'CRM_Core_DAO_Domain',
- 'CRM_Financial_DAO_FinancialType'
+ 'CRM_Financial_DAO_FinancialType',
//because valid ones exist & we use pick them due to pseudoconstant can't reliably create & delete these
);
}
if ($createOnly) {
- return;
+ return NULL;
}
elseif ($numObjects == 1) {
return $objects[0];
public static function triggerRebuild($tableName = NULL, $force = FALSE) {
$info = array();
- $logging = new CRM_Logging_Schema;
+ $logging = new CRM_Logging_Schema();
$logging->triggerInfo($info, $tableName, $force);
CRM_Core_I18n_Schema::triggerInfo($info, $tableName);
public static function dropTriggers($tableName = NULL) {
$info = array();
- $logging = new CRM_Logging_Schema;
+ $logging = new CRM_Logging_Schema();
$logging->triggerInfo($info, $tableName);
// drop all existing triggers on all tables
*
* @param string $fieldName
* @param string $context
- * @see CRM_Core_DAO::buildOptionsContext.
+ * @see CRM_Core_DAO::buildOptionsContext
* @param array $props
* whatever is known about this bao object.
*
- * @return Array|bool
+ * @return array|bool
*/
public static function buildOptions($fieldName, $context = NULL, $props = array()) {
// If a given bao does not override this function
public function getOptionLabels() {
$fields = $this->fields();
if ($fields === NULL) {
- throw new Exception ('Cannot call getOptionLabels on CRM_Core_DAO');
+ throw new Exception('Cannot call getOptionLabels on CRM_Core_DAO');
}
foreach ($fields as $field) {
$name = CRM_Utils_Array::value('name', $field);
}
$escapedCriteria = array_map(array(
'CRM_Core_DAO',
- 'escapeString'
+ 'escapeString',
), $criteria);
if (!$returnSanitisedArray) {
return (sprintf('%s %s ("%s")', $fieldName, $operator, implode('", "', $escapedCriteria)));
}
return $escapedCriteria;
- break;
// binary operators
'BETWEEN',
'NOT BETWEEN',
'IS NOT NULL',
- 'IS NULL'
+ 'IS NULL',
);
}
*
* @return void
*/
- static function buildQuickForm(
+ public static function buildQuickForm(
&$form, $parentNames, $entityTable, $entityId = NULL, $skipTagCreate = FALSE,
$skipEntityAction = FALSE, $tagsetElementName = NULL) {
$tagset = $form->_entityTagValues = array();
/**
* @return mixed
*/
- static function &indices() {
+ public static function &indices() {
static $result = NULL;
if (!$result) {
$result = unserialize('a:4:{s:20:"civicrm_custom_group";a:1:{s:16:"UI_title_extends";a:4:{s:4:"name";s:16:"UI_title_extends";s:5:"field";a:2:{i:0;s:5:"title";i:1;s:7:"extends";}s:11:"localizable";b:1;s:6:"unique";b:1;}}s:20:"civicrm_custom_field";a:1:{s:24:"UI_label_custom_group_id";a:4:{s:4:"name";s:24:"UI_label_custom_group_id";s:5:"field";a:2:{i:0;s:5:"label";i:1;s:15:"custom_group_id";}s:11:"localizable";b:1;s:6:"unique";b:1;}}s:17:"civicrm_price_set";a:1:{s:8:"UI_title";a:4:{s:4:"name";s:8:"UI_title";s:5:"field";a:1:{i:0;s:5:"title";}s:11:"localizable";b:1;s:6:"unique";b:1;}}s:15:"civicrm_contact";a:5:{s:15:"index_sort_name";a:3:{s:4:"name";s:15:"index_sort_name";s:5:"field";a:1:{i:0;s:9:"sort_name";}s:11:"localizable";b:1;}s:16:"index_first_name";a:3:{s:4:"name";s:16:"index_first_name";s:5:"field";a:1:{i:0;s:10:"first_name";}s:11:"localizable";b:1;}s:15:"index_last_name";a:3:{s:4:"name";s:15:"index_last_name";s:5:"field";a:1:{i:0;s:9:"last_name";}s:11:"localizable";b:1;}s:20:"index_household_name";a:3:{s:4:"name";s:20:"index_household_name";s:5:"field";a:1:{i:0;s:14:"household_name";}s:11:"localizable";b:1;}s:23:"index_organization_name";a:3:{s:4:"name";s:23:"index_organization_name";s:5:"field";a:1:{i:0;s:17:"organization_name";}s:11:"localizable";b:1;}}}');
}
/**
- * @return array
+ * @return array $result
*/
- static function &tables() {
+ public static function &tables() {
static $result = NULL;
if (!$result) {
$result = array_keys(self::columns());
}
/**
- * @return boolean
+ * @return bool
*/
public function getActive() {
return $this->isActive;
* @param \Civi\Core\Event\UnhandledExceptionEvent $event
* @throws Exception
*/
- static function handleException($event) {
+ public static function handleException($event) {
$e = $event->exception;
if ($e instanceof CRM_Core_Exception) {
$params = $e->getErrorData();
* This function takes care of all the things common to all
* pages. This typically involves assigning the appropriate
* smarty variable :)
- *
- * @return string
- * The content generated by running this page
*/
public function run() {
if ($this->_embedded) {
CRM_Utils_Hook::alterContent($content, 'page', $pageTemplateFile, $this);
echo CRM_Utils_System::theme($content, $this->_print);
- return;
}
/**
// FIXME: This is done to maintain current wire protocol, but it might be
// simpler to just require different 'types' for pages and forms
if (preg_match('/^CRM_[a-zA-Z0-9]+_Page_Inline_/', $className)) {
- $page = new $className;
+ $page = new $className();
$page->run();
}
else {
$angularModules = array();
$angularModules['angularFileUpload'] = array(
'ext' => 'civicrm',
- 'js' => array('bower_components/angular-file-upload/angular-file-upload.min.js')
+ 'js' => array('bower_components/angular-file-upload/angular-file-upload.min.js'),
);
$angularModules['crmApp'] = array('ext' => 'civicrm', 'js' => array('js/angular-crmApp.js'));
$angularModules['crmAttachment'] = array(
'ext' => 'civicrm',
'js' => array('js/angular-crmAttachment.js'),
- 'css' => array('css/angular-crmAttachment.css')
+ 'css' => array('css/angular-crmAttachment.css'),
);
$angularModules['crmUi'] = array(
'ext' => 'civicrm',
- 'js' => array('js/angular-crm-ui.js', 'packages/ckeditor/ckeditor.js')
+ 'js' => array('js/angular-crm-ui.js', 'packages/ckeditor/ckeditor.js'),
);
$angularModules['crmUtil'] = array('ext' => 'civicrm', 'js' => array('js/angular-crm-util.js'));
// https://github.com/jwstadler/angular-jquery-dialog-service
$angularModules['dialogService'] = array(
'ext' => 'civicrm',
- 'js' => array('bower_components/angular-jquery-dialog-service/dialog-service.js')
+ 'js' => array('bower_components/angular-jquery-dialog-service/dialog-service.js'),
);
$angularModules['ngSanitize'] = array('ext' => 'civicrm', 'js' => array('js/angular-sanitize.js'));
$angularModules['ui.utils'] = array(
'ext' => 'civicrm',
- 'js' => array('bower_components/angular-ui-utils/ui-utils.min.js')
+ 'js' => array('bower_components/angular-ui-utils/ui-utils.min.js'),
);
$angularModules['ui.sortable'] = array(
'ext' => 'civicrm',
- 'js' => array('bower_components/angular-ui-sortable/sortable.min.js')
+ 'js' => array('bower_components/angular-ui-sortable/sortable.min.js'),
);
$angularModules['unsavedChanges'] = array(
'ext' => 'civicrm',
- 'js' => array('bower_components/angular-unsavedChanges/dist/unsavedChanges.min.js')
+ 'js' => array('bower_components/angular-unsavedChanges/dist/unsavedChanges.min.js'),
);
foreach (CRM_Core_Component::getEnabledComponents() as $component) {
*
* @return string
*/
-
- abstract function getBAOName();
+ abstract protected function getBAOName();
/**
* An array of action links
* @return array
* (reference)
*/
- abstract function &links();
+ abstract protected function &links();
/**
* Name of the edit form class
*
* @return string
*/
- abstract function editForm();
+ abstract protected function editForm();
/**
* Name of the form
*
* @return string
*/
- abstract function editName();
+ abstract protected function editName();
/**
* UserContext to pop back to
*
* @return string
*/
- abstract function userContext($mode = NULL);
+ abstract protected function userContext($mode = NULL);
/**
* Get userContext params
if (!empty($values['name']) && in_array($values['name'], array(
'encounter_medium',
'case_type',
- 'case_status'
+ 'case_status',
))
) {
static $caseCount = NULL;
'rule_message' => ts('Please enter a valid value for your card security code. This is usually the last 3-4 digits on the card\'s signature panel.'),
'rule_name' => 'integer',
'rule_parameters' => NULL,
- )
+ ),
),
),
'credit_card_exp_date' => array(
'rule_message' => ts('Card expiration date cannot be a past date.'),
'rule_name' => 'currentDate',
'rule_parameters' => TRUE,
- )
+ ),
),
),
'credit_card_type' => array(
'rule_message' => ts('Please enter a valid Bank Identification Number (value must not contain punctuation characters).'),
'rule_name' => 'nopunctuation',
'rule_parameters' => NULL,
- )
+ ),
),
'is_required' => TRUE,
),
'rule_message' => ts('Please enter a valid Bank Identification Number (value must not contain punctuation characters).'),
'rule_name' => 'nopunctuation',
'rule_parameters' => NULL,
- )
+ ),
),
),
'bank_name' => array(
* the result in an nice formatted array (or an error object)
* @abstract
*/
- abstract function doDirectPayment(&$params);
+ abstract protected function doDirectPayment(&$params);
/**
* Process payment - this function wraps around both doTransferPayment and doDirectPayment
* @return string
* the error message if any
*/
- abstract function checkConfig();
+ abstract protected function checkConfig();
/**
* @param $paymentProcessor
* @param string $method
* Method to check for.
*
- * @return boolean
+ * @return bool
*/
public function isSupported($method = 'cancelSubscription') {
return method_exists(CRM_Utils_System::getClassName($this), $method);
*
* @return string
* the HMAC_MD5 encoding string
- **/
+ */
public function hmac($key, $data) {
if (function_exists('mhash')) {
// Use PHP mhash extension
*
* @return string
* fingerprint
- **/
+ */
public function CalculateFP() {
$x_tran_key = $this->_getParam('paymentKey');
$loginid = $this->_getParam('apiLogin');
'labelColumn' => 'name',
'flip' => 1
));
- if ((empty($input['prevContribution']) && $paymentProcessorId) || (!$input['prevContribution']->is_pay_later && -$input['prevContribution']->contribution_status_id == $contributionStatuses['Pending'])) {
+ if ((empty($input['prevContribution']) && $paymentProcessorId) || (!$input['prevContribution']->is_pay_later && $input['prevContribution']->contribution_status_id == $contributionStatuses['Pending'])) {
$input['payment_processor'] = $paymentProcessorId;
}
$input['contribution_status_id'] = $contributionStatuses['Completed'];
* WARY of this when coding
*
* -----------------------------------------------------------------------------------------------
- **/
+ */
class CRM_Core_Payment_Elavon extends CRM_Core_Payment {
// (not used, implicit in the API, might need to convert?)
const
* If an result of class error is returned it is treated as a failure
*
* -----------------------------------------------------------------------------------------------
- **/
+ */
/**
* From Payment processor documentation
*/
static private $_singleton = NULL;
- /**********************************************************
+ /**
* Constructor
*
* @param string $mode
$this->_paymentProcessor = $paymentProcessor;
}
- /**********************************************************
+ /**
* This function is set up and put here to make the mapping of fields
* from the params object as visually clear as possible for easy editing
*
* Comment out irrelevant fields
- **********************************************************/
+ */
public function mapProcessorFieldstoParams($params) {
/*concatenate full customer name first - code from EWAY gateway
*/
return $requestFields;
}
- /**********************************************************
+ /**
* This function sends request and receives response from
* the processor
- **********************************************************/
+ */
public function doDirectPayment(&$params) {
if ($params['is_recur'] == TRUE) {
CRM_Core_Error::fatal(ts('%1 - recurring payments not implemented', array(1 => $paymentProcessor)));
return $contribution->find();
}
- /**************************************************
+ /**
* Produces error message and returns from class
- **************************************************/
+ */
public function &errorExit($errorCode = NULL, $errorMessage = NULL) {
$e = CRM_Core_Error::singleton();
return $e;
}
- /**************************************************
+ /**
* NOTE: 'doTransferCheckout' not implemented
- **************************************************/
+ */
public function doTransferCheckout(&$params, $component) {
CRM_Core_Error::fatal(ts('This function is not implemented'));
}
- /********************************************************************************************
+ /**
* This public function checks to see if we have the right processor config values set
*
* NOTE: Called by Events and Contribute to check config params are set prior to trying
*
* returns string $errorMsg if any errors found - null if OK
*
- ******************************************************************************************
+ * function checkConfig( $mode ) CiviCRM V1.9 Declaration
+ * CiviCRM V2.0 Declaration
*/
- // function checkConfig( $mode ) // CiviCRM V1.9 Declaration
- // CiviCRM V2.0 Declaration
public function checkConfig() {
$errorMsg = array();
* @param array $ids
* @param array $objects
* @param bool $first
- * @return void|boolean
+ * @return void|bool
*/
public function recur(&$input, &$ids, &$objects, $first) {
if (!isset($input['txnType'])) {
case 'recurring_payment_profile_created':
if (in_array($recur->contribution_status_id, array(
array_search('Pending', $contributionStatuses),
- array_search('In Progress', $contributionStatuses)
+ array_search('In Progress', $contributionStatuses),
))
&& !empty($recur->processor_id)
) {
* (with the input parameters) & call this & all will be done
*
* @todo the references to POST throughout this class need to be removed
- * @return void|boolean
+ * @return void|bool
*/
public function main() {
CRM_Core_Error::debug_var('GET', $_GET, TRUE, TRUE);
CRM_Core_Error::debug_var('POST', $_POST, TRUE, TRUE);
if ($this->_isPaymentExpress) {
$this->handlePaymentExpress();
- return;
+ return NULL;
}
$objects = $ids = $input = array();
$this->_component = $input['component'] = self::getValue('m');
$contributionRecur = civicrm_api3('contribution_recur', 'getsingle', array(
'return' => 'contact_id, id',
- 'invoice_id' => $input['invoice']
+ 'invoice_id' => $input['invoice'],
));
$ids['contact'] = $contributionRecur['contact_id'];
$ids['contributionRecur'] = $contributionRecur['id'];
$ids['contributionPage'] = CRM_Core_DAO::singleValueQuery("SELECT contribution_page_id FROM civicrm_contribution WHERE invoice_id = %1", array(
1 => array(
$ids['contribution'],
- 'Integer'
- )
+ 'Integer',
+ ),
));
// only handle component at this stage - not terribly sure how a recurring event payment would arise
// & suspec main function may be a victom of copy & paste
* ie - all other amounts will return a failed response.
*
* -----------------------------------------------------------------------------------------------
- **/
+ */
class CRM_Core_Payment_eWAY extends CRM_Core_Payment {
# (not used, implicit in the API, might need to convert?)
const CHARSET = 'UTF-8';
*/
static private $_singleton = NULL;
- /**********************************************************
+ /**
+ * *******************************************************
* Constructor
*
* @param string $mode
* The mode of operation: live or test.
*
- * @param $paymentProcessor
+ * @param int $paymentProcessor
*
- * @return \CRM_Core_Payment_eWAY *******************************************************
+ * *******************************************************
*/
public function __construct($mode, &$paymentProcessor) {
// require Standard eWAY API libraries
$this->_processorName = ts('eWay');
}
- /**********************************************************
+ /**
+ * *******************************************************
* This function sends request and receives response from
* eWAY payment process
- **********************************************************/
+ * *******************************************************
+ */
public function doDirectPayment(&$params) {
if (CRM_Utils_Array::value('is_recur', $params) == TRUE) {
CRM_Core_Error::fatal(ts('eWAY - recurring payments not implemented'));
//------------------------------------
// create eWAY gateway objects
//------------------------------------
- $eWAYRequest = new GatewayRequest;
+ $eWAYRequest = new GatewayRequest();
if (($eWAYRequest == NULL) || (!($eWAYRequest instanceof GatewayRequest))) {
return self::errorExit(9001, "Error: Unable to create eWAY Request object.");
}
- $eWAYResponse = new GatewayResponse;
+ $eWAYResponse = new GatewayResponse();
if (($eWAYResponse == NULL) || (!($eWAYResponse instanceof GatewayResponse))) {
return self::errorExit(9002, "Error: Unable to create eWAY Response object.");
return $contribution->find();
}
- /*************************************************************************************************
+ /**
+ * **********************************************************************************************
* This function checks the eWAY response status - returning a boolean false if status != 'true'
- *************************************************************************************************/
+ * ************************************************************************************************
+ */
public function isError(&$response) {
$status = $response->Status();
return FALSE;
}
- /**************************************************
+ /**
+ * ************************************************
* Produces error message and returns from class
- **************************************************/
+ * *************************************************
+ */
public function &errorExit($errorCode = NULL, $errorMessage = NULL) {
$e = CRM_Core_Error::singleton();
return $e;
}
- /**************************************************
+ /**
+ * ************************************************
* NOTE: 'doTransferCheckout' not implemented
- **************************************************/
+ * ************************************************
+ */
public function doTransferCheckout(&$params, $component) {
CRM_Core_Error::fatal(ts('This function is not implemented'));
}
- /********************************************************************************************
+ /**
+ * *****************************************************************************************
* This public function checks to see if we have the right processor config values set
*
* NOTE: Called by Events and Contribute to check config params are set prior to trying
*
* returns string $errorMsg if any errors found - null if OK
*
- ******************************************************************************************
+ * *****************************************************************************************
*/
- //function checkConfig( $mode ) // CiviCRM V1.9 Declaration
- // CiviCRM V2.0 Declaration
public function checkConfig() {
$errorMsg = array();
* @param string $str
* The permission to check.
*
- * @return boolean
- * true if yes, else false
*/
-
public function check($str) {
//no default behaviour
}
* @param array $array
* The roles to check.
*
- * @return boolean
+ * @return bool
* true if yes, else false
*/
-
public function checkGroupRole($array) {
return FALSE;
}
* @param string $permissionName
* Name of the permission we are interested in.
*
- * @return string
- * a comma separated list of email addresses
*/
public function permissionEmails($permissionName) {
CRM_Core_Error::fatal("this function only works in Drupal 6 at the moment");
* @param string $roleName
* Name of the role we are interested in.
*
- * @return string
- * a comma separated list of email addresses
*/
public function roleEmails($roleName) {
CRM_Core_Error::fatal("this function only works in Drupal 6 at the moment");
* @param array $array
* The roles to check.
*
- * @return boolean
+ * @return bool
* true if yes, else false
*/
public function checkGroupRole($array) {
* @param string $str
* The permission to check.
*
- * @return boolean
+ * @return bool
* true if yes, else false
*/
public function check($str) {
* @param array $array
* The roles to check.
*
- * @return boolean
+ * @return bool
* true if yes, else false
*/
public function checkGroupRole($array) {
* @param string $str
* The permission to check.
*
- * @return boolean
+ * @return bool
* true if yes, else false
*/
-
public function check($str) {
return TRUE;
}
* @param string $str
* The permission to check.
*
- * @return boolean
+ * @return bool
* true if yes, else false
*/
public function check($str) {
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2014
* $Id$
- *
*/
class CRM_Core_QuickForm_Action_Upload extends CRM_Core_QuickForm_Action {
protected $_uploadDir;
/**
- * Class constructor
+ * Class constructor.
*
* @param object $stateMachine
* Reference to state machine object.
}
/**
- * Upload and move the file if valid to the uploaded directory
+ * Upload and move the file if valid to the uploaded directory.
*
* @param CRM_Core_Form $page
* The CRM_Core_Form object.
* The name of the page which index the data container with.
* @param string $uploadName
* The name of the uploaded file.
- *
- * @return void
*/
public function upload(&$page, &$data, $pageName, $uploadName) {
// make sure uploadName exists in the QF array
if (!$status) {
CRM_Core_Error::statusBounce(ts('We could not move the uploaded file %1 to the upload directory %2. Please verify that the \'Temporary Files\' setting points to a valid path which is writable by your web server.', array(
1 => $value['name'],
- 2 => $this->_uploadDir
+ 2 => $this->_uploadDir,
)));
}
if (!empty($data['values'][$pageName][$uploadName]['name'])) {
* CRM_Core_Form the current form-page.
* @param string $actionName
* Current action name, as one Action object can serve multiple actions.
- *
- * @return void
*/
public function perform(&$page, $actionName) {
// like in Action_Next
// the above buildForm potentially changes the action function with different args
// so basically the rug might have been pulled from us, so we actually just check
// and potentially call the right one
- // this allows standalong form uploads to work nicely
+ // this allows standalone form uploads to work nicely
$page->controller->_actions['upload']->realPerform($page, $actionName);
}
/**
+ * Real perform.
+ *
+ * @todo document what I do.
+ *
* @param CRM_Core_Form $page
* @param string $actionName
*
* @throws PEAR_Error
* @see loadArray()
*/
- function load(
+ public function load(
&$options, $param1 = NULL, $param2 = NULL,
$param3 = NULL, $param4 = NULL
) {
*/
function smarty_block_crmRegion($params, $content, &$smarty, &$repeat) {
if ($repeat) {
- return;
+ return NULL;
}
require_once 'CRM/Core/Region.php';
$region = CRM_Core_Region::instance($params['name'], FALSE);
/**
* Set variables up before form is built
*
- * @param null
- *
* @return void
*/
public function preProcess() {
* Set default values for the form. Note that in edit/view mode
* the default values are retrieved from the database
*
- * @param null
- *
* @return array
* array of default values
*/
/**
* Build the form object
*
- * @param null
- *
* @return void
*/
public function buildQuickForm() {
'option_group_id',
ts('Multiple Choice Option Sets'),
array(
- '' => ts('- select -')
+ '' => ts('- select -'),
) + $optionGroups
);
}
ts('Option Type'),
$optionTypes,
array(
- 'onclick' => "showOptionSelect();"
+ 'onclick' => "showOptionSelect();",
), '<br/>'
);
/**
* Process the form
*
- * @param null
- *
* @return void
*/
public function postProcess() {
1,
2,
3,
- 5
+ 5,
))) {
if (empty($params['is_searchable'])) {
$params['is_search_range'] = 0;
}
$customGroup = array(
- '' => ts('- select -')
- ) + $customGroup;
+ '' => ts('- select -'),
+ ) + $customGroup;
$this->add('select',
'dst_group_id',
ts('Destination'),
/**
* Set variables up before form is built
*
- * @param null
- *
* @return void
*/
public function preProcess() {
* Set default values for the form. Note that in edit/view mode
* the default values are retrieved from the database
*
- * @param null
- *
* @return array
* array of default values
*/
/**
* Build the form object
*
- * @param null
- *
* @return void
*/
public function buildQuickForm() {
/**
* Process the form
*
- * @param null
- *
* @return void
*/
public function postProcess() {
}
$fieldValues = array('option_group_id' => $this->_optionGroupID);
- $customOption->weight =
- CRM_Utils_Weight::updateOtherWeights(
+ $customOption->weight
+ = CRM_Utils_Weight::updateOtherWeights(
'CRM_Core_DAO_OptionValue',
$oldWeight,
$params['weight'],
else {
$defVal[] = $customOption->value;
}
- $customField->default_value =
- CRM_Core_DAO::VALUE_SEPARATOR .
+ $customField->default_value
+ = CRM_Core_DAO::VALUE_SEPARATOR .
implode(CRM_Core_DAO::VALUE_SEPARATOR, $defVal) .
CRM_Core_DAO::VALUE_SEPARATOR;
$customField->save();
}
}
- $customField->default_value =
- CRM_Core_DAO::VALUE_SEPARATOR .
+ $customField->default_value
+ = CRM_Core_DAO::VALUE_SEPARATOR .
implode(CRM_Core_DAO::VALUE_SEPARATOR, $tempVal) .
CRM_Core_DAO::VALUE_SEPARATOR;
$customField->save();
$this->setMaxFileSize($uploadFileSize);
$this->addRule('uploadFile', ts('File size should be less than %1 MBytes (%2 bytes)', array(
1 => $uploadSize,
- 2 => $uploadFileSize
+ 2 => $uploadFileSize,
)), 'maxfilesize', $uploadFileSize);
$this->addRule('uploadFile', ts('A valid file must be uploaded.'), 'uploadedfile');
$this->addRule('uploadFile', ts('Input file must be in CSV format'), 'utf8File');
$item = (array) $item;
// Clean up description - remove tags that would break dashboard layout
$description = preg_replace('#<h[1-3][^>]*>(.+?)</h[1-3][^>]*>#s', '<h4>$1</h4>', $item['description']);
- $item['description'] = strip_tags($description, "<a><p><h4><h5><h6><b><i><em><strong><ol><ul><li><dd><dt><code><pre><br>");
+ $item['description'] = strip_tags($description, "<a><p><h4><h5><h6><b><i><em><strong><ol><ul><li><dd><dt><code><pre><br/>");
$blog[] = $item;
}
if ($blog) {
class CRM_Dedupe_BAO_QueryBuilder_IndividualSupervised extends CRM_Dedupe_BAO_QueryBuilder {
/**
- * @param $rg
+ * Record - what do I do.
+ *
+ * @param object $rg
*
* @return array
*/
$civicrm_email = CRM_Utils_Array::value('civicrm_email', $rg->params, array());
$params = array(
- 1 => array(CRM_Utils_Array::value('first_name', $civicrm_contact, ''), 'String'),
- 2 => array(CRM_Utils_Array::value('last_name', $civicrm_contact, ''), 'String'),
- 3 => array(CRM_Utils_Array::value('email', $civicrm_email, ''), 'String'),
+ 1 => array(
+ CRM_Utils_Array::value('first_name', $civicrm_contact, ''),
+ 'String',
+ ),
+ 2 => array(
+ CRM_Utils_Array::value('last_name', $civicrm_contact, ''),
+ 'String',
+ ),
+ 3 => array(
+ CRM_Utils_Array::value('email', $civicrm_email, ''),
+ 'String',
+ ),
);
return array(
}
/**
- * @param $rg
+ * Internal - what do I do.
+ *
+ * @param object $rg
*
* @return array
*/
email1.email=email2.email
WHERE contact1.contact_type = 'Individual'
AND " . self::internalFilters($rg);
- return array("civicrm_contact.{$rg->name}.{$rg->threshold}" => $query);
+ return array(
+ "civicrm_contact.{$rg->name}.{$rg->threshold}" => $query,
+ );
}
}
-
-;
return array("civicrm_contact.{$rg->name}.{$rg->threshold}" => $query);
}
}
-
-;
* Helps decide how to behave when there are conflicts.
* A 'safe' value skips the merge if there are any un-resolved conflicts.
* Does a force merge otherwise.
- * @param bool $autoFlipWether to let api decide which contact to retain and which to delete.
+ * @param bool $autoFlip to let api decide which contact to retain and which to delete.
* Wether to let api decide which contact to retain and which to delete.
* @param bool $redirectForPerformance
*
* Helps decide how to behave when there are conflicts.
* A 'safe' value skips the merge if there are any un-resolved conflicts.
* Does a force merge otherwise (aggressive mode).
- * @param bool $autoFlipWether to let api decide which contact to retain and which to delete.
+ * @param bool $autoFlip to let api decide which contact to retain and which to delete.
* Wether to let api decide which contact to retain and which to delete.
*
*
$params = array(
'contact_id' => $cid,
'version' => 3,
- 'return' => array_merge(array('display_name'), self::getContactFields())
+ 'return' => array_merge(array('display_name'), self::getContactFields()),
);
$result = civicrm_api('contact', 'get', $params);
$specialValues[$moniker]['preferred_communication_method'] = CRM_Core_DAO::VALUE_SEPARATOR . $prefCommList . CRM_Core_DAO::VALUE_SEPARATOR;
}
$names = array(
- 'preferred_communication_method' =>
- array(
- 'newName' => 'preferred_communication_method_display',
- 'groupName' => 'preferred_communication_method',
- ),
+ 'preferred_communication_method' => array(
+ 'newName' => 'preferred_communication_method_display',
+ 'groupName' => 'preferred_communication_method',
+ ),
);
CRM_Core_OptionGroup::lookupValues($specialValues[$moniker], $names);
if (in_array($htmlType, array(
'CheckBox',
'Multi-Select',
- 'AdvMulti-Select'
+ 'AdvMulti-Select',
))) {
$submitted[$key] = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR,
$mergeValue
}
elseif (in_array($htmlType, array(
'Multi-Select Country',
- 'Multi-Select State/Province'
+ 'Multi-Select State/Province',
))) {
//we require submitted values should be in array format
if ($value) {
'modified_date',
'primary_contact_id',
'sort_name',
- 'user_unique_id'
+ 'user_unique_id',
);
foreach ($contactFields as $field => $value) {
if (in_array($field, $invalidFields)) {
/**
* Added for CRM-12695
- * Based on the contactId provided
+ * Based on the contactID provided
* add/update membership(s) to related contacts
*
- * @param contactId
+ * @param int $contactID
*/
public static function addMembershipToRealtedContacts($contactID) {
$dao = new CRM_Member_DAO_Membership();
*
* @return array
*/
- static function getEvents(
+ public static function getEvents(
$all = 0,
$id = FALSE,
$isActive = TRUE,
* Get participant count
*
* @param int $eventId
- * @param bool $considerStatusConsider status for participant count.
+ * @param bool $considerStatus consider status for participant count.
* Consider status for participant count.
- * @param bool $statusConsider counted participant.
+ * @param bool $status counted participant.
* Consider counted participant.
- * @param bool $considerRoleConsider role for participant count.
+ * @param bool $considerRole consider role for participant count.
* Consider role for participant count.
- * @param bool $roleConsider counted( is filter role) participant.
+ * @param bool $role consider counted( is filter role) participant.
* Consider counted( is filter role) participant.
*
*
*
* @param date $start
* Get events with start date >= this date.
- * @param int $typeGet events on the a specific event type (by event_type_id).
+ * @param int $type Get events on the a specific event type (by event_type_id).
* Get events on the a specific event type (by event_type_id).
- * @param int $eventIdReturn a single event - by event id.
+ * @param int $eventId Return a single event - by event id.
* Return a single event - by event id.
* @param date $end
* Also get events with end date >= this date.
- * @param bool $onlyPublicInclude public events only, default TRUE.
+ * @param bool $onlyPublic Include public events only, default TRUE.
* Include public events only, default TRUE.
*
* @return array
* array of all the events that are searched
*/
- static function &getCompleteInfo(
+ public static function &getCompleteInfo(
$start = NULL,
$type = NULL,
$eventId = NULL,
array('id' => $id),
array(
'loc_block_id' =>
- ($locBlockId) ? $locBlockId : NULL,
+ ($locBlockId) ? $locBlockId : NULL,
),
$fieldsFix
);
*
* @return void
*/
- static function buildCustomDisplay(
+ public static function buildCustomDisplay(
$id,
$name,
$cid,
* @return array
* array of Additional participant's info OR array of Ids.
*/
- static function buildCustomProfile(
+ public static function buildCustomProfile(
$participantId,
$values,
$contactId = NULL,
*
* @param array $values
* @param int $eventID
- * @return boolean
+ * @return bool
*/
public static function validRegistrationRequest($values, $eventID) {
// check that the user has permission to register for this event
// Fixme - this is going to ignore context, better to get conditions, add params, and call PseudoConstant::get
return CRM_Financial_BAO_FinancialType::getIncomeFinancialType();
- break;
+ break;
}
return CRM_Core_PseudoConstant::get(__CLASS__, $fieldName, $params, $context);
}
/**
* @param array $params
*
- * @return $this|null
+ * @return this|null
*/
public static function add(&$params) {
if (empty($params)) {
return NULL;
}
- $dao = new CRM_Event_DAO_ParticipantStatusType;
+ $dao = new CRM_Event_DAO_ParticipantStatusType();
$dao->copyValues($params);
return $dao->save();
}
/**
* @param array $params
*
- * @return $this|null
+ * @return this|null
*/
public static function &create(&$params) {
$transaction = new CRM_Core_Transaction();
*/
public static function deleteParticipantStatusType($id) {
// return early if there are participants with this status
- $participant = new CRM_Event_DAO_Participant;
+ $participant = new CRM_Event_DAO_Participant();
$participant->status_id = $id;
if ($participant->find()) {
return FALSE;
CRM_Utils_Weight::delWeight('CRM_Event_DAO_ParticipantStatusType', $id);
- $dao = new CRM_Event_DAO_ParticipantStatusType;
+ $dao = new CRM_Event_DAO_ParticipantStatusType();
$dao->id = $id;
$dao->find(TRUE);
$dao->delete();
public static function retrieve(&$params, &$defaults) {
$result = NULL;
- $dao = new CRM_Event_DAO_ParticipantStatusType;
+ $dao = new CRM_Event_DAO_ParticipantStatusType();
$dao->copyValues($params);
if ($dao->find(TRUE)) {
CRM_Core_DAO::storeValues($dao, $defaults);
'cap' => 'round',
'join' => 'round',
'dash' => '2,2',
- 'color' => array(0, 0, 200)
+ 'color' => array(0, 0, 200),
);
$this->format = '5160';
$this->imgExtension = 'png';
*
* @param array $participants
*
- * @return null
+ * @return;
*/
public function run(&$participants) {
// fetch the 1st participant, and take her event to retrieve its attributes
'cap' => 'round',
'join' => 'round',
'dash' => '2,10',
- 'color' => array(255, 0, 0)
- )
+ 'color' => array(255, 0, 0),
+ ),
));
}
$img = $this->getImageFileName($this->event->id, $img);
/**
* This is supposed to be overrided
- **/
+ */
public function generateLabel($participant) {
$txt = "{$this->event['title']}
{$participant['display_name']}
*
* @param array $participants
*
- * @return null
+ * @return;
*/
public function createLabels(&$participants) {
$this->_errors[$form->html_field_name('email')] = ts("The participant %1 is already registered for %2 (%3).", array(
1 => $participant_fields['email'],
2 => $event_in_cart->event->title,
- 3 => $event_in_cart->event->start_date
+ 3 => $event_in_cart->event->start_date,
));
}
}
/**
* @param array $params
*
- * @return array
+ * @return array|void
* @throws Exception
*/
public function make_payment(&$params) {
$params_array = array(
'cart_id' => $cart->id,
'contact_id' => CRM_Event_Cart_Form_Cart::find_or_create_contact(),
- 'event_id' => $event_id
+ 'event_id' => $event_id,
);
//XXX security?
ts('Allow Online Registration'),
NULL,
array(
- 'onclick' => "return showHideByValue('is_online_registration',
- '',
- 'registration_blocks',
- 'block',
- 'radio',
- false );",
+ 'onclick' => "return showHideByValue('is_online_registration'," .
+ "''," .
+ "'registration_blocks'," .
+ "'block'," .
+ "'radio'," .
+ "false );",
)
);
* Label.
* @param array $configs
* Optional, for addProfileSelector(), defaults to using getProfileSelectorTypes().
- **/
+ */
public function buildMultipleProfileBottom(&$form, $count, $prefix = '', $label = 'Include Profile', $configs = NULL) {
extract((is_null($configs)) ? self::getProfileSelectorTypes() : $configs);
$element = $prefix . "custom_post_id_multiple[$count]";
*
* @return array
* ['allowCoreTypes' => array, 'allowSubTypes' => array, 'profileEntities' => array]
- **/
+ */
public static function getProfileSelectorTypes() {
$configs = array(
'allowCoreTypes' => array(),
$configs['allowCoreTypes'] = array_merge(array(
'Contact',
- 'Individual'
+ 'Individual',
), CRM_Contact_BAO_ContactType::subTypes('Individual'));
$configs['allowCoreTypes'][] = 'Participant';
//CRM-15427
$configs['profileEntities'][] = array(
'entity_name' => 'participant_1',
'entity_type' => 'ParticipantModel',
- 'entity_sub_type' => '*'
+ 'entity_sub_type' => '*',
);
return $configs;
* Collect all email fields for an array of profile ids
*
* @param $profileIds
- * @return boolean
+ * @return bool
*/
public static function getEmailFields($profileIds) {
$emailFields = array();
* Check if a profile contains required fields
*
* @param $profileIds
- * @return boolean
+ * @return bool
*/
public static function isProfileComplete($profileIds) {
$profileReqFields = array();
*
* @param $profileIds
* @param int $rgId
- * @return boolean
+ * @return bool
*/
-
public function canProfilesDedupe($profileIds, $rgId = 0) {
// find the unsupervised rule
array(
'title' => ts('CiviEvent Dashboard'),
'url' => CRM_Utils_System::url('civicrm/event', 'reset=1'),
- )
+ ),
);
CRM_Utils_System::appendBreadCrumb($breadCrumbs);
if ($this->_single && $this->_context == 'standalone') {
$this->addEntityRef('contact_id', ts('Contact'), array(
'create' => TRUE,
- 'api' => array('extra' => array('email'))
+ 'api' => array('extra' => array('email')),
), TRUE);
}
CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name')
);
$checkCancelledJs = array(
- 'onchange' =>
- "checkCancelled( this.value, {$cancelledparticipantStatusId},{$cancelledContributionStatusId});",
+ 'onchange' => "checkCancelled( this.value, {$cancelledparticipantStatusId},{$cancelledContributionStatusId});",
);
$participantStatusId = array_search('Pending from pay later',
$this->addSelect('status_id', $checkCancelledJs + array(
'options' => $statusOptions,
- 'option_url' => 'civicrm/admin/participant_status'
+ 'option_url' => 'civicrm/admin/participant_status',
), TRUE);
$this->addElement('checkbox', 'is_notify', ts('Send Notification'), NULL);
$contactId = $self->_contactId;
$eventId = CRM_Utils_Array::value('event_id', $values);
if (!empty($contactId) && !empty($eventId)) {
- $dupeCheck = new CRM_Event_BAO_Participant;
+ $dupeCheck = new CRM_Event_BAO_Participant();
$dupeCheck->contact_id = $contactId;
$dupeCheck->event_id = $eventId;
$dupeCheck->find(TRUE);
$duplicateContacts = 0;
while (list($k, $dupeCheckContactId) = each($this->_contactIds)) {
// Eliminate contacts that have already been assigned to this event.
- $dupeCheck = new CRM_Event_BAO_Participant;
+ $dupeCheck = new CRM_Event_BAO_Participant();
$dupeCheck->contact_id = $dupeCheckContactId;
$dupeCheck->event_id = $event_id;
$dupeCheck->find(TRUE);
CRM_Core_Error::fatal(ts('Selected Event is not Paid Event '));
}
- $eventTitle =
- CRM_Core_DAO::getFieldValue(
+ $eventTitle
+ = CRM_Core_DAO::getFieldValue(
'CRM_Event_DAO_Event',
$params['event_id'],
'title'
if (empty($params['source'])) {
$this->_params['participant_source'] = ts('Offline Registration for Event: %2 by: %1', array(
1 => $userName,
- 2 => $eventTitle
+ 2 => $eventTitle,
));
}
else {
}
// also add location name to the array
- $params["address_name-{$this->_bltID}"] =
- CRM_Utils_Array::value('billing_first_name', $params) . ' ' .
+ $params["address_name-{$this->_bltID}"]
+ = CRM_Utils_Array::value('billing_first_name', $params) . ' ' .
CRM_Utils_Array::value('billing_middle_name', $params) . ' ' .
CRM_Utils_Array::value('billing_last_name', $params);
);
//add contribution record
- $this->_params['financial_type_id'] =
- CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $params['event_id'], 'financial_type_id');
+ $this->_params['financial_type_id']
+ = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $params['event_id'], 'financial_type_id');
$this->_params['mode'] = $this->_mode;
//add contribution reocord
if (empty($params['source'])) {
$contributionParams['source'] = ts('%1 : Offline registration (by %2)', array(
1 => $eventTitle,
- 2 => $userName
+ 2 => $userName,
));
}
else {
$statusOptions = CRM_Event_PseudoConstant::participantStatus(NULL, NULL, 'label');
$this->add('select', 'status_id', ts('Participant Status'),
array(
- '' => ts('- select -')
+ '' => ts('- select -'),
) + $statusOptions,
TRUE
);
$this->set('values', $this->_values);
$this->set('fields', $this->_fields);
- $this->_availableRegistrations =
- CRM_Event_BAO_Participant::eventFull(
+ $this->_availableRegistrations
+ = CRM_Event_BAO_Participant::eventFull(
$this->_values['event']['id'], TRUE,
CRM_Utils_Array::value('has_waitlist', $this->_values['event'])
);
*/
public static function addParticipant(&$form, $contactID) {
if (empty($form->_params)) {
- return;
+ return NULL;
}
$params = $form->_params;
$transaction = new CRM_Core_Transaction();
),
'register_date' => ($registerDate) ? $registerDate : date('YmdHis'),
'source' => CRM_Utils_String::ellipsify(
- isset($params['participant_source']) ?
- CRM_Utils_Array::value('participant_source', $params) : CRM_Utils_Array::value('description', $params),
+ isset($params['participant_source']) ? CRM_Utils_Array::value('participant_source', $params) : CRM_Utils_Array::value('description', $params),
$participantFields['participant_source']['maxlength']
),
'fee_level' => CRM_Utils_Array::value('amount_level', $params),
$optionMaxValues[$priceFieldId][$optId] = $currentMaxValue;
}
else {
- $optionMaxValues[$priceFieldId][$optId] =
- $currentMaxValue + CRM_Utils_Array::value($optId, CRM_Utils_Array::value($priceFieldId, $optionMaxValues), 0);
+ $optionMaxValues[$priceFieldId][$optId]
+ = $currentMaxValue + CRM_Utils_Array::value($optId, CRM_Utils_Array::value($priceFieldId, $optionMaxValues), 0);
}
}
if ($optMax && $total > $optMax) {
$errors['soldOutOptions'][] = ts('Option %1 has sold out.', array(1 => $feeBlock[$fieldId]['options'][$optId]['label']));
if ($opDbCount && ($opDbCount >= $optMax)) {
- $errors[$currentParticipantNum]["price_{$fieldId}"] =
- ts('Sorry, this option is currently sold out.');
+ $errors[$currentParticipantNum]["price_{$fieldId}"]
+ = ts('Sorry, this option is currently sold out.');
}
elseif (($optMax - $opDbCount) == 1) {
- $errors[$currentParticipantNum]["price_{$fieldId}"] =
- ts('Sorry, currently only a single seat is available for this option.', array(1 => ($optMax - $opDbCount)));
+ $errors[$currentParticipantNum]["price_{$fieldId}"]
+ = ts('Sorry, currently only a single seat is available for this option.', array(1 => ($optMax - $opDbCount)));
}
else {
- $errors[$currentParticipantNum]["price_{$fieldId}"] =
- ts('Sorry, currently only %1 seats are available for this option.', array(1 => ($optMax - $opDbCount)));
+ $errors[$currentParticipantNum]["price_{$fieldId}"]
+ = ts('Sorry, currently only %1 seats are available for this option.', array(1 => ($optMax - $opDbCount)));
}
}
}
$pre = $post = array();
foreach (array(
'pre',
- 'post'
+ 'post',
) as $keys) {
if (isset($this->_values['additional_custom_' . $keys . '_id'])) {
$this->buildCustom($this->_values['additional_custom_' . $keys . '_id'], 'additionalCustom' . ucfirst($keys), TRUE);
}
foreach (array(
'first_name',
- 'last_name'
+ 'last_name',
) as $name) {
if (array_key_exists($name, $$keys) &&
CRM_Utils_Array::value('is_required', CRM_Utils_Array::value($name, $$keys))
if ($this->_requireApproval) {
$statusMessage = ts("It looks like you are now registering a group of %1 participants. The event has %2 available spaces (you will not be wait listed). Registration for this event requires approval. You will receive an email once your registration has been reviewed.", array(
1 => ++$processedCnt,
- 2 => $spaces
+ 2 => $spaces,
));
}
else {
$statusMessage = ts("It looks like you are now registering a group of %1 participants. The event has %2 available spaces (you will not be wait listed).", array(
1 => ++$processedCnt,
- 2 => $spaces
+ 2 => $spaces,
));
}
}
else {
$statusMessage = ts("It looks like you are now registering a group of %1 participants. The event has %2 available spaces (you will not be wait listed). Please go back to the main registration page and reduce the number of additional people. You will also need to complete payment information.", array(
1 => ++$processedCnt,
- 2 => $spaces
+ 2 => $spaces,
));
$allowToProceed = FALSE;
}
'name' => ts('Skip Participant'),
'subName' => 'skip',
'icon' => 'seek-next',
- )
+ ),
)
);
}
) {
$errors['_qf_default'] = ts('It looks like event has only %2 seats available and you are trying to register %1 participants, so could you please select price options accordingly.', array(
1 => $totalParticipants,
- 2 => $self->_availableRegistrations
+ 2 => $self->_availableRegistrations,
));
}
}
*
* @param bool $isButtonJs
*
- * @return boolean
+ * @return bool
* ture on success.
*/
public function isLastParticipant($isButtonJs = FALSE) {
/**
* Reset values for all options those are full.
*
- **/
+ */
public function resetElementValue($optionFullIds = array()) {
if (!is_array($optionFullIds) ||
empty($optionFullIds) ||
foreach (array(
'constantValues',
'submitValues',
- 'defaultValues'
+ 'defaultValues',
) as $val) {
$values = &$this->{"_$val"};
if (!is_array($values) || empty($values)) {
// add this event's default participant role to defaults array
// (for cases where participant_role field is included in form via profile)
if ($this->_values['event']['default_role_id']) {
- $this->_defaults['participant_role'] =
- $this->_defaults['participant_role_id'] = $this->_values['event']['default_role_id'];
+ $this->_defaults['participant_role']
+ = $this->_defaults['participant_role_id'] = $this->_values['event']['default_role_id'];
}
if ($this->_priceSetId && !empty($this->_feeBlock)) {
foreach ($this->_feeBlock as $key => $val) {
$dbTotalCount = CRM_Utils_Array::value($optId, $recordedOptionsCount, 0);
$currentTotalCount = CRM_Utils_Array::value($optId, $currentOptionsCount, 0);
-
$totalCount = $currentTotalCount + $dbTotalCount;
$isFull = FALSE;
if ($maxValue &&
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2014
* $Id: Email.php 45499 2013-02-08 12:31:05Z kurund $
- *
*/
/**
public $_templates = NULL;
/**
- * Build all the data structures needed to build the form
- *
- * @return void
+ * Build all the data structures needed to build the form.
*/
- function preProcess() {
+ public function preProcess() {
CRM_Contact_Form_Task_EmailCommon::preProcessFromAddress($this);
parent::preProcess();
}
/**
- * Build the form object
- *
- *
- * @return void
+ * Build the form object.
*/
public function buildQuickForm() {
//enable form element
}
/**
- * Process the form after the input has been submitted and validated
- *
- *
- * @return void
+ * Process the form after the input has been submitted and validated.
*/
public function postProcess() {
CRM_Contact_Form_Task_EmailCommon::postProcess($this);
public function buildQuickForm() {
// CRM_Event_Form_Task_Batch::buildQuickForm() gets ufGroupId
// from the form, so set it here to the id of the reserved profile
- $dao = new CRM_Core_DAO_UFGroup;
+ $dao = new CRM_Core_DAO_UFGroup();
$dao->name = 'participant_status';
$dao->find(TRUE);
$this->set('ufGroupId', $dao->id);
asort($statuses, SORT_STRING);
$this->add('select', 'status_change', ts('Change All Statuses'),
array(
- '' => ts('- select status -')
+ '' => ts('- select status -'),
) + $statuses
);
'downloadDuplicateRecordsUrl',
'downloadMismatchRecordsUrl',
'groupAdditions',
- 'unMatchCount'
+ 'unMatchCount',
);
foreach ($properties as $property) {
$this->assign($property, $this->get($property));
self::$_tabLinks = array();
}
if (!isset(self::$_tabLinks[$cacheKey])) {
- self::$_tabLinks[$cacheKey]['settings'] =
- array(
+ self::$_tabLinks[$cacheKey]['settings']
+ = array(
'title' => ts('Info and Settings'),
'url' => 'civicrm/event/manage/settings',
'field' => 'id',
);
- self::$_tabLinks[$cacheKey]['location'] =
- array(
+ self::$_tabLinks[$cacheKey]['location']
+ = array(
'title' => ts('Location'),
'url' => 'civicrm/event/manage/location',
'field' => 'loc_block_id',
);
- self::$_tabLinks[$cacheKey]['fee'] =
- array(
+ self::$_tabLinks[$cacheKey]['fee']
+ = array(
'title' => ts('Fees'),
'url' => 'civicrm/event/manage/fee',
'field' => 'is_monetary',
);
- self::$_tabLinks[$cacheKey]['registration'] =
- array(
+ self::$_tabLinks[$cacheKey]['registration']
+ = array(
'title' => ts('Online Registration'),
'url' => 'civicrm/event/manage/registration',
'field' => 'is_online_registration',
);
+
if (CRM_Core_Permission::check('administer CiviCRM')) {
- self::$_tabLinks[$cacheKey]['reminder'] =
- array(
+ self::$_tabLinks[$cacheKey]['reminder']
+ = array(
'title' => ts('Schedule Reminders'),
'url' => 'civicrm/event/manage/reminder',
'field' => 'reminder',
);
}
- self::$_tabLinks[$cacheKey]['conference'] =
- array(
+ self::$_tabLinks[$cacheKey]['conference']
+ = array(
'title' => ts('Conference Slots'),
'url' => 'civicrm/event/manage/conference',
'field' => 'slot_label_id',
);
- self::$_tabLinks[$cacheKey]['friend'] =
- array(
+ self::$_tabLinks[$cacheKey]['friend']
+ = array(
'title' => ts('Tell a Friend'),
'url' => 'civicrm/event/manage/friend',
'field' => 'friend',
);
- self::$_tabLinks[$cacheKey]['pcp'] =
- array(
+ self::$_tabLinks[$cacheKey]['pcp']
+ = array(
'title' => ts('Personal Campaign Pages'),
'url' => 'civicrm/event/manage/pcp',
'field' => 'is_pcp_enabled',
);
- self::$_tabLinks[$cacheKey]['repeat'] =
- array(
+ self::$_tabLinks[$cacheKey]['repeat']
+ = array(
'title' => ts('Repeat'),
'url' => 'civicrm/event/manage/repeat',
'field' => 'is_repeating_event',
);
-
}
if (!$enableCart) {
array(
'title' => ts('Manage Events'),
'url' => CRM_Utils_System::url(CRM_Utils_System::currentPath(), 'reset=1'),
- )
+ ),
);
CRM_Utils_System::appendBreadCrumb($breadCrumb);
}
// get the list of active event pcps
$eventPCPS = array();
- $pcpDao = new CRM_PCP_DAO_PCPBlock;
+ $pcpDao = new CRM_PCP_DAO_PCPBlock();
$pcpDao->entity_table = 'civicrm_event';
$pcpDao->find();
}
public function search() {
- if (isset($this->_action) &
- (CRM_Core_Action::ADD |
+ if (isset($this->_action) & (CRM_Core_Action::ADD |
CRM_Core_Action::UPDATE |
CRM_Core_Action::DELETE
)
/**
* called when action is browse
- *
- * @return null
*/
public function browse() {
$controller = new CRM_Core_Controller_Simple(
/**
* used for the to show the associated
* contribution for the participant
- *
- * @return null
*/
public function associatedContribution() {
if (CRM_Core_Permission::access('CiviContribute')) {
* URL of a .zip file.
* @param string $localFile
* Path at which to store the .zip file.
- * @return boolean
+ * @return bool
* Whether the download was successful.
*/
public function fetch($remoteFile, $localFile) {
case self::STATUS_INSTALLED_MISSING:
throw new CRM_Extension_Exception("Cannot uninstall extension; disable it first: $key");
- break;
case self::STATUS_DISABLED:
list ($info, $typeManager) = $this->_getInfoTypeHandler($key); // throws Exception
$typeManager->onPreUninstall($info);
/**
* Retrieve the default payment processor
*
- * @param NULL
- *
* @return object
* The default payment processor object on success,
* null otherwise
* @param int $paymentProcessorTypeId
* ID of the processor to be deleted.
*
- * @return bool
+ * @return bool|NULL
*/
public static function del($paymentProcessorTypeId) {
$query = "
if ($dao->fetch()) {
CRM_Core_Session::setStatus(ts('There is a Payment Processor associated with selected Payment Processor type, hence it can not be deleted.'), ts('Deletion Error'), 'error');
- return;
+ return NULL;
}
$paymentProcessorType = new CRM_Financial_DAO_PaymentProcessorType();
$this->add('text', 'accounting_code', ts('Accounting Code'), $attributes['accounting_code']);
$elementAccounting = $this->add('text', 'account_type_code', ts('Account Type Code'), $attributes['account_type_code']);
$this->addEntityRef('contact_id', ts('Owner'), array(
- 'api' => array('params' => array('contact_type' => 'Organization')),
- 'create' => TRUE
- ));
+ 'api' => array('params' => array('contact_type' => 'Organization')),
+ 'create' => TRUE,
+ ));
$this->add('text', 'tax_rate', ts('Tax Rate'), $attributes['tax_rate']);
$this->add('checkbox', 'is_deductible', ts('Tax-Deductible?'));
$elementActive = $this->add('checkbox', 'is_active', ts('Enabled?'));
$selectedArray['selected'] = 'Selected';
}
$elements[] = array(
- 'name' => $name,
- 'value' => $id,
- ) + $selectedArray;
+ 'name' => $name,
+ 'value' => $id,
+ ) + $selectedArray;
}
}
CRM_Utils_JSON::output($elements);
}
public static function getFinancialTransactionsList() {
- $sortMapper =
- array(
- 0 => '',
- 1 => '',
- 2 => 'sort_name',
- 3 => 'amount',
- 4 => 'trxn_id',
- 5 => 'transaction_date',
- 6 => 'payment_method',
- 7 => 'status',
- 8 => 'name',
- );
+ $sortMapper = array(
+ 0 => '',
+ 1 => '',
+ 2 => 'sort_name',
+ 3 => 'amount',
+ 4 => 'trxn_id',
+ 5 => 'transaction_date',
+ 6 => 'payment_method',
+ 7 => 'status',
+ 8 => 'name',
+ );
$sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
$offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0;
$params['sortBy'] = $sort . ' ' . $sortOrder;
}
- $returnvalues =
- array(
- 'civicrm_financial_trxn.payment_instrument_id as payment_method',
- 'civicrm_contribution.contact_id as contact_id',
- 'civicrm_contribution.id as contributionID',
- 'contact_a.sort_name',
- 'civicrm_financial_trxn.total_amount as amount',
- 'civicrm_financial_trxn.trxn_id as trxn_id',
- 'contact_a.contact_type',
- 'contact_a.contact_sub_type',
- 'civicrm_financial_trxn.trxn_date as transaction_date',
- 'name',
- 'civicrm_contribution.currency as currency',
- 'civicrm_financial_trxn.status_id as status',
- 'civicrm_financial_trxn.check_number as check_number',
- );
+ $returnvalues = array(
+ 'civicrm_financial_trxn.payment_instrument_id as payment_method',
+ 'civicrm_contribution.contact_id as contact_id',
+ 'civicrm_contribution.id as contributionID',
+ 'contact_a.sort_name',
+ 'civicrm_financial_trxn.total_amount as amount',
+ 'civicrm_financial_trxn.trxn_id as trxn_id',
+ 'contact_a.contact_type',
+ 'contact_a.contact_sub_type',
+ 'civicrm_financial_trxn.trxn_date as transaction_date',
+ 'name',
+ 'civicrm_contribution.currency as currency',
+ 'civicrm_financial_trxn.status_id as status',
+ 'civicrm_financial_trxn.check_number as check_number',
+ );
- $columnHeader =
- array(
- 'contact_type' => '',
- 'sort_name' => ts('Contact Name'),
- 'amount' => ts('Amount'),
- 'trxn_id' => ts('Trxn ID'),
- 'transaction_date' => ts('Received'),
- 'payment_method' => ts('Payment Method'),
- 'status' => ts('Status'),
- 'name' => ts('Type'),
- );
+ $columnHeader = array(
+ 'contact_type' => '',
+ 'sort_name' => ts('Contact Name'),
+ 'amount' => ts('Amount'),
+ 'trxn_id' => ts('Trxn ID'),
+ 'transaction_date' => ts('Received'),
+ 'payment_method' => ts('Payment Method'),
+ 'status' => ts('Status'),
+ 'name' => ts('Type'),
+ );
if ($sort && $sortOrder) {
$params['sortBy'] = $sort . ' ' . $sortOrder;
}
$iFilteredTotal = $iTotal = $params['total'];
- $selectorElements =
- array(
- 'check',
- 'contact_type',
- 'sort_name',
- 'amount',
- 'trxn_id',
- 'transaction_date',
- 'payment_method',
- 'status',
- 'name',
- 'action',
- );
+ $selectorElements = array(
+ 'check',
+ 'contact_type',
+ 'sort_name',
+ 'amount',
+ 'trxn_id',
+ 'transaction_date',
+ 'payment_method',
+ 'status',
+ 'name',
+ 'action',
+ );
echo CRM_Utils_JSON::encodeDataTableSelector($financialitems, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
CRM_Utils_System::civiExit();
foreach ($cIDs as $key => $value) {
$recordPID = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialTrxn', $value, 'payment_instrument_id');
if ($action == 'Remove' || ($recordPID == $batchPID && $action == 'Assign') || !isset($batchPID)) {
- $params =
- array(
- 'entity_id' => $value,
- 'entity_table' => 'civicrm_financial_trxn',
- 'batch_id' => $entityID,
- );
+ $params = array(
+ 'entity_id' => $value,
+ 'entity_table' => 'civicrm_financial_trxn',
+ 'batch_id' => $entityID,
+ );
if ($action == 'Assign') {
$updated = CRM_Batch_BAO_Batch::addBatchEntity($params);
}
$params = array('id' => $batchID);
$batchInfo = CRM_Batch_BAO_Batch::retrieve($params, $value);
$batchTotals = CRM_Batch_BAO_Batch::batchTotals(array($batchID));
- $batchSummary =
- array(
- 'created_by' => CRM_Contact_BAO_Contact::displayName($batchInfo->created_id),
- 'status' => CRM_Core_OptionGroup::getLabel('batch_status', $batchInfo->status_id),
- 'description' => $batchInfo->description,
- 'payment_instrument' => CRM_Core_OptionGroup::getLabel('payment_instrument', $batchInfo->payment_instrument_id),
- 'item_count' => $batchInfo->item_count,
- 'assigned_item_count' => $batchTotals[$batchID]['item_count'],
- 'total' => CRM_Utils_Money::format($batchInfo->total),
- 'assigned_total' => CRM_Utils_Money::format($batchTotals[$batchID]['total']),
- 'opened_date' => CRM_Utils_Date::customFormat($batchInfo->created_date),
- );
+ $batchSummary = array(
+ 'created_by' => CRM_Contact_BAO_Contact::displayName($batchInfo->created_id),
+ 'status' => CRM_Core_OptionGroup::getLabel('batch_status', $batchInfo->status_id),
+ 'description' => $batchInfo->description,
+ 'payment_instrument' => CRM_Core_OptionGroup::getLabel('payment_instrument', $batchInfo->payment_instrument_id),
+ 'item_count' => $batchInfo->item_count,
+ 'assigned_item_count' => $batchTotals[$batchID]['item_count'],
+ 'total' => CRM_Utils_Money::format($batchInfo->total),
+ 'assigned_total' => CRM_Utils_Money::format($batchTotals[$batchID]['total']),
+ 'opened_date' => CRM_Utils_Date::customFormat($batchInfo->created_date),
+ );
CRM_Utils_JSON::output($batchSummary);
}
*
* @return void
*/
- function preProcess() {
+ public function preProcess() {
self::preProcessCommon($this);
}
*
* @return void
*/
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
//check permission for delete.
'query' => "reset=1&action=add&context=standalone",
'ref' => 'new-grant',
'title' => ts('Grant'),
- )
+ ),
));
}
}
'url' => CRM_Utils_System::url('civicrm/group',
'reset=1'
),
- )
+ ),
);
CRM_Utils_System::appendBreadCrumb($breadCrumb);
$groupValues = array(
'id' => $this->_id,
'title' => $this->_title,
- 'saved_search_id' =>
- isset($this->_groupValues['saved_search_id']) ? $this->_groupValues['saved_search_id'] : '',
+ 'saved_search_id' => isset($this->_groupValues['saved_search_id']) ? $this->_groupValues['saved_search_id'] : '',
);
if (isset($this->_groupValues['saved_search_id'])) {
$groupValues['mapping_id'] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_SavedSearch',
);
}
if (!empty($this->_groupValues['created_id'])) {
- $groupValues['created_by'] =
- CRM_Core_DAO::getFieldValue("CRM_Contact_DAO_Contact", $this->_groupValues['created_id'], 'sort_name', 'id');
+ $groupValues['created_by'] = CRM_Core_DAO::getFieldValue("CRM_Contact_DAO_Contact", $this->_groupValues['created_id'], 'sort_name', 'id');
}
if (!empty($this->_groupValues['modified_id'])) {
- $groupValues['modified_by'] =
- CRM_Core_DAO::getFieldValue("CRM_Contact_DAO_Contact", $this->_groupValues['modified_id'], 'sort_name', 'id');
+ $groupValues['modified_by'] = CRM_Core_DAO::getFieldValue("CRM_Contact_DAO_Contact", $this->_groupValues['modified_id'], 'sort_name', 'id');
}
$this->assign_by_ref('group', $groupValues);
$this->addButtons(array(
array(
'type' => 'upload',
- 'name' =>
- ($this->_action == CRM_Core_Action::ADD) ? ts('Continue') : ts('Save'),
+ 'name' => ($this->_action == CRM_Core_Action::ADD) ? ts('Continue') : ts('Save'),
'isDefault' => TRUE,
),
array(
/**
* Define action links
*
- * @return array
* self::$_links array of action links
*/
public function &links() {
2 => array($this->log_date, 'String'),
);
- $logging = new CRM_Logging_Schema;
+ $logging = new CRM_Logging_Schema();
$addressCustomTables = $logging->entityCustomDataLogTables('Address');
$contactIdClause = $join = '';
break;
}
- $dao = new $daos[$table];
+ $dao = new $daos[$table]();
foreach ($dao->fields() as $field) {
$titles[$table][$field['name']] = CRM_Utils_Array::value('title', $field);
$assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
$targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
- $this->_logTables =
- array(
- 'log_civicrm_contact' => array(
- 'fk' => 'id',
+ $this->_logTables = array(
+ 'log_civicrm_contact' => array(
+ 'fk' => 'id',
+ ),
+ 'log_civicrm_email' => array(
+ 'fk' => 'contact_id',
+ 'log_type' => 'Contact',
+ ),
+ 'log_civicrm_phone' => array(
+ 'fk' => 'contact_id',
+ 'log_type' => 'Contact',
+ ),
+ 'log_civicrm_address' => array(
+ 'fk' => 'contact_id',
+ 'log_type' => 'Contact',
+ ),
+ 'log_civicrm_note' => array(
+ 'fk' => 'entity_id',
+ 'entity_table' => TRUE,
+ 'bracket_info' => array(
+ 'table' => 'log_civicrm_note',
+ 'column' => 'subject',
),
- 'log_civicrm_email' => array(
- 'fk' => 'contact_id',
- 'log_type' => 'Contact',
+ ),
+ 'log_civicrm_note_comment' => array(
+ 'fk' => 'entity_id',
+ 'table_name' => 'log_civicrm_note',
+ 'joins' => array(
+ 'table' => 'log_civicrm_note',
+ 'join' => "entity_log_civireport.entity_id = fk_table.id AND entity_log_civireport.entity_table = 'civicrm_note'",
),
- 'log_civicrm_phone' => array(
- 'fk' => 'contact_id',
- 'log_type' => 'Contact',
+ 'entity_table' => TRUE,
+ 'bracket_info' => array(
+ 'table' => 'log_civicrm_note',
+ 'column' => 'subject',
),
- 'log_civicrm_address' => array(
- 'fk' => 'contact_id',
- 'log_type' => 'Contact',
+ ),
+ 'log_civicrm_group_contact' => array(
+ 'fk' => 'contact_id',
+ 'bracket_info' => array(
+ 'entity_column' => 'group_id',
+ 'table' => 'log_civicrm_group',
+ 'column' => 'title',
),
- 'log_civicrm_note' => array(
- 'fk' => 'entity_id',
- 'entity_table' => TRUE,
- 'bracket_info' => array(
- 'table' => 'log_civicrm_note',
- 'column' => 'subject',
- ),
+ 'action_column' => 'status',
+ 'log_type' => 'Group',
+ ),
+ 'log_civicrm_entity_tag' => array(
+ 'fk' => 'entity_id',
+ 'bracket_info' => array(
+ 'entity_column' => 'tag_id',
+ 'table' => 'log_civicrm_tag',
+ 'column' => 'name',
),
- 'log_civicrm_note_comment' => array(
- 'fk' => 'entity_id',
- 'table_name' => 'log_civicrm_note',
- 'joins' => array(
- 'table' => 'log_civicrm_note',
- 'join' => "entity_log_civireport.entity_id = fk_table.id AND entity_log_civireport.entity_table = 'civicrm_note'",
- ),
- 'entity_table' => TRUE,
- 'bracket_info' => array(
- 'table' => 'log_civicrm_note',
- 'column' => 'subject',
- ),
+ 'entity_table' => TRUE,
+ ),
+ 'log_civicrm_relationship' => array(
+ 'fk' => 'contact_id_a',
+ 'bracket_info' => array(
+ 'entity_column' => 'relationship_type_id',
+ 'table' => 'log_civicrm_relationship_type',
+ 'column' => 'label_a_b',
),
- 'log_civicrm_group_contact' => array(
- 'fk' => 'contact_id',
- 'bracket_info' => array(
- 'entity_column' => 'group_id',
- 'table' => 'log_civicrm_group',
- 'column' => 'title',
- ),
- 'action_column' => 'status',
- 'log_type' => 'Group',
+ ),
+ 'log_civicrm_activity_for_target' => array(
+ 'fk' => 'contact_id',
+ 'table_name' => 'log_civicrm_activity',
+ 'joins' => array(
+ 'table' => 'log_civicrm_activity_contact',
+ 'join' => "(entity_log_civireport.id = fk_table.activity_id AND fk_table.record_type_id = {$targetID})",
),
- 'log_civicrm_entity_tag' => array(
- 'fk' => 'entity_id',
- 'bracket_info' => array(
- 'entity_column' => 'tag_id',
- 'table' => 'log_civicrm_tag',
- 'column' => 'name',
- ),
- 'entity_table' => TRUE,
+ 'bracket_info' => array(
+ 'entity_column' => 'activity_type_id',
+ 'options' => CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE),
),
- 'log_civicrm_relationship' => array(
- 'fk' => 'contact_id_a',
- 'bracket_info' => array(
- 'entity_column' => 'relationship_type_id',
- 'table' => 'log_civicrm_relationship_type',
- 'column' => 'label_a_b',
- ),
+ 'log_type' => 'Activity',
+ ),
+ 'log_civicrm_activity_for_assignee' => array(
+ 'fk' => 'contact_id',
+ 'table_name' => 'log_civicrm_activity',
+ 'joins' => array(
+ 'table' => 'log_civicrm_activity_contact',
+ 'join' => "entity_log_civireport.id = fk_table.activity_id AND fk_table.record_type_id = {$assigneeID}",
),
- 'log_civicrm_activity_for_target' => array(
- 'fk' => 'contact_id',
- 'table_name' => 'log_civicrm_activity',
- 'joins' => array(
- 'table' => 'log_civicrm_activity_contact',
- 'join' => "(entity_log_civireport.id = fk_table.activity_id AND fk_table.record_type_id = {$targetID})",
- ),
- 'bracket_info' => array(
- 'entity_column' => 'activity_type_id',
- 'options' => CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE),
- ),
- 'log_type' => 'Activity',
+ 'bracket_info' => array(
+ 'entity_column' => 'activity_type_id',
+ 'options' => CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE),
),
- 'log_civicrm_activity_for_assignee' => array(
- 'fk' => 'contact_id',
- 'table_name' => 'log_civicrm_activity',
- 'joins' => array(
- 'table' => 'log_civicrm_activity_contact',
- 'join' => "entity_log_civireport.id = fk_table.activity_id AND fk_table.record_type_id = {$assigneeID}",
- ),
- 'bracket_info' => array(
- 'entity_column' => 'activity_type_id',
- 'options' => CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE),
- ),
- 'log_type' => 'Activity',
+ 'log_type' => 'Activity',
+ ),
+ 'log_civicrm_activity_for_source' => array(
+ 'fk' => 'contact_id',
+ 'table_name' => 'log_civicrm_activity',
+ 'joins' => array(
+ 'table' => 'log_civicrm_activity_contact',
+ 'join' => "entity_log_civireport.id = fk_table.activity_id AND fk_table.record_type_id = {$sourceID}",
),
- 'log_civicrm_activity_for_source' => array(
- 'fk' => 'contact_id',
- 'table_name' => 'log_civicrm_activity',
- 'joins' => array(
- 'table' => 'log_civicrm_activity_contact',
- 'join' => "entity_log_civireport.id = fk_table.activity_id AND fk_table.record_type_id = {$sourceID}",
- ),
- 'bracket_info' => array(
- 'entity_column' => 'activity_type_id',
- 'options' => CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE),
- ),
- 'log_type' => 'Activity',
+ 'bracket_info' => array(
+ 'entity_column' => 'activity_type_id',
+ 'options' => CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE),
),
- 'log_civicrm_case' => array(
- 'fk' => 'contact_id',
- 'joins' => array(
- 'table' => 'log_civicrm_case_contact',
- 'join' => 'entity_log_civireport.id = fk_table.case_id',
- ),
- 'bracket_info' => array(
- 'entity_column' => 'case_type_id',
- 'options' => CRM_Case_PseudoConstant::caseType('title', FALSE),
- ),
+ 'log_type' => 'Activity',
+ ),
+ 'log_civicrm_case' => array(
+ 'fk' => 'contact_id',
+ 'joins' => array(
+ 'table' => 'log_civicrm_case_contact',
+ 'join' => 'entity_log_civireport.id = fk_table.case_id',
),
- );
+ 'bracket_info' => array(
+ 'entity_column' => 'case_type_id',
+ 'options' => CRM_Case_PseudoConstant::caseType('title', FALSE),
+ ),
+ ),
+ );
- $logging = new CRM_Logging_Schema;
+ $logging = new CRM_Logging_Schema();
// build _logTables for contact custom tables
$customTables = $logging->entityCustomDataLogTables('Contact');
// build _logTables for address custom tables
$customTables = $logging->entityCustomDataLogTables('Address');
foreach ($customTables as $table) {
- $this->_logTables[$table] =
- array(
- 'fk' => 'contact_id',// for join of fk_table with contact table
- 'joins' => array(
- 'table' => 'log_civicrm_address', // fk_table
- 'join' => 'entity_log_civireport.entity_id = fk_table.id',
- ),
- 'log_type' => 'Contact',
- );
+ $this->_logTables[$table] = array(
+ 'fk' => 'contact_id', // for join of fk_table with contact table
+ 'joins' => array(
+ 'table' => 'log_civicrm_address', // fk_table
+ 'join' => 'entity_log_civireport.entity_id = fk_table.id',
+ ),
+ 'log_type' => 'Contact',
+ );
}
// allow log tables to be extended via report hooks
$entityID = $id;
}
-
if ($entityID && $logDate &&
array_key_exists('table', $this->_logTables[$entity]['bracket_info'])
) {
* Drop triggers for all logged tables.
*/
public function dropTriggers($tableName = NULL) {
- $dao = new CRM_Core_DAO;
+ $dao = new CRM_Core_DAO();
if ($tableName) {
$tableNames = array($tableName);
// add report instances
$domain_id = CRM_Core_Config::domainID();
foreach ($this->reports as $report) {
- $dao = new CRM_Report_DAO_ReportInstance;
+ $dao = new CRM_Report_DAO_ReportInstance();
$dao->domain_id = $domain_id;
$dao->report_id = $report;
$dao->title = $titles[$report];
$dao->permission = 'administer CiviCRM';
- if ($report == 'logging/contact/summary')
+ if ($report == 'logging/contact/summary') {
$dao->is_reserved = 1;
+ }
$dao->insert();
}
}
if (!array_key_exists($dao->TABLE_NAME, $columnSpecs)) {
$columnSpecs[$dao->TABLE_NAME] = array();
}
- $columnSpecs[$dao->TABLE_NAME][$dao->COLUMN_NAME] =
- array(
- 'COLUMN_NAME' => $dao->COLUMN_NAME,
- 'DATA_TYPE' => $dao->DATA_TYPE,
- 'IS_NULLABLE' => $dao->IS_NULLABLE,
- 'COLUMN_DEFAULT' => $dao->COLUMN_DEFAULT,
- );
+ $columnSpecs[$dao->TABLE_NAME][$dao->COLUMN_NAME] = array(
+ 'COLUMN_NAME' => $dao->COLUMN_NAME,
+ 'DATA_TYPE' => $dao->DATA_TYPE,
+ 'IS_NULLABLE' => $dao->IS_NULLABLE,
+ 'COLUMN_DEFAULT' => $dao->COLUMN_DEFAULT,
+ );
}
}
return $columnSpecs[$table];
// delete report instances
$domain_id = CRM_Core_Config::domainID();
foreach ($this->reports as $report) {
- $dao = new CRM_Report_DAO_ReportInstance;
+ $dao = new CRM_Report_DAO_ReportInstance();
$dao->domain_id = $domain_id;
$dao->report_id = $report;
$dao->delete();
*
* @return CRM_Mailing_Event_BAO_Queue|string
*/
- static function &getRecipients(
+ public static function &getRecipients(
$job_id,
$mailing_id = NULL,
$offset = NULL,
}
/**
- *
- * Returns the regex patterns that are used for preparing the text and html templates
- *
- *
- **/
+ * Returns the regex patterns that are used for preparing the text and html templates.
+ */
private function &getPatterns($onlyHrefs = FALSE) {
$patterns = array();
$patterns[] = '\\\\\{\w+\.\w+\\\\\}|\{\{\w+\.\w+\}\}';
$patterns[] = '\{\w+\.\w+\}';
- $patterns = '{' . join('|', $patterns) . '}im';
+ $patterns = '{' . implode('|', $patterns) . '}im';
return $patterns;
}
/**
- * returns an array that denotes the type of token that we are dealing with
- * we use the type later on when we are doing a token replcement lookup
+ * Returns an array that denotes the type of token that we are dealing with
+ * we use the type later on when we are doing a token replacement lookup
*
- * @param string $token The token for which we will be doing adata lookup
+ * @param string $token
+ * The token for which we will be doing adata lookup.
*
* @return array
* An array that holds the token itself and the type.
* Prepares the text and html templates
* for generating the emails and returns a copy of the
* prepared templates
- *
- *
- **/
+ */
private function getPreparedTemplates() {
if (!$this->preparedTemplates) {
$patterns['html'] = $this->getPatterns(TRUE);
foreach (array(
'html',
'text',
- 'subject'
+ 'subject',
) as $key) {
if (!isset($templates[$key])) {
continue;
}
/**
- *
- * Retrieve a ref to an array that holds the email and text templates for this email
- * assembles the complete template including the header and footer
- * that the user has uploaded or declared (if they have dome that)
- *
+ * Retrieve a ref to an array that holds the email and text templates for this email
+ * assembles the complete template including the header and footer
+ * that the user has uploaded or declared (if they have dome that)
*
* @return array
* reference to an assoc array
- *
- **/
+ */
private function &getTemplates() {
if (!$this->templates) {
$this->getHeaderFooter();
$template[] = $this->footer->body_text;
}
- $this->templates['text'] = join("\n", $template);
+ $this->templates['text'] = implode("\n", $template);
}
if ($this->body_html) {
$template[] = $this->footer->body_html;
}
- $this->templates['html'] = join("\n", $template);
+ $this->templates['html'] = implode("\n", $template);
// this is where we create a text template from the html template if the text template did not exist
// this way we ensure that every recipient will receive an email even if the pref is set to text and the
if ($this->subject) {
$template = array();
$template[] = $this->subject;
- $this->templates['subject'] = join("\n", $template);
+ $this->templates['subject'] = implode("\n", $template);
}
}
return $this->templates;
*
* @return array
* reference to an assoc array
- *
- **/
+ */
public function &getTokens() {
if (!$this->tokens) {
*
* @return array
* reference to an assoc array
- *
- **/
+ */
public function &getFlattenedTokens() {
if (!$this->flattenedTokens) {
$tokens = $this->getTokens();
'return' => 'id',
'options' => array(
'limit' => 100000000000,
- )
+ ),
)
);
}
/**
- * Retrieve the header and footer for this mailing
- *
- * @param void
- *
- * @return void
+ * Load this->header and this->footer.
*/
private function getHeaderFooter() {
if (!$this->header and $this->header_id) {
($contact['preferred_mail_format'] == 'HTML' && !array_key_exists('html', $pEmails))
)
) {
- $textBody = join('', $text);
+ $textBody = implode('', $text);
if ($useSmarty) {
$textBody = $smarty->fetch("string:$textBody");
}
$contact['preferred_mail_format'] == 'Both'
))
) {
- $htmlBody = join('', $html);
+ $htmlBody = implode('', $html);
if ($useSmarty) {
$htmlBody = $smarty->fetch("string:$htmlBody");
}
$mailingSubject = CRM_Utils_Array::value('subject', $pEmails);
if (is_array($mailingSubject)) {
- $mailingSubject = join('', $mailingSubject);
+ $mailingSubject = implode('', $mailingSubject);
}
$mailParams['Subject'] = $mailingSubject;
'html',
'attachments',
'toName',
- 'toEmail'
+ 'toEmail',
))
) {
$headers[$paramKey] = $paramValue;
'bounce' => CRM_Mailing_Event_BAO_Bounce::getTableName(),
'forward' => CRM_Mailing_Event_BAO_Forward::getTableName(),
'url' => CRM_Mailing_BAO_TrackableURL::getTableName(),
- 'urlopen' =>
- CRM_Mailing_Event_BAO_TrackableURLOpen::getTableName(),
+ 'urlopen' => CRM_Mailing_Event_BAO_TrackableURLOpen::getTableName(),
'component' => CRM_Mailing_BAO_Component::getTableName(),
'spool' => CRM_Mailing_BAO_Spool::getTableName(),
);
$report['component'][] = array(
'type' => $components[$mailing->type],
'name' => $mailing->name,
- 'link' =>
- CRM_Utils_System::url('civicrm/mailing/component',
- "reset=1&action=update&id={$mailing->id}"
- ),
+ 'link' => CRM_Utils_System::url('civicrm/mailing/component',
+ "reset=1&action=update&id={$mailing->id}"
+ ),
);
}
foreach (array(
'scheduled_date',
'start_date',
- 'end_date'
+ 'end_date',
) as $key) {
$row[$key] = CRM_Utils_Date::customFormat($row[$key]);
}
while ($mailing->fetch()) {
$report['click_through'][] = array(
'url' => $mailing->url,
- 'link' =>
- CRM_Utils_System::url(
- 'civicrm/mailing/report/event',
- "reset=1&event=click&mid=$mailing_id&uid={$mailing->id}"
- ),
- 'link_unique' =>
- CRM_Utils_System::url(
- 'civicrm/mailing/report/event',
- "reset=1&event=click&mid=$mailing_id&uid={$mailing->id}&distinct=1"
- ),
+ 'link' => CRM_Utils_System::url(
+ 'civicrm/mailing/report/event',
+ "reset=1&event=click&mid=$mailing_id&uid={$mailing->id}"
+ ),
+ 'link_unique' => CRM_Utils_System::url(
+ 'civicrm/mailing/report/event',
+ "reset=1&event=click&mid=$mailing_id&uid={$mailing->id}&distinct=1"
+ ),
'clicks' => $mailing->clicks,
'unique' => $mailing->unique_clicks,
'rate' => CRM_Utils_Array::value('delivered', $report['event_totals']) ? (100.0 * $mailing->unique_clicks) / $report['event_totals']['delivered'] : 0,
$actionLinks = array(CRM_Core_Action::VIEW => array('name' => ts('Report')));
if (CRM_Core_Permission::check('view all contacts')) {
- $actionLinks[CRM_Core_Action::ADVANCED] =
- array(
- 'name' => ts('Advanced Search'),
- 'url' => 'civicrm/contact/search/advanced',
- );
+ $actionLinks[CRM_Core_Action::ADVANCED] = array(
+ 'name' => ts('Advanced Search'),
+ 'url' => 'civicrm/contact/search/advanced',
+ );
}
$action = array_sum(array_keys($actionLinks));
if (!in_array($id, $mailingIDs)) {
CRM_Core_Error::fatal(ts('You do not have permission to access this mailing report'));
}
- return;
}
/**
* where the user has access to ALL groups, and hence ALL mailings and return a
* value of TRUE (to avoid the downstream where clause with a list of mailing list IDs
*
- * @return boolean
- * | array - TRUE if the user has access to all mailings, else array of mailing IDs (possibly empty)
+ * @return bool|array
+ * TRUE if the user has access to all mailings, else array of mailing IDs (possibly empty).
*/
public static function mailingACLIDs() {
// CRM-11633
$form->assign('templates', TRUE);
$form->add('select', 'template', ts('Select Template'),
array(
- '' => ts('- select -')
+ '' => ts('- select -'),
) + $form->_templates, FALSE,
array('onChange' => "selectValue( this.value,'' );")
);
if ($mode == NULL && CRM_Core_BAO_MailSettings::defaultDomain() == "EXAMPLE.ORG") {
throw new CRM_Core_Exception(ts('The <a href="%1">default mailbox</a> has not been configured. You will find <a href="%2">more info in the online user and administrator guide</a>', array(
1 => CRM_Utils_System::url('civicrm/admin/mailSettings', 'reset=1'),
- 2 => "http://book.civicrm.org/user/advanced-configuration/email-system-configuration/"
+ 2 => "http://book.civicrm.org/user/advanced-configuration/email-system-configuration/",
)));
}
*
* @return Object
*/
- static function mailingQuery(
+ public static function mailingQuery(
$mailingID,
$offset = NULL, $limit = NULL
) {
* @param string $hash
* The hash.
*
- * @return boolean
+ * @return bool
* True on success
*/
public static function confirm($contact_id, $subscribe_id, $hash) {
* Consider mailings that were completed not more than $maxDays ago.
*
* @return void
- **/
+ */
public static function updateEmailResetDate($minDays = 3, $maxDays = 7) {
$dao = new CRM_Core_Dao();
/**
* Create a security hash from the job, email and contact ids
*
- * @param array The ids to be hashed
- *
* @return int
* The hash
*/
* @param string $hash
* The hash.
*
- * @return boolean
+ * @return bool
* Was the contact successfully unsubscribed?
*/
public static function unsub_from_domain($job_id, $queue_id, $hash) {
'sms',
'status_unscheduled',
'is_archived',
- 'hidden_find_mailings'
+ 'hidden_find_mailings',
);
foreach ($fields as $field) {
if (isset($params[$field]) &&
) {
if (in_array($field, array(
'mailing_from',
- 'mailing_to'
+ 'mailing_to',
)) && !$params["mailing_relative"]
) {
$time = ($field == 'mailing_to') ? '235959' : NULL;
}
public function postProcess() {
-
$values = $this->exportValues();
// check if EmailTyped matches Email address
$result = CRM_Utils_String::compareStr($this->_email, $values['email_confirm'], TRUE);
-
-
$job_id = $this->_job_id;
$queue_id = $this->_queue_id;
$hash = $this->_hash;
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2014
* $Id$
- *
*/
/**
* This class handle mailing and contact related functions
- *
*/
class CRM_Mailing_Page_Tab extends CRM_Contact_Page_View {
/**
public $_contactId = NULL;
/**
- * called when action is browse
- *
- * @return null
+ * Called when action is browse.
*/
public function browse() {
}
/**
- * Build all the data structures needed to build the form
- *
- * @return void
+ * Build all the data structures needed to build the form.
*/
public function preProcess() {
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
$this->assign('contactId', $this->_contactId);
$this->assign('displayName', $displayName);
- // check logged in url permission
+ // Check logged in url permission.
CRM_Contact_Page_View::checkUserPermission($this);
- // set page title
CRM_Utils_System::setTitle(ts('Mailings sent to %1', array(1 => $displayName)));
}
/**
- * the main function that is called when the page loads,
- * it decides the which action has to be taken for the page.
+ * The main function that is called when the page loads.
*
- * @return null
+ * It decides the which action has to be taken for the page.
*/
public function run() {
$this->preProcess();
$this->browse();
-
- return parent::run();
+ parent::run();
}
}
switch ($this->_event_type) {
case 'queue':
$event = new CRM_Mailing_Event_BAO_Queue();
- return $event->getTotalCount($this->_mailing_id,
+ $result = $event->getTotalCount($this->_mailing_id,
$this->_job_id
);
+ return $result;
case 'delivered':
$event = new CRM_Mailing_Event_BAO_Delivered();
- return $event->getTotalCount($this->_mailing_id,
+ $result = $event->getTotalCount($this->_mailing_id,
$this->_job_id,
$this->_is_distinct
);
+ return $result;
case 'opened':
$event = new CRM_Mailing_Event_BAO_Opened();
- return $event->getTotalCount($this->_mailing_id,
+ $result = $event->getTotalCount($this->_mailing_id,
$this->_job_id,
$this->_is_distinct
);
+ return $result;
case 'bounce':
$event = new CRM_Mailing_Event_BAO_Bounce();
- return $event->getTotalCount($this->_mailing_id,
+ $result = $event->getTotalCount($this->_mailing_id,
$this->_job_id,
$this->_is_distinct
);
+ return $result;
case 'forward':
$event = new CRM_Mailing_Event_BAO_Forward();
- return $event->getTotalCount($this->_mailing_id,
+ $result = $event->getTotalCount($this->_mailing_id,
$this->_job_id,
$this->_is_distinct
);
+ return $result;
case 'reply':
$event = new CRM_Mailing_Event_BAO_Reply();
- return $event->getTotalCount($this->_mailing_id,
+ $result = $event->getTotalCount($this->_mailing_id,
$this->_job_id,
$this->_is_distinct
);
+ return $result;
case 'unsubscribe':
$event = new CRM_Mailing_Event_BAO_Unsubscribe();
- return $event->getTotalCount($this->_mailing_id,
+ $result = $event->getTotalCount($this->_mailing_id,
$this->_job_id,
$this->_is_distinct
);
+ return $result;
case 'optout':
$event = new CRM_Mailing_Event_BAO_Unsubscribe();
- return $event->getTotalCount($this->_mailing_id,
+ $result = $event->getTotalCount($this->_mailing_id,
$this->_job_id,
$this->_is_distinct,
FALSE
);
+ return $result;
case 'click':
$event = new CRM_Mailing_Event_BAO_TrackableURLOpen();
- return $event->getTotalCount($this->_mailing_id,
+ $result = $event->getTotalCount($this->_mailing_id,
$this->_job_id,
$this->_is_distinct,
$this->_url_id
);
+ return $result;
default:
return 0;
public function &getRows($action, $offset, $rowCount, $sort, $output = NULL) {
switch ($this->_event_type) {
case 'queue':
- return CRM_Mailing_Event_BAO_Queue::getRows($this->_mailing_id,
+ $rows = CRM_Mailing_Event_BAO_Queue::getRows($this->_mailing_id,
$this->_job_id, $offset, $rowCount, $sort
);
- break;
+ return $rows;
case 'delivered':
- return CRM_Mailing_Event_BAO_Delivered::getRows($this->_mailing_id,
+ $rows = CRM_Mailing_Event_BAO_Delivered::getRows($this->_mailing_id,
$this->_job_id, $this->_is_distinct,
$offset, $rowCount, $sort
);
+ return $rows;
case 'opened':
- return CRM_Mailing_Event_BAO_Opened::getRows($this->_mailing_id,
+ $rows = CRM_Mailing_Event_BAO_Opened::getRows($this->_mailing_id,
$this->_job_id, $this->_is_distinct,
$offset, $rowCount, $sort
);
+ return $rows;
case 'bounce':
- return CRM_Mailing_Event_BAO_Bounce::getRows($this->_mailing_id,
+ $rows = CRM_Mailing_Event_BAO_Bounce::getRows($this->_mailing_id,
$this->_job_id, $this->_is_distinct,
$offset, $rowCount, $sort
);
+ return $rows;
case 'forward':
- return CRM_Mailing_Event_BAO_Forward::getRows($this->_mailing_id,
+ $rows = CRM_Mailing_Event_BAO_Forward::getRows($this->_mailing_id,
$this->_job_id, $this->_is_distinct,
$offset, $rowCount, $sort
);
+ return $rows;
case 'reply':
- return CRM_Mailing_Event_BAO_Reply::getRows($this->_mailing_id,
+ $rows = CRM_Mailing_Event_BAO_Reply::getRows($this->_mailing_id,
$this->_job_id, $this->_is_distinct,
$offset, $rowCount, $sort
);
+ return $rows;
case 'unsubscribe':
- return CRM_Mailing_Event_BAO_Unsubscribe::getRows($this->_mailing_id,
+ $rows = CRM_Mailing_Event_BAO_Unsubscribe::getRows($this->_mailing_id,
$this->_job_id, $this->_is_distinct,
$offset, $rowCount, $sort, TRUE
);
+ return $rows;
case 'optout':
- return CRM_Mailing_Event_BAO_Unsubscribe::getRows($this->_mailing_id,
+ $rows = CRM_Mailing_Event_BAO_Unsubscribe::getRows($this->_mailing_id,
$this->_job_id, $this->_is_distinct,
$offset, $rowCount, $sort, FALSE
);
+ return $rows;
case 'click':
- return CRM_Mailing_Event_BAO_TrackableURLOpen::getRows(
+ $rows = CRM_Mailing_Event_BAO_TrackableURLOpen::getRows(
$this->_mailing_id, $this->_job_id,
$this->_is_distinct, $this->_url_id,
$offset, $rowCount, $sort
);
+ return $rows;
default:
return NULL;
* @param string $output
* Type of output.
*
- * @return string
+ * @return string|NULL
* name of the file
*/
public function getExportFileName($output = 'csv') {
+ return NULL;
}
public function eventToTitle() {
'delivered' => ts('Successful Deliveries'),
'bounce' => ts('Bounces'),
'forward' => ts('Forwards'),
- 'reply' => $this->_is_distinct
- ? ts('Unique Replies')
- : ts('Replies'),
+ 'reply' => $this->_is_distinct ? ts('Unique Replies') : ts('Replies'),
'unsubscribe' => ts('Unsubscribe Requests'),
'optout' => ts('Opt-out Requests'),
- 'click' => $this->_is_distinct
- ? ts('Unique Click-throughs')
- : ts('Click-throughs'),
- 'opened' => $this->_is_distinct
- ? ts('Unique Tracked Opens')
- : ts('Tracked Opens'),
+ 'click' => $this->_is_distinct ? ts('Unique Click-throughs') : ts('Click-throughs'),
+ 'opened' => $this->_is_distinct ? ts('Unique Tracked Opens') : ts('Tracked Opens'),
);
}
return $events[$this->_event_type];
*
* @param int $action
*
- * @return Array
+ * @return array
* array of contact_id of all related contacts.
*/
public static function checkMembershipRelationship($membershipId, $contactId, $action = CRM_Core_Action::ADD) {
* Membership id that needs to be deleted.
*
*
- * @return $results no of deleted Membership on success, false otherwise
+ * @return int $results id of deleted Membership on success, false otherwise
*/
public static function del($membershipId) {
//delete related first and then delete parent.
* Membership id that needs to be deleted.
*
*
- * @return $results no of deleted Membership on success, false otherwise
+ * @return int $results id of deleted Membership on success, false otherwise
*/
public static function deleteMembership($membershipId) {
// CRM-12147, retrieve membership data before we delete it for hooks
*/
public static function deleteRelatedMemberships($ownerMembershipId, $contactId = NULL) {
if (!$ownerMembershipId && !$contactId) {
- return;
+ return FALSE;
}
$membership = new CRM_Member_DAO_Membership();
* Is this a separate membership payment
*
*/
- static function buildMembershipBlock(
+ public static function buildMembershipBlock(
&$form,
$pageID,
$cid,
* @throws CRM_Core_Exception
*
*/
- static function renewMembershipFormWrapper(
+ public static function renewMembershipFormWrapper(
$contactID,
$membershipTypeID,
$is_test,
if ($reset) {
// not sure why a static var is in use here - we need a way to reset it from the test suite
$relatedContactIds = array();
- return;
+ return FALSE;
}
$membership = new CRM_Member_DAO_Membership();
CRM_Member_BAO_Membership::create($params, $relMemIds);
$available--;
}
- else { // we have run out of inherited memberships, so delete extras
+ else {
+ // we have run out of inherited memberships, so delete extras
self::deleteMembership($params['id']);
}
// we need to first check if there will remain inherited memberships, so queue it up
*
* @param int $membershipId
*
- * @return boolean
- * true if deleted false otherwise
+ * @return object
+ * $membershipPayment deleted membership payment object
*/
public static function deleteMembershipPayment($membershipId) {
- $membesrshipPayment = new CRM_Member_DAO_MembershipPayment();
- $membesrshipPayment->membership_id = $membershipId;
- $membesrshipPayment->find();
+ $membershipPayment = new CRM_Member_DAO_MembershipPayment();
+ $membershipPayment->membership_id = $membershipId;
+ $membershipPayment->find();
- while ($membesrshipPayment->fetch()) {
- CRM_Contribute_BAO_Contribution::deleteContribution($membesrshipPayment->contribution_id);
- CRM_Utils_Hook::pre('delete', 'MembershipPayment', $membesrshipPayment->id, $membesrshipPayment);
+ while ($membershipPayment->fetch()) {
+ CRM_Contribute_BAO_Contribution::deleteContribution($membershipPayment->contribution_id);
+ CRM_Utils_Hook::pre('delete', 'MembershipPayment', $membershipPayment->id, $membershipPayment);
$membesrshipPayment->delete();
- CRM_Utils_Hook::post('delete', 'MembershipPayment', $membesrshipPayment->id, $membesrshipPayment);
+ CRM_Utils_Hook::post('delete', 'MembershipPayment', $membershipPayment->id, $membershipPayment);
}
- return $membesrshipPayment;
+ return $membershipPayment;
}
/**
*
* @param bool $isNotCancelled
*
- * @return boolean
+ * @return bool
*/
public static function isCancelSubscriptionSupported($mid, $isNotCancelled = TRUE) {
$cacheKeyString = "$mid";
*
* @return mixed
*/
-
public static function del($membershipID) {
$membershipLog = new CRM_Member_DAO_MembershipLog();
$membershipLog->membership_id = $membershipID;
$message .= '<br/>' . ts('%3. There are some contacts who have this membership type assigned to them. Search for contacts with this membership type from <a href=\'%1\'>Find Members</a>. If you are still getting this message after deleting these memberships, there may be contacts in the Trash (deleted) with this membership type. Try using <a href="%2">Advanced Search</a> and checking "Search in Trash".', array(
1 => $findMembersURL,
2 => $deleteURL,
- 3 => $cnt
+ 3 => $cnt,
));
$cnt++;
}
$deleteURL = CRM_Utils_System::url('civicrm/admin/contribute', 'reset=1');
$message .= ts('%2. This Membership Type is used in an <a href=\'%1\'>Online Contribution page</a>. Uncheck this membership type in the Memberships tab.', array(
1 => $deleteURL,
- 2 => $cnt
+ 2 => $cnt,
));
throw new CRM_Core_Exception($message);
}
foreach (array(
'joinDate',
'startDate',
- 'endDate'
+ 'endDate',
) as $dateParam) {
if (!empty($$dateParam)) {
$$dateParam = CRM_Utils_Date::processDate($$dateParam, NULL, FALSE, 'Y-m-d');
*
* CRM-7297 Membership Upsell - Added $membershipTypeID param to facilitate calculations of dates when membership type changes
*
- * @return Array
+ * @return array
* array fo the start date, end date and join date of the membership
*/
public static function getRenewalDatesForMembershipType($membershipId, $changeToday = NULL, $membershipTypeID = NULL, $numRenewTerms = 1) {
* @param int $orgID
* Id of Organization.
*
- * @return Array
+ * @return array
* array of the details of membership types
*/
public static function getMembershipTypesByOrg($orgID) {
/**
* Retrieve all Membership Types with Member of Contact id
*
- * @param array membership types
- *
- * @return Array
+ * @param array $membershipTypes
+ * array of membership type ids
+ * @return array
* array of the details of membership types with Member of Contact id
*/
public static function getMemberOfContactByMemTypes($membershipTypes) {
}
}
- /** This function updates all price field value for quick config
+ /** * This function updates all price field value for quick config
* price set which has membership type
*
- * @param integer membership type id
+ * @param int $membershipTypeId membership type id
*
- * @param integer financial type id
+ * @param array $params
*/
public static function updateAllPriceFieldValue($membershipTypeId, $params) {
if (!empty($params['minimum_fee'])) {
*
* @return array|null
*/
- static function defaultReturnProperties(
+ public static function defaultReturnProperties(
$mode,
$includeCustomFields = TRUE
) {
CRM_Core_DAO::commonRetrieveAll('CRM_Price_DAO_PriceField', 'price_set_id', $priceSetId, $pFIDs, $return = array(
'html_type',
'name',
- 'label'
+ 'label',
));
foreach ($pFIDs as $pid => $pValue) {
if ($pValue['html_type'] == 'Radio' && $pValue['name'] == 'membership_amount') {
if (count($this->_memberIds) > $this->_maxMembers) {
CRM_Core_Session::setStatus(ts("The maximum number of members you can select for Batch Update is %1. You have selected %2. Please select fewer members from your search results and try again.", array(
1 => $this->_maxMembers,
- 2 => count($this->_memberIds)
+ 2 => count($this->_memberIds),
)), ts('Batch Update Error'), 'error');
$validate = TRUE;
}
$ufGroupElement = $this->add('select', 'uf_group_id', ts('Select Profile'),
array(
- '' => ts('- select profile -')
+ '' => ts('- select profile -'),
) + $profiles, TRUE
);
$this->addDefaultButtons(ts('Continue'));
* @param array $values
* The array of values belonging to this line.
*
- * @return boolean
+ * @return bool
*/
public function mapField(&$values) {
return CRM_Import_Parser::VALID;
* @param array $values
* The array of values belonging to this line.
*
- * @return boolean
+ * @return bool
* the result of this processing
*/
public function preview(&$values) {
* @param array $values
* The array of values belonging to this line.
*
- * @return boolean
+ * @return bool
* the result of this processing
*/
public function summary(&$values) {
* @param array $values
* The array of values belonging to this line.
*
- * @return boolean
+ * @return bool
* the result of this processing
*/
public function import($onDuplicate, &$values) {
*
* @param $formatted
*
- * @return Array
+ * @return;
* formatted containing date values
*/
public function formattedDates($calcDates, &$formatted) {
/**
* called when action is browse
- *
- * @return null
*/
public function browse() {
$links = self::links('all', $this->_isPaymentProcessor, $this->_accessContribution);
if (CRM_Utils_Array::value('is_current_member', $statusANDType[$dao->id]) // membership is active
&& CRM_Utils_Array::value('relationship_type_id', $statusANDType[$dao->id]) // membership type allows inheritance
&& empty($dao->owner_membership_id)
- ) { // not an related membership
+ ) {
+ // not an related membership
$query = "
SELECT COUNT(m.id)
FROM civicrm_membership m
$max_related = CRM_Utils_Array::value('max_related', $membership[$dao->id]);
$membership[$dao->id]['related_count'] = ($max_related == '' ? ts('%1 created', array(1 => $num_related)) : ts('%1 out of %2', array(
1 => $num_related,
- 2 => $max_related
+ 2 => $max_related,
))
);
}
* @return array
* (reference) of action links
*/
- static function &links(
+ public static function &links(
$status = 'all',
$isPaymentProcessor = NULL,
$accessContribution = NULL,
*
* @param int $contactId
* @param int $membershipId
- *
- * @return null
*/
public static function associatedContribution($contactId = NULL, $membershipId = NULL) {
$controller = new CRM_Core_Controller_Simple(
/**
* Class constructor
*/
- function __construct($controller, $action = CRM_Core_Action::NONE) {
+ public function __construct($controller, $action = CRM_Core_Action::NONE) {
parent::__construct($controller, $action);
$this->_pages = array();
* @param int $id
* Campaign page id.
*
- * @return null
+ * @return;
*/
public static function deleteById($id) {
CRM_Utils_Hook::pre('delete', 'Campaign', $id, CRM_Core_DAO::$_nullArray);
*
* @param $is_active
*
- * @return null
+ * @return;
*/
public static function setIsActive($id, $is_active) {
switch ($is_active) {
* @param int $id
* Pcp block id.
*
- * @return Boolean
+ * @return Bool
*/
public static function getPcpBlockInUse($id) {
$query = "
* @param int $profileId
* Supporter's profile id.
*
- * @return boolean
+ * @return bool
*/
public static function checkEmailProfile($profileId) {
$query = "
* @param int $pcpId
* @param $component
*
- * @return String
+ * @return string
*/
public static function getPcpBlockEntityId($pcpId, $component) {
$entity_table = self::getPcpEntityTable($component);
*
* @param $component
*
- * @return String
+ * @return string
*/
public static function getPcpEntityTable($component) {
$entity_table_map = array(
$this->add('select', 'target_entity_id',
ts('Online Contribution Page'),
array(
- '' => ts('- select -')
+ '' => ts('- select -'),
) +
CRM_Contribute_PseudoConstant::contributionPage()
);
if (!empty($pcpBlock->id) && CRM_PCP_BAO_PCP::getPcpBlockInUse($pcpBlock->id)) {
foreach (array(
'target_entity_type',
- 'target_entity_id'
+ 'target_entity_id',
) as $element_name) {
$element = $this->getElement($element_name);
$element->freeze();
/**
* Set variables up before form is built
- *
- * @param null
- *
- * @return void
*/
public function preProcess() {
if ($this->_action & CRM_Core_Action::DELETE) {
* Set default values for the form. Note that in edit/view mode
* the default values are retrieved from the database
*
- * @param null
- *
* @return array
* array of default values
*/
/**
* Build the form object
- *
- * @param null
- *
- * @return void
*/
public function buildQuickForm() {
if ($this->_action & CRM_Core_Action::DELETE) {
*
* @param array $fields
* Posted values of the form.
- *
- * @param $files
+ * @param array $files
* @param CRM_Core_Form $form
*
- * @return array
+ * @return array|NULL
* list of errors to be posted back to the form
*/
public static function formRule($fields, $files, $form) {
+ return NULL;
}
/**
* Process the form
- *
- * @param null
- *
- * @return void
*/
public function postProcess() {
if ($this->_action & CRM_Core_Action::DELETE) {
'start_date',
'end_date',
'registration_start_date',
- 'registration_end_date'
+ 'registration_end_date',
)
);
}
if ($this->_context == 'standalone') {
$this->addEntityRef('contact_id', ts('Contact'), array(
'create' => TRUE,
- 'api' => array('extra' => array('email'))
+ 'api' => array('extra' => array('email')),
), TRUE);
}
}
$element = &$this->add('select', 'frequency_unit',
ts('Frequency'),
- array(
- '' => ts('- select -')
- ) + $freqUnitsDisplay,
+ array('' => ts('- select -')) + $freqUnitsDisplay,
TRUE
);
$pledgePages[$value['entity_id']] = $pages[$value['entity_id']];
}
$ele = $this->add('select', 'contribution_page_id', ts('Self-service Payments Page'),
- array(
- '' => ts('- select -')
- ) + $pledgePages
+ array('' => ts('- select -')) + $pledgePages
);
$mailingInfo = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME,
if (count($processors) > 0) {
$statusMsg .= ' ' . ts("If a payment is due now, you can record <a href='%1'>a check, EFT, or cash payment for this pledge</a> OR <a href='%2'>submit a credit card payment</a>.", array(
1 => $contribURL,
- 2 => $creditURL
+ 2 => $creditURL,
));
}
else {
/**
* Build all the data structures needed to build the form
- *
- * @return void
*/
- function preProcess() {
+ public function preProcess() {
//check for delete
if (!CRM_Core_Permission::checkActionPermission('CiviPledge', CRM_Core_Action::DELETE)) {
CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
$status = ts('Deleted Pledge(s): %1 (Total Selected: %2) ', array(
1 => $deletedPledges,
- 2 => count($this->_pledgeIds)
+ 2 => count($this->_pledgeIds),
));
CRM_Core_Session::setStatus($status, '', 'info');
}
'query' => 'reset=1&action=add&context=standalone',
'ref' => 'new-pledge',
'title' => ts('Pledge'),
- )
+ ),
));
}
}
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2014
* $Id$
- *
*/
/**
* This class is used to retrieve and display a range of
* contacts that match the given criteria (specifically for
* results of advanced search options.
- *
*/
class CRM_Pledge_Selector_Search extends CRM_Core_Selector_Base {
protected $_query;
/**
- * Class constructor
+ * Class constructor.
*
* @param array $queryParams
* Array of parameters for query.
*
* @return \CRM_Pledge_Selector_Search
*/
- function __construct(
+ public function __construct(
&$queryParams,
$action = CRM_Core_Action::NONE,
$additionalClause = NULL,
/**
* This method returns the links that are given for each search row.
- * currently the links added for each row are
*
+ * Currently the links added for each row are:
* - View
* - Edit
*
/**
* Returns total number of rows for the query.
*
- * @param
+ * @param int $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.
}
/**
+ * Get qill (display what was searched on).
+ *
* @inheritDoc
*/
public function getQILL() {
}
/**
- * Returns the column headers as an array of tuples:
- * (name, sortName (key to the sort array))
+ * Returns the column headers as an array of tuples.
+ *
+ * Keys are name, sortName, key to the sort array
*
* @param string $action
* The action being performed.
}
/**
+ * Get sql query string.
+ *
* @return string
*/
public function &getQuery() {
if (!empty($fieldOptions['is_full'])) {
$element->freeze();
}
- return;
+ return NULL;
}
/**
$priceVal = implode($seperator, array(
$customOption[$optionKey][$valueFieldName] + $taxAmount,
$count,
- $max_value
+ $max_value,
));
$extra = array();
if (!empty($qf->_membershipBlock) && !empty($qf->_quickConfig) && $field->name == 'other_amount' && empty($qf->_contributionAmount)) {
$useRequired = 0;
}
- elseif (!empty($fieldOptions[$optionKey]['label'])) { //check for label.
+ elseif (!empty($fieldOptions[$optionKey]['label'])) {
+ //check for label.
$label = $fieldOptions[$optionKey]['label'];
}
$element = &$qf->add('select', $elementName, $label,
array(
- '' => ts('- select -')
+ '' => ts('- select -'),
) + $selectOption,
$useRequired && $field->is_required,
array('price' => json_encode($priceVal))
$dao = CRM_Core_DAO::executeQuery($query, array(
1 => array($optionGroupName, 'String'),
- 2 => array($optionLabel, 'String')
+ 2 => array($optionLabel, 'String'),
));
while ($dao->fetch()) {
* @param int $id
* Field Id.
*
- * @return boolean
+ * @return bool
*
*/
public static function deleteField($id) {
* @param bool $allowNoneSelection
*
*/
-
public static function priceSetValidation($priceSetId, $fields, &$error, $allowNoneSelection = FALSE) {
// check for at least one positive
// amount price field should be selected.
/**
* Set variables up before form is built
- *
- * @param null
- *
- * @return void
*/
public function preProcess() {
* Set default values for the form. Note that in edit/view mode
* the default values are retrieved from the database
*
- * @param null
- *
* @return array
* array of default values
*/
/**
* Build the form object
- *
- * @param null
- *
- * @return void
*/
public function buildQuickForm() {
// lets trim all the whitespace
$js = array('onchange' => "calculateRowValues( $i );");
$this->add('select', 'membership_type_id[' . $i . ']', ts('Membership Type'),
- array(
- '' => ' '
- ) + $membershipTypes, FALSE, $js
+ array('' => ' ') + $membershipTypes, FALSE, $js
);
$this->add('text', 'membership_num_terms[' . $i . ']', ts('Number of Terms'), CRM_Utils_Array::value('membership_num_terms', $attributes));
}
/**
* Process the form
- *
- * @param null
- *
- * @return void
*/
public function postProcess() {
// store the submitted values in an array
elseif (!empty($this->_multiRecordFields)
&& (!$this->_multiRecord || !in_array($this->_multiRecord, array(
CRM_Core_Action::DELETE,
- CRM_Core_Action::UPDATE
+ CRM_Core_Action::UPDATE,
)))
) {
CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js', 1, 'html-header');
) {
$return = TRUE;
if (!$statusMessage) {
- $statusMessage =
- ts("This profile is configured for contact type '%1'. It cannot be used to edit contacts of other types.",
+ $statusMessage = ts("This profile is configured for contact type '%1'. It cannot be used to edit contacts of other types.",
array(1 => $profileSubType ? $profileSubType : $profileType));
}
}
$duplicateContactsLinks = '<div class="matching-contacts-found">';
$duplicateContactsLinks .= ts('One matching contact was found. ', array(
'count' => count($contactLinks['rows']),
- 'plural' => '%count matching contacts were found.<br />'
+ 'plural' => '%count matching contacts were found.<br />',
));
if ($contactLinks['msg'] == 'view') {
$duplicateContactsLinks .= ts('You can View the existing contact.', array(
'count' => count($contactLinks['rows']),
- 'plural' => 'You can View the existing contacts.'
+ 'plural' => 'You can View the existing contacts.',
));
}
else {
$duplicateContactsLinks .= ts('You can View or Edit the existing contact.', array(
'count' => count($contactLinks['rows']),
- 'plural' => 'You can View or Edit the existing contacts.'
+ 'plural' => 'You can View or Edit the existing contacts.',
));
}
$duplicateContactsLinks .= '</div>';
$duplicateContactsLinks .= '<table class="matching-contacts-actions">';
$row = '';
- for ($i = 0; $i < sizeof($contactLinks['rows']); $i++) {
+ for ($i = 0; $i < count($contactLinks['rows']); $i++) {
$row .= ' <tr> ';
$row .= ' <td class="matching-contacts-name"> ';
$row .= $contactLinks['rows'][$i]['display_name'];
/**
* Class constructor
*
- * @param array $params
- * @param $customFields
- * @param string params the params for the where clause
- *
+ * @param array $params the params for the where clause
+ * @param array $customFields
+ * @param array $ufGroupIds
* @param bool $map
* @param bool $editLink
* @param bool $linkToUF
*
* @return \CRM_Profile_Selector_Listings
*/
- function __construct(
+ public function __construct(
&$params,
&$customFields,
$ufGroupIds = NULL,
* @param array $params
*/
public function getPagerParams($action, &$params) {
- $status =
- CRM_Utils_System::isNull($this->_multiRecordTableName) ? ts('Contact %%StatusMessage%%') : ts('Contact Multi Records %%StatusMessage%%');
+ $status = CRM_Utils_System::isNull($this->_multiRecordTableName) ? ts('Contact %%StatusMessage%%') : ts('Contact Multi Records %%StatusMessage%%');
$params['status'] = $status;
$params['csvString'] = NULL;
$params['rowCount'] = CRM_Utils_Pager::ROWCOUNT;
if (in_array($fieldName, array(
'phone',
'im',
- 'email'
+ 'email',
))) {
if ($type) {
$name = "`$locationTypeName-$fieldName-$type`";
if (in_array($fieldName, array(
'phone',
'im',
- 'email'
+ 'email',
))) {
if ($type) {
$names[] = "{$locationTypeName}-{$fieldName}-{$type}";
elseif (in_array($name, array(
'addressee',
'email_greeting',
- 'postal_greeting'
+ 'postal_greeting',
))) {
$dname = $name . '_display';
$row[] = $result->$dname;
}
elseif (in_array($name, array(
'birth_date',
- 'deceased_date'
+ 'deceased_date',
))) {
$row[] = CRM_Utils_Date::customFormat($result->$name);
}
}
if ($isSubmitted) {
- $this->_multiRecordTableName = $multiRecordTableName =
- CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $customGroupId, 'table_name');
+ $this->_multiRecordTableName
+ = $multiRecordTableName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $customGroupId, 'table_name');
if ($multiRecordTableName) {
- return;
+ return NULL;
}
}
}
if (!isset($customGroupId) || !$customGroupId) {
- return;
+ return NULL;
}
//if the field is in selector and not a searchable field
//get the proper customvalue table name
if ($selectorSet) {
- $this->_multiRecordTableName = $multiRecordTableName =
- CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $customGroupId, 'table_name');
+ $this->_multiRecordTableName
+ = $multiRecordTableName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $customGroupId, 'table_name');
}
} //func close
}
/**
* The set of all columns in the report. An associative array
- * with column name as the key and attribues as the value
+ * with column name as the key and attributes as the value
*
* @var array
*/
protected $_tagFilter = FALSE;
/**
- * <<<<<<< HEAD
- * Build groups filter
- * =======
* specify entity table for tags filter
*
*/
/**
* build groups filter
*
- * >>>>>>> 098a61330d0fe12153370741ec98cb1172ece849
+ * @var bool
*/
protected $_groupFilter = FALSE;
protected $_selectAliases = array();
protected $_rollup = NULL;
+ /**
+ * @var array
+ */
+ protected $_aliases = array();
+
+ /**
+ * @var string
+ */
+ protected $_where;
+
+ /**
+ * @var string
+ */
+ protected $_from;
+
/**
* SQL Limit clause
* @var string
* @var integer
*/
protected $_offsetValue = NULL;
+ /**
+ * @var null
+ */
protected $_sections = NULL;
protected $_autoIncludeIndexedFieldsAsOrderBys = 0;
protected $_absoluteUrl = FALSE;
protected $_selectedTables;
/**
- * Outputmode e.g 'print', 'csv', 'pdf'
+ * Output mode e.g 'print', 'csv', 'pdf'
* @var string
*/
protected $_outputMode;
*/
protected $_currencyColumn = NULL;
+ /**
+ * @var string
+ */
+ protected $_interval;
+
+ /**
+ * @var bool
+ */
+ protected $_sendmail;
+
+ /**
+ * @var int
+ */
+ protected $_chartId;
+
+ /**
+ * @var int
+ */
+ public $_section;
+
+ /**
+ * @var string Report description.
+ */
+ public $_description;
+
+ /**
+ * @var bool Is an address field selected.
+ * This was intended to determine if the address table should be joined in
+ * The isTableSelected function is now preferred for this purpose
+ */
+ protected $_addressField;
+
+ /**
+ * @var bool Is an email field selected.
+ * This was intended to determine if the email table should be joined in
+ * The isTableSelected function is now preferred for this purpose
+ */
+ protected $_emailField;
+
+ /**
+ * @var bool Is a phone field selected.
+ * This was intended to determine if the phone table should be joined in
+ * The isTableSelected function is now preferred for this purpose
+ */
+ protected $_phoneField;
+
+ /**
+ * @var bool Create new report instance? (or update existing) on save.
+ */
+ protected $_createNew;
+
/**
*/
public function __construct() {
}
public function preProcessCommon() {
- $this->_force =
- CRM_Utils_Request::retrieve(
- 'force',
- 'Boolean',
- CRM_Core_DAO::$_nullObject
- );
+ $this->_force
+ = CRM_Utils_Request::retrieve(
+ 'force',
+ 'Boolean',
+ CRM_Core_DAO::$_nullObject
+ );
- $this->_dashBoardRowCount =
- CRM_Utils_Request::retrieve(
- 'rowCount',
- 'Integer',
- CRM_Core_DAO::$_nullObject
- );
+ $this->_dashBoardRowCount
+ = CRM_Utils_Request::retrieve(
+ 'rowCount',
+ 'Integer',
+ CRM_Core_DAO::$_nullObject
+ );
$this->_section = CRM_Utils_Request::retrieve('section', 'Integer', CRM_Core_DAO::$_nullObject);
}
public function addBreadCrumb() {
- $breadCrumbs =
- array(
+ $breadCrumbs
+ = array(
array(
'title' => ts('Report Templates'),
'url' => CRM_Utils_System::url('civicrm/admin/report/template/list', 'reset=1'),
}
// set alias = table-name, unless already set
- $alias = isset($field['alias']) ? $field['alias'] : (isset($this->_columns[$tableName]['alias']) ?
- $this->_columns[$tableName]['alias'] : $tableName
+ $alias = isset($field['alias']) ? $field['alias'] : (
+ isset($this->_columns[$tableName]['alias']) ? $this->_columns[$tableName]['alias'] : $tableName
);
$this->_columns[$tableName][$fieldGrp][$fieldName]['alias'] = $alias;
// set dbAlias = alias.name, unless already set
if (!isset($this->_columns[$tableName][$fieldGrp][$fieldName]['dbAlias'])) {
- $this->_columns[$tableName][$fieldGrp][$fieldName]['dbAlias'] =
- $alias . '.' .
+ $this->_columns[$tableName][$fieldGrp][$fieldName]['dbAlias']
+ = $alias . '.' .
$this->_columns[$tableName][$fieldGrp][$fieldName]['name'];
}
case CRM_Utils_Type::T_BOOLEAN:
$this->_columns[$tableName][$fieldGrp][$fieldName]['operatorType'] = CRM_Report_Form::OP_SELECT;
if (!array_key_exists('options', $this->_columns[$tableName][$fieldGrp][$fieldName])) {
- $this->_columns[$tableName][$fieldGrp][$fieldName]['options'] =
- array(
+ $this->_columns[$tableName][$fieldGrp][$fieldName]['options']
+ = array(
'' => ts('Any'),
'0' => ts('No'),
'1' => ts('Yes'),
}
/**
- * @param $group
+ * @param string $group
* @param string $grpFieldName
*
* @return bool
/**
* Setter for $_id
*
- * @param int $instanceid
+ * @param int $instanceID
*/
- public function setID($instanceid) {
- $this->_id = $instanceid;
+ public function setID($instanceID) {
+ $this->_id = $instanceID;
}
/**
}
}
- /* Add searchable custom fields as order-by options, if so requested
- * (These are already indexed, so allowing to order on them is cheap.)
- */
-
+ // Add searchable custom fields as order-by options, if so requested
+ // (These are already indexed, so allowing to order on them is cheap.)
if ($this->_autoIncludeIndexedFieldsAsOrderBys &&
array_key_exists('extends', $table) && !empty($table['extends'])
if (!empty($options)) {
$options = array(
- '-' => ' - none - ',
- ) + $options;
+ '-' => ' - none - ',
+ ) + $options;
for ($i = 1; $i <= 5; $i++) {
$this->addElement('select', "order_bys[{$i}][column]", ts('Order by Column'), $options);
$this->addElement('select', "order_bys[{$i}][order]", ts('Order by Order'), array(
}
/**
- * a formrule function to ensure that fields selected in group_by
+ * A form rule function to ensure that fields selected in group_by
* (if any) should only be the ones present in display/select fields criteria;
* note: works if and only if any custom field selected in group_by.
- * @param $fields
+ * @param array $fields
* @param array $ignoreFields
*
* @return array
* Note: $fieldName param allows inheriting class to build operationPairs
* specific to a field.
* @param string $type
- * @param null $fieldName
+ * @param string $fieldName
*
* @return array
*/
}
/**
- * Adds group filters to _columns (called from _Constuct
+ * Adds group filters to _columns (called from _Construct
*/
public function buildGroupFilter() {
$this->_columns['civicrm_group']['filters'] = array(
}
/**
- * @param $field
- * @param $op
- * @param $value
- * @param $min
- * @param $max
+ * Generate where clause.
+ * This can be overridden in reports for special treatment of a field
+ *
+ * @param array $field Field specifications
+ * @param string $op Query operator (not an exact match to sql)
+ * @param mixed $value
+ * @param float $min
+ * @param float $max
*
* @return null|string
*/
- function whereClause(
- &$field, $op,
- $value, $min, $max
- ) {
+ public function whereClause(&$field, $op, $value, $min, $max) {
$type = CRM_Utils_Type::typeToString(CRM_Utils_Array::value('type', $field));
$clause = NULL;
if (CRM_Utils_Array::value('type', $field) ==
CRM_Utils_Type::T_STRING
) {
- //cycle through selections and esacape values
+ //cycle through selections and escape values
foreach ($value as $key => $selection) {
$value[$key] = CRM_Utils_Type::escape($selection, $type);
}
- $clause =
- "( {$field['dbAlias']} $sqlOP ( '" . implode("' , '", $value) .
+ $clause
+ = "( {$field['dbAlias']} $sqlOP ( '" . implode("' , '", $value) .
"') )";
}
else {
// mhas == multiple has
if ($value !== NULL && count($value) > 0) {
$sqlOP = $this->getSQLOperator($op);
- $clause =
- "{$field['dbAlias']} REGEXP '[[:<:]]" . implode('|', $value) .
+ $clause
+ = "{$field['dbAlias']} REGEXP '[[:<:]]" . implode('|', $value) .
"[[:>:]]'";
}
break;
// mnot == multiple is not one of
if ($value !== NULL && count($value) > 0) {
$sqlOP = $this->getSQLOperator($op);
- $clause =
- "( {$field['dbAlias']} NOT REGEXP '[[:<:]]" . implode('|', $value) .
+ $clause
+ = "( {$field['dbAlias']} NOT REGEXP '[[:<:]]" . implode('|', $value) .
"[[:>:]]' OR {$field['dbAlias']} IS NULL )";
}
break;
$clause = $this->whereTagClause($field, $value, $op);
}
elseif (!empty($field['membership_org']) && $clause) {
- $clause = $this->whereMembershipOrgClause($field, $value, $op);
+ $clause = $this->whereMembershipOrgClause($value, $op);
}
elseif (!empty($field['membership_type']) && $clause) {
- $clause = $this->whereMembershipTypeClause($field, $value, $op);
+ $clause = $this->whereMembershipTypeClause($value, $op);
}
return $clause;
}
/**
* @param string $fieldName
* @param $relative
- * @param $from
- * @param $to
+ * @param string $from
+ * @param string $to
* @param null $type
* @param null $fromTime
* @param null $toTime
*
* @return null|string
*/
- function dateClause(
+ public function dateClause(
$fieldName,
$relative, $from, $to, $type = NULL, $fromTime = NULL, $toTime = NULL
) {
/**
* @todo - could not find any instances where this is called
*
- * @param unknown_type $relative
+ * @param bool $relative
* @param string $from
* @param string_type $to
*
}
/**
- * @param $relative
- * @param $from
- * @param $to
- * @param null $fromtime
- * @param null $totime
+ * @param bool $relative
+ * @param string $from
+ * @param string $to
+ * @param string $fromTime
+ * @param string $toTime
*
* @return array
*/
- public function getFromTo($relative, $from, $to, $fromtime = NULL, $totime = NULL) {
- if (empty($totime)) {
- $totime = '235959';
+ public function getFromTo($relative, $from, $to, $fromTime = NULL, $toTime = NULL) {
+ if (empty($toTime)) {
+ $toTime = '235959';
}
//FIX ME not working for relative
if ($relative) {
//Take only Date Part, Sometime Time part is also present in 'to'
$to = substr($dateRange['to'], 0, 8);
}
- $from = CRM_Utils_Date::processDate($from, $fromtime);
- $to = CRM_Utils_Date::processDate($to, $totime);
+ $from = CRM_Utils_Date::processDate($from, $fromTime);
+ $to = CRM_Utils_Date::processDate($to, $toTime);
return array($from, $to);
}
* @param $customField
* @param $fieldValueMap
*
- * @return float|string
+ * @return float|string|void
*/
public function formatCustomValues($value, $customField, $fieldValueMap) {
if (CRM_Utils_System::isNull($value)) {
}
case 'Money':
if ($htmlType == 'Text') {
-
-
$retValue = CRM_Utils_Money::format($value, NULL, '%a');
break;
}
public function fixSubTotalDisplay(&$row, $fields, $subtotal = TRUE) {
foreach ($row as $colName => $colVal) {
if (in_array($colName, $fields)) {
- $row[$colName] = $row[$colName];
}
elseif (isset($this->_columnHeaders[$colName])) {
if ($subtotal) {
// select() method below has been added recently (v3.3), and many of the report templates might
// still be having their own select() method. We should fix them as and when encountered and move
// towards generalizing the select() method below.
+
+ /**
+ * Generate the SELECT clause and set class variable $_select
+ */
public function select() {
$select = $this->_selectAliases = array();
// for graphs and charts -
if (!empty($this->_params['group_bys_freq'][$fieldName])) {
$this->_interval = $field['title'];
- $this->_columnHeaders["{$tableName}_{$fieldName}_start"]['title'] =
- $field['title'] . ' Beginning';
+ $this->_columnHeaders["{$tableName}_{$fieldName}_start"]['title']
+ = $field['title'] . ' Beginning';
$this->_columnHeaders["{$tableName}_{$fieldName}_start"]['type'] = $field['type'];
$this->_columnHeaders["{$tableName}_{$fieldName}_start"]['group_by'] = $this->_params['group_bys_freq'][$fieldName];
$op = CRM_Utils_Array::value("{$fieldName}_op", $this->_params);
$value = CRM_Utils_Array::value("{$fieldName}_value", $this->_params);
if (is_array($value) && !empty($value)) {
- $clause =
- "(month({$field['dbAlias']}) $op (" . implode(', ', $value) .
+ $clause
+ = "(month({$field['dbAlias']}) $op (" . implode(', ', $value) .
'))';
}
}
CRM_Core_DAO::$_nullObject
);
- $this->_sendmail =
- CRM_Utils_Request::retrieve(
+ $this->_sendmail
+ = CRM_Utils_Request::retrieve(
'sendmail',
'Boolean',
CRM_Core_DAO::$_nullObject
!empty($this->_params['order_bys'])
) {
- // Proces order_bys in user-specified order
+ // Process order_bys in user-specified order
foreach ($this->_params['order_bys'] as $orderBy) {
$orderByField = array();
foreach ($this->_columns as $tableName => $table) {
$ifnulls[] = "ifnull($alias, '') as $alias";
}
- /* Group (un-limited) report by all aliases and get counts. This might
- * be done more efficiently when the contents of $sql are known, ie. by
- * overriding this method in the report class.
- */
-
+ // Group (un-limited) report by all aliases and get counts. This might
+ // be done more efficiently when the contents of $sql are known, ie. by
+ // overriding this method in the report class.
$query = "select " . implode(", ", $ifnulls) .
", count(*) as ct from ($sql) as subquery group by " .
CRM_Utils_Array::value('operatorType', $field) !=
CRM_Report_Form::OP_MONTH
) {
- list($from, $to) =
- $this->getFromTo(
+ list($from, $to)
+ = $this->getFromTo(
CRM_Utils_Array::value("{$fieldName}_relative", $this->_params),
CRM_Utils_Array::value("{$fieldName}_from", $this->_params),
CRM_Utils_Array::value("{$fieldName}_to", $this->_params),
$attachments = array();
if ($this->_outputMode == 'csv') {
- $content =
- $this->_formValues['report_header'] . '<p>' . ts('Report URL') .
+ $content
+ = $this->_formValues['report_header'] . '<p>' . ts('Report URL') .
": {$url}</p>" . '<p>' .
ts('The report is attached as a CSV file.') . '</p>' .
$this->_formValues['report_footer'];
)
);
// generate Email Content
- $content =
- $this->_formValues['report_header'] . '<p>' . ts('Report URL') .
+ $content
+ = $this->_formValues['report_header'] . '<p>' . ts('Report URL') .
": {$url}</p>" . '<p>' .
ts('The report is attached as a PDF file.') . '</p>' .
$this->_formValues['report_footer'];
//get chart image name
$chartImg = $this->_chartId . '.png';
//get image url path
- $uploadUrl =
- str_replace('/persist/contribute/', '/persist/', $config->imageUploadURL) .
+ $uploadUrl
+ = str_replace('/persist/contribute/', '/persist/', $config->imageUploadURL) .
'openFlashChart/';
$uploadUrl .= $chartImg;
//get image doc path to overwrite
- $uploadImg =
- str_replace('/persist/contribute/', '/persist/', $config->imageUploadDir) .
+ $uploadImg
+ = str_replace('/persist/contribute/', '/persist/', $config->imageUploadDir) .
'openFlashChart/' . $chartImg;
//Load the image
$chart = imagecreatefrompng($uploadUrl);
- //convert it into formattd png
+ //convert it into formatted png
header('Content-type: image/png');
//overwrite with same image
imagepng($chart, $uploadImg);
}
}
+ /**
+ * Set store result set indicator to TRUE
+ * @todo explain what this does
+ */
public function storeResultSet() {
$this->_storeResultSet = TRUE;
}
$pageId = CRM_Utils_Request::retrieve('crmPID', 'Integer', CRM_Core_DAO::$_nullObject);
+ // @todo all http vars should be extracted in the preProcess
+ // - not randomly in the class
if (!$pageId && !empty($_POST)) {
if (isset($_POST['PagerBottomButton']) && isset($_POST['crmPID_B'])) {
- $pageId = max((int) @$_POST['crmPID_B'], 1);
+ $pageId = max((int) $_POST['crmPID_B'], 1);
}
elseif (isset($_POST['PagerTopButton']) && isset($_POST['crmPID'])) {
- $pageId = max((int) @$_POST['crmPID'], 1);
+ $pageId = max((int) $_POST['crmPID'], 1);
}
unset($_POST['crmPID_B'], $_POST['crmPID']);
}
WHERE entity_table = '$entity_table' AND {$clause} ) ";
}
- public function whereMembershipOrgClause($field, $value, $op) {
+ /**
+ * Generate membership organization clause.
+ *
+ * @param mixed $value
+ * @param string $op SQL Operator
+ *
+ * @return string
+ */
+ public function whereMembershipOrgClause($value, $op) {
$sqlOp = $this->getSQLOperator($op);
if (!is_array($value)) {
$value = array($value);
AND mem_status.is_active = '1' ) ";
}
- public function whereMembershipTypeClause($field, $value, $op) {
+ /**
+ * Generate Membership Type SQL Clause
+ * @param mixed $value
+ * @param string $op
+ *
+ * @return string
+ * SQL query string
+ */
+ public function whereMembershipTypeClause($value, $op) {
$sqlOp = $this->getSQLOperator($op);
if (!is_array($value)) {
$value = array($value);
/**
* Check for empty order_by configurations and remove them; also set
* template to hide them.
+ *
+ * @param array $formValues
*/
public function preProcessOrderBy(&$formValues) {
// Object to show/hide form elements
* Fetch array of DAO tables having columns included in SELECT or ORDER BY clause
* (building the array if it's unset)
*
- * @return Array
- * >_selectedTables
+ * @return array
+ * selectedTables
*/
public function selectedTables() {
if (!$this->_selectedTables) {
// prepare the directory
$config = CRM_Core_Config::singleton();
- $defaultPath =
- str_replace('/persist/contribute/', '/persist/', $config->imageUploadDir) .
+ $defaultPath
+ = str_replace('/persist/contribute/', '/persist/', $config->imageUploadDir) .
'/openFlashChart/';
if (!file_exists($defaultPath)) {
mkdir($defaultPath, 0777, TRUE);
LEFT JOIN civicrm_activity civireport_activity_all_{$activityType} ON ( civireport_activity_all_{$activityType}.id = civireport_case_activity_all_{$activityType}.activity_id AND civireport_activity_all_{$activityType}.activity_type_id = {$activityType})";
$this->_columnHeaders['case_activity_all_dates'] = array(
- 'title' => $this->_caseDetailExtra['case_activity_all_dates']['title'] .
- ": {$this->caseActivityTypes[$activityType]}",
+ 'title' => $this->_caseDetailExtra['case_activity_all_dates']['title'] . ": {$this->caseActivityTypes[$activityType]}",
'type' => CRM_Utils_Array::value('type', $this->_caseDetailExtra['case_activity_all_dates']),
);
}
foreach ($this->_component as $val) {
if (!empty($select[$val])) {
- $this->_selectComponent[$val] =
- "SELECT " . implode(', ', $select[$val]) . " ";
+ $this->_selectComponent[$val] = "SELECT " . implode(', ', $select[$val]) . " ";
unset($select[$val]);
}
}
//unset Conmponent id and contact id from display
foreach ($this->_columnHeadersComponent as $componentTitle => $headers) {
- $id_header =
- 'civicrm_' . substr_replace($componentTitle, '', -11, 11) . '_' .
+ $id_header = 'civicrm_' . substr_replace($componentTitle, '', -11, 11) . '_' .
substr_replace($componentTitle, '', -11, 11) . '_id';
- $contact_header =
- 'civicrm_' . substr_replace($componentTitle, '', -11, 11) .
+ $contact_header = 'civicrm_' . substr_replace($componentTitle, '', -11, 11) .
'_contact_id';
if ($componentTitle == 'activity_civireport') {
- $id_header =
- 'civicrm_' . substr_replace($componentTitle, '', -11, 11) . '_id';
+ $id_header = 'civicrm_' . substr_replace($componentTitle, '', -11, 11) . '_id';
}
unset($this->_columnHeadersComponent[$componentTitle][$id_header]);
// handle contribution
if ($component == 'contribution_civireport') {
if ($val = CRM_Utils_Array::value('civicrm_contribution_financial_type_id', $row)) {
- $componentRows[$contactID][$component][$rowNum]['civicrm_contribution_financial_type_id'] =
- CRM_Contribute_PseudoConstant::financialType($val, FALSE);
+ $componentRows[$contactID][$component][$rowNum]['civicrm_contribution_financial_type_id'] = CRM_Contribute_PseudoConstant::financialType($val, FALSE);
}
if ($val = CRM_Utils_Array::value('civicrm_contribution_contribution_status_id', $row)) {
/**
*/
public function __construct() {
- $logging = new CRM_Logging_Schema;
+ $logging = new CRM_Logging_Schema();
$this->tables[] = 'civicrm_contact';
$this->tables = array_merge($this->tables, array_keys($logging->customDataLogTables()));
$this->tables[] = 'civicrm_email';
'title' => ts('Relationship'),
'operatorType' => CRM_Report_Form::OP_SELECT,
'options' => array(
- '' => '- any relationship type -',
- ) +
- CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, 'null', NULL, NULL, TRUE),
+ '' => '- any relationship type -',
+ ) +
+ CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, 'null', NULL, NULL, TRUE),
'type' => CRM_Utils_Type::T_INT,
),
),
'reset=1&force=1&id_op=eq&id_value=' . $row['civicrm_contact_id'],
$this->_absoluteUrl, $this->_id, $this->_drilldownReport
);
- $rows[$rowNum]['civicrm_contact_sort_name_a'] =
- $rows[$rowNum]['civicrm_contact_sort_name_a'] . ' (' .
+ $rows[$rowNum]['civicrm_contact_sort_name_a']
+ = $rows[$rowNum]['civicrm_contact_sort_name_a'] . ' (' .
$rows[$rowNum]['civicrm_contact_id'] . ')';
$rows[$rowNum]['civicrm_contact_sort_name_a_link'] = $url;
$rows[$rowNum]['civicrm_contact_sort_name_a_hover'] = ts("View Contact details for this contact.");
'reset=1&force=1&id_op=eq&id_value=' . $row['civicrm_contact_b_id'],
$this->_absoluteUrl, $this->_id, $this->_drilldownReport
);
- $rows[$rowNum]['civicrm_contact_b_sort_name_b'] =
- $rows[$rowNum]['civicrm_contact_b_sort_name_b'] . ' (' .
+ $rows[$rowNum]['civicrm_contact_b_sort_name_b']
+ = $rows[$rowNum]['civicrm_contact_b_sort_name_b'] . ' (' .
$rows[$rowNum]['civicrm_contact_b_id'] . ')';
$rows[$rowNum]['civicrm_contact_b_sort_name_b_link'] = $url;
$rows[$rowNum]['civicrm_contact_b_sort_name_b_hover'] = ts("View Contact details for this contact.");
if (array_key_exists('civicrm_relationship_relationship_id', $row) &&
array_key_exists('civicrm_contact_id', $row)
) {
- $url =
- "/civicrm/contact/view/rel?reset=1&action=update&rtype=a_b&cid=" .
+ $url = "/civicrm/contact/view/rel?reset=1&action=update&rtype=a_b&cid=" .
$row['civicrm_contact_id'] . "&id=" .
$row['civicrm_relationship_relationship_id'];
$rows[$rowNum]['civicrm_relationship_relationship_id_link'] = $url;
*/
class CRM_Report_Form_Contact_Summary extends CRM_Report_Form {
- protected $_summary = NULL;
+ public $_summary = NULL;
protected $_emailField = FALSE;
public function __construct() {
$this->_autoIncludeIndexedFieldsAsOrderBys = 1;
$this->_columns = array(
- 'civicrm_contact' => array(
- 'dao' => 'CRM_Contact_DAO_Contact',
- 'fields' => array(
- 'sort_name' => array(
- 'title' => ts('Contact Name'),
- 'required' => TRUE,
- 'no_repeat' => TRUE,
- ),
- 'first_name' => array(
- 'title' => ts('First Name'),
- ),
- 'middle_name' => array(
- 'title' => ts('Middle Name'),
- ),
- 'last_name' => array(
- 'title' => ts('Last Name'),
- ),
- 'id' => array(
- 'no_display' => TRUE,
- 'required' => TRUE,
- ),
- 'contact_type' => array(
- 'title' => ts('Contact Type'),
- ),
- 'contact_sub_type' => array(
- 'title' => ts('Contact Subtype'),
- ),
- 'gender_id' => array(
- 'title' => ts('Gender'),
- ),
- 'birth_date' => array(
- 'title' => ts('Birth Date'),
- ),
- 'age' => array(
- 'title' => ts('Age'),
- 'dbAlias' => 'TIMESTAMPDIFF(YEAR, contact_civireport.birth_date, CURDATE())',
- ),
+ 'civicrm_contact' => array(
+ 'dao' => 'CRM_Contact_DAO_Contact',
+ 'fields' => array(
+ 'sort_name' => array(
+ 'title' => ts('Contact Name'),
+ 'required' => TRUE,
+ 'no_repeat' => TRUE,
),
- 'filters' => array(
- 'sort_name' => array('title' => ts('Contact Name')),
- 'source' => array(
- 'title' => ts('Contact Source'),
- 'type' => CRM_Utils_Type::T_STRING,
- ),
- 'id' => array(
- 'title' => ts('Contact ID'),
- 'no_display' => TRUE,
- ),
- 'gender_id' => array(
- 'title' => ts('Gender'),
- 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
- 'options' => CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id'),
- ),
- 'birth_date' => array(
- 'title' => ts('Birth Date'),
- 'operatorType' => CRM_Report_Form::OP_DATE,
- ),
+ 'first_name' => array(
+ 'title' => ts('First Name'),
),
- 'grouping' => 'contact-fields',
- 'order_bys' => array(
- 'sort_name' => array(
- 'title' => ts('Last Name, First Name'),
- 'default' => '1',
- 'default_weight' => '0',
- 'default_order' => 'ASC',
- ),
- 'gender_id' => array(
- 'name' => 'gender_id',
- 'title' => ts('Gender'),
- ),
- 'birth_date' => array(
- 'name' => 'birth_date',
- 'title' => ts('Birth Date'),
- ),
+ 'middle_name' => array(
+ 'title' => ts('Middle Name'),
+ ),
+ 'last_name' => array(
+ 'title' => ts('Last Name'),
+ ),
+ 'id' => array(
+ 'no_display' => TRUE,
+ 'required' => TRUE,
+ ),
+ 'contact_type' => array(
+ 'title' => ts('Contact Type'),
+ ),
+ 'contact_sub_type' => array(
+ 'title' => ts('Contact Subtype'),
+ ),
+ 'gender_id' => array(
+ 'title' => ts('Gender'),
+ ),
+ 'birth_date' => array(
+ 'title' => ts('Birth Date'),
+ ),
+ 'age' => array(
+ 'title' => ts('Age'),
+ 'dbAlias' => 'TIMESTAMPDIFF(YEAR, contact_civireport.birth_date, CURDATE())',
),
),
- 'civicrm_email' => array(
- 'dao' => 'CRM_Core_DAO_Email',
- 'fields' => array(
- 'email' => array(
- 'title' => ts('Email'),
- 'no_repeat' => TRUE,
- ),
+ 'filters' => array(
+ 'sort_name' => array('title' => ts('Contact Name')),
+ 'source' => array(
+ 'title' => ts('Contact Source'),
+ 'type' => CRM_Utils_Type::T_STRING,
+ ),
+ 'id' => array(
+ 'title' => ts('Contact ID'),
+ 'no_display' => TRUE,
+ ),
+ 'gender_id' => array(
+ 'title' => ts('Gender'),
+ 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
+ 'options' => CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id'),
),
- 'grouping' => 'contact-fields',
- 'order_bys' => array(
- 'email' => array(
- 'title' => ts('Email'),
- ),
+ 'birth_date' => array(
+ 'title' => ts('Birth Date'),
+ 'operatorType' => CRM_Report_Form::OP_DATE,
+ ),
+ ),
+ 'grouping' => 'contact-fields',
+ 'order_bys' => array(
+ 'sort_name' => array(
+ 'title' => ts('Last Name, First Name'),
+ 'default' => '1',
+ 'default_weight' => '0',
+ 'default_order' => 'ASC',
+ ),
+ 'gender_id' => array(
+ 'name' => 'gender_id',
+ 'title' => ts('Gender'),
+ ),
+ 'birth_date' => array(
+ 'name' => 'birth_date',
+ 'title' => ts('Birth Date'),
+ ),
+ ),
+ ),
+ 'civicrm_email' => array(
+ 'dao' => 'CRM_Core_DAO_Email',
+ 'fields' => array(
+ 'email' => array(
+ 'title' => ts('Email'),
+ 'no_repeat' => TRUE,
+ ),
+ ),
+ 'grouping' => 'contact-fields',
+ 'order_bys' => array(
+ 'email' => array(
+ 'title' => ts('Email'),
),
),
- 'civicrm_phone' => array(
- 'dao' => 'CRM_Core_DAO_Phone',
- 'fields' => array(
- 'phone' => NULL,
- 'phone_ext' => array(
- 'title' => ts('Phone Extension'),
- ),
+ ),
+ 'civicrm_phone' => array(
+ 'dao' => 'CRM_Core_DAO_Phone',
+ 'fields' => array(
+ 'phone' => NULL,
+ 'phone_ext' => array(
+ 'title' => ts('Phone Extension'),
),
- 'grouping' => 'contact-fields',
),
- ) + $this->getAddressColumns(array('group_by' => FALSE));
+ 'grouping' => 'contact-fields',
+ ),
+ ) + $this->getAddressColumns(array('group_by' => FALSE));
$this->_groupFilter = TRUE;
$this->_tagFilter = TRUE;
}
$this->_columns = array(
- 'civicrm_contact' => array(
- 'dao' => 'CRM_Contact_DAO_Contact',
- 'fields' => array(
- 'sort_name' => array(
- 'title' => ts('Contact Name'),
- 'default' => TRUE,
- 'required' => TRUE,
- 'no_repeat' => TRUE,
- ),
- 'id' => array(
- 'no_display' => TRUE,
- 'default' => TRUE,
- 'required' => TRUE,
- ),
- 'contact_type' => array(
- 'title' => ts('Contact Type'),
- ),
- 'contact_sub_type' => array(
- 'title' => ts('Contact Subtype'),
- ),
+ 'civicrm_contact' => array(
+ 'dao' => 'CRM_Contact_DAO_Contact',
+ 'fields' => array(
+ 'sort_name' => array(
+ 'title' => ts('Contact Name'),
+ 'default' => TRUE,
+ 'required' => TRUE,
+ 'no_repeat' => TRUE,
),
- 'grouping' => 'contact-fields',
- 'filters' => array(
- 'sort_name' => array('title' => ts('Contact Name')),
- 'id' => array(
- 'title' => ts('Contact ID'),
- 'no_display' => TRUE,
- ),
+ 'id' => array(
+ 'no_display' => TRUE,
+ 'default' => TRUE,
+ 'required' => TRUE,
+ ),
+ 'contact_type' => array(
+ 'title' => ts('Contact Type'),
+ ),
+ 'contact_sub_type' => array(
+ 'title' => ts('Contact Subtype'),
),
),
- 'civicrm_email' => array(
- 'dao' => 'CRM_Core_DAO_Email',
- 'fields' => array(
- 'email' => array(
- 'title' => ts('Email'),
- 'no_repeat' => TRUE,
- ),
+ 'grouping' => 'contact-fields',
+ 'filters' => array(
+ 'sort_name' => array('title' => ts('Contact Name')),
+ 'id' => array(
+ 'title' => ts('Contact ID'),
+ 'no_display' => TRUE,
),
- 'grouping' => 'contact-fields',
),
- 'civicrm_phone' => array(
- 'dao' => 'CRM_Core_DAO_Phone',
- 'fields' => array(
- 'phone' => array(
- 'title' => ts('Phone'),
- 'no_repeat' => TRUE,
- ),
+ ),
+ 'civicrm_email' => array(
+ 'dao' => 'CRM_Core_DAO_Email',
+ 'fields' => array(
+ 'email' => array(
+ 'title' => ts('Email'),
+ 'no_repeat' => TRUE,
),
- 'grouping' => 'contact-fields',
),
- ) + $this->addAddressFields(FALSE, FALSE, FALSE, array()) + array(
- 'civicrm_relationship' => array(
- 'dao' => 'CRM_Contact_DAO_Relationship',
- 'fields' => array(
- 'relationship_type_id' => array(
- 'title' => ts('Relationship Type'),
- 'default' => TRUE,
- ),
- 'contact_id_a' => array('no_display' => TRUE),
- 'contact_id_b' => array('no_display' => TRUE),
+ 'grouping' => 'contact-fields',
+ ),
+ 'civicrm_phone' => array(
+ 'dao' => 'CRM_Core_DAO_Phone',
+ 'fields' => array(
+ 'phone' => array(
+ 'title' => ts('Phone'),
+ 'no_repeat' => TRUE,
),
- 'filters' => array(
- 'relationship_type_id' => array(
- 'title' => ts('Relationship Type'),
- 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
- 'options' => $relationTypeOp,
- 'type' => CRM_Utils_Type::T_STRING,
- ),
+ ),
+ 'grouping' => 'contact-fields',
+ ),
+ ) + $this->addAddressFields(FALSE, FALSE, FALSE, array()) + array(
+ 'civicrm_relationship' => array(
+ 'dao' => 'CRM_Contact_DAO_Relationship',
+ 'fields' => array(
+ 'relationship_type_id' => array(
+ 'title' => ts('Relationship Type'),
+ 'default' => TRUE,
),
+ 'contact_id_a' => array('no_display' => TRUE),
+ 'contact_id_b' => array('no_display' => TRUE),
),
- ) + array(
- 'civicrm_contribution' => array(
- 'dao' => 'CRM_Contribute_DAO_Contribution',
- 'fields' => array(
- 'total_amount' => array(
- 'title' => ts('Amount Statistics'),
- 'default' => TRUE,
- 'required' => TRUE,
- 'no_display' => TRUE,
- 'statistics' => array('sum' => ts('Aggregate Amount')),
- ),
- 'receive_date' => array(
- 'required' => TRUE,
- 'default' => TRUE,
- 'no_display' => TRUE,
- ),
+ 'filters' => array(
+ 'relationship_type_id' => array(
+ 'title' => ts('Relationship Type'),
+ 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
+ 'options' => $relationTypeOp,
+ 'type' => CRM_Utils_Type::T_STRING,
),
- 'grouping' => 'contri-fields',
- 'filters' => array(
- 'this_year' => array(
- 'title' => ts('This Year'),
- 'operatorType' => CRM_Report_Form::OP_SELECT,
- 'options' => $optionYear,
- 'default' => '',
- ),
- 'other_year' => array(
- 'title' => ts('Other Years'),
- 'operatorType' => CRM_Report_Form::OP_SELECT,
- 'options' => $optionYear,
- 'default' => '',
- ),
- 'receive_date' => array('operatorType' => CRM_Report_Form::OP_DATE),
- 'contribution_status_id' => array(
- 'title' => ts('Contribution Status'),
- 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
- 'options' => CRM_Contribute_PseudoConstant::contributionStatus(),
- 'default' => array(1),
- ),
- 'financial_type_id' => array(
- 'title' => ts('Financial Type'),
- 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
- 'options' => CRM_Contribute_PseudoConstant::financialType(),
- ),
- 'total_amount' => array(
- 'title' => ts('Contribution Amount'),
- ),
- 'total_sum' => array(
- 'title' => ts('Aggregate Amount'),
- 'type' => CRM_Report_Form::OP_INT,
- 'dbAlias' => 'civicrm_contribution_total_amount_sum',
- 'having' => TRUE,
- ),
+ ),
+ ),
+ ) + array(
+ 'civicrm_contribution' => array(
+ 'dao' => 'CRM_Contribute_DAO_Contribution',
+ 'fields' => array(
+ 'total_amount' => array(
+ 'title' => ts('Amount Statistics'),
+ 'default' => TRUE,
+ 'required' => TRUE,
+ 'no_display' => TRUE,
+ 'statistics' => array('sum' => ts('Aggregate Amount')),
+ ),
+ 'receive_date' => array(
+ 'required' => TRUE,
+ 'default' => TRUE,
+ 'no_display' => TRUE,
),
),
- );
+ 'grouping' => 'contri-fields',
+ 'filters' => array(
+ 'this_year' => array(
+ 'title' => ts('This Year'),
+ 'operatorType' => CRM_Report_Form::OP_SELECT,
+ 'options' => $optionYear,
+ 'default' => '',
+ ),
+ 'other_year' => array(
+ 'title' => ts('Other Years'),
+ 'operatorType' => CRM_Report_Form::OP_SELECT,
+ 'options' => $optionYear,
+ 'default' => '',
+ ),
+ 'receive_date' => array('operatorType' => CRM_Report_Form::OP_DATE),
+ 'contribution_status_id' => array(
+ 'title' => ts('Contribution Status'),
+ 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
+ 'options' => CRM_Contribute_PseudoConstant::contributionStatus(),
+ 'default' => array(1),
+ ),
+ 'financial_type_id' => array(
+ 'title' => ts('Financial Type'),
+ 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
+ 'options' => CRM_Contribute_PseudoConstant::financialType(),
+ ),
+ 'total_amount' => array(
+ 'title' => ts('Contribution Amount'),
+ ),
+ 'total_sum' => array(
+ 'title' => ts('Aggregate Amount'),
+ 'type' => CRM_Report_Form::OP_INT,
+ 'dbAlias' => 'civicrm_contribution_total_amount_sum',
+ 'having' => TRUE,
+ ),
+ ),
+ ),
+ );
$this->_columns['civicrm_contribution']['fields']['civicrm_upto_' .
$this->_yearStatisticsFrom] = array(
return $rows;
}
- $sqlContribution =
- "{$this->_select} {$this->_from} WHERE {$this->_aliases['civicrm_contact']}.id IN (" .
+ $sqlContribution = "{$this->_select} {$this->_from} WHERE {$this->_aliases['civicrm_contact']}.id IN (" .
implode(',', $contactIds) .
") AND {$this->_aliases['civicrm_contribution']}.is_test = 0 {$this->_statusClause} {$this->_groupBy} ";
if (!empty($this->_relationshipColumns)) {
$addRelSelect = ', ' . implode(', ', $this->_relationshipColumns);
}
- $sqlRelationship =
- "SELECT {$this->_aliases['civicrm_relationship']}.relationship_type_id as relationship_type_id, {$this->_aliases['civicrm_relationship']}.contact_id_a as contact_id_a, {$this->_aliases['civicrm_relationship']}.contact_id_b as contact_id_b {$addRelSelect} FROM civicrm_contact {$relContactAlias} {$this->_relationshipFrom} WHERE {$relContactAlias}.id IN (" .
+ $sqlRelationship = "SELECT {$this->_aliases['civicrm_relationship']}.relationship_type_id as relationship_type_id, {$this->_aliases['civicrm_relationship']}.contact_id_a as contact_id_a, {$this->_aliases['civicrm_relationship']}.contact_id_b as contact_id_b {$addRelSelect} FROM civicrm_contact {$relContactAlias} {$this->_relationshipFrom} WHERE {$relContactAlias}.id IN (" .
implode(',', $contactIds) .
") AND {$this->_aliases['civicrm_relationship']}.is_active = 1 {$this->_relationshipWhere} GROUP BY {$this->_aliases['civicrm_relationship']}.contact_id_a, {$this->_aliases['civicrm_relationship']}.contact_id_b";
$relationshipTypes = CRM_Core_PseudoConstant::relationshipType();
/**
*/
public function __construct() {
- $logging = new CRM_Logging_Schema;
+ $logging = new CRM_Logging_Schema();
$this->tables[] = 'civicrm_contribution';
$this->tables = array_merge($this->tables, array_keys($logging->customDataLogTables()));
}
$this->_columns = array(
- 'civicrm_contact' => array(
- 'dao' => 'CRM_Contact_DAO_Contact',
- 'grouping' => 'contact-field',
- 'fields' => array(
- 'sort_name' => array(
- 'title' => ts('Donor Name'),
- 'default' => TRUE,
- 'required' => TRUE,
- ),
- 'first_name' => array(
- 'title' => ts('First Name'),
- ),
- 'last_name' => array(
- 'title' => ts('Last Name'),
- ),
- 'contact_type' => array(
- 'title' => ts('Contact Type'),
- ),
- 'contact_sub_type' => array(
- 'title' => ts('Contact Subtype'),
- ),
+ 'civicrm_contact' => array(
+ 'dao' => 'CRM_Contact_DAO_Contact',
+ 'grouping' => 'contact-field',
+ 'fields' => array(
+ 'sort_name' => array(
+ 'title' => ts('Donor Name'),
+ 'default' => TRUE,
+ 'required' => TRUE,
),
- 'filters' => array(
- 'sort_name' => array(
- 'title' => ts('Donor Name'),
- 'operator' => 'like',
- ),
+ 'first_name' => array(
+ 'title' => ts('First Name'),
+ ),
+ 'last_name' => array(
+ 'title' => ts('Last Name'),
+ ),
+ 'contact_type' => array(
+ 'title' => ts('Contact Type'),
+ ),
+ 'contact_sub_type' => array(
+ 'title' => ts('Contact Subtype'),
),
),
- 'civicrm_email' => array(
- 'dao' => 'CRM_Core_DAO_Email',
- 'grouping' => 'contact-field',
- 'fields' => array(
- 'email' => array(
- 'title' => ts('Email'),
- 'default' => TRUE,
- ),
+ 'filters' => array(
+ 'sort_name' => array(
+ 'title' => ts('Donor Name'),
+ 'operator' => 'like',
),
),
- 'civicrm_phone' => array(
- 'dao' => 'CRM_Core_DAO_Phone',
- 'grouping' => 'contact-field',
- 'fields' => array(
- 'phone' => array(
- 'title' => ts('Phone'),
- 'default' => TRUE,
- ),
+ ),
+ 'civicrm_email' => array(
+ 'dao' => 'CRM_Core_DAO_Email',
+ 'grouping' => 'contact-field',
+ 'fields' => array(
+ 'email' => array(
+ 'title' => ts('Email'),
+ 'default' => TRUE,
),
),
- )
- + $this->addAddressFields()
- + array(
- 'civicrm_contribution' => array(
- 'dao' => 'CRM_Contribute_DAO_Contribution',
- 'fields' => array(
- 'contact_id' => array(
- 'title' => ts('contactId'),
- 'no_display' => TRUE,
- 'required' => TRUE,
- 'no_repeat' => TRUE,
- ),
- 'total_amount' => array(
- 'title' => ts('Total Amount'),
- 'no_display' => TRUE,
- 'required' => TRUE,
- 'no_repeat' => TRUE,
- ),
- 'receive_date' => array(
- 'title' => ts('Year'),
- 'no_display' => TRUE,
- 'required' => TRUE,
- 'no_repeat' => TRUE,
- ),
+ ),
+ 'civicrm_phone' => array(
+ 'dao' => 'CRM_Core_DAO_Phone',
+ 'grouping' => 'contact-field',
+ 'fields' => array(
+ 'phone' => array(
+ 'title' => ts('Phone'),
+ 'default' => TRUE,
+ ),
+ ),
+ ),
+ );
+ $this->_columns += $this->addAddressFields();
+ $this->_columns += array(
+ 'civicrm_contribution' => array(
+ 'dao' => 'CRM_Contribute_DAO_Contribution',
+ 'fields' => array(
+ 'contact_id' => array(
+ 'title' => ts('contactId'),
+ 'no_display' => TRUE,
+ 'required' => TRUE,
+ 'no_repeat' => TRUE,
+ ),
+ 'total_amount' => array(
+ 'title' => ts('Total Amount'),
+ 'no_display' => TRUE,
+ 'required' => TRUE,
+ 'no_repeat' => TRUE,
),
- 'filters' => array(
- 'yid' => array(
- 'name' => 'receive_date',
- 'title' => ts('This Year'),
- 'operatorType' => CRM_Report_Form::OP_SELECT,
- 'options' => $optionYear,
- 'default' => date('Y'),
- ),
- 'financial_type_id' => array(
- 'title' => ts('Financial Type'),
- 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
- 'options' => CRM_Contribute_PseudoConstant::financialType(),
- ),
- 'contribution_status_id' => array(
- 'title' => ts('Contribution Status'),
- 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
- 'options' => CRM_Contribute_PseudoConstant::contributionStatus(),
- 'default' => array('1'),
- ),
+ 'receive_date' => array(
+ 'title' => ts('Year'),
+ 'no_display' => TRUE,
+ 'required' => TRUE,
+ 'no_repeat' => TRUE,
),
),
- );
+ 'filters' => array(
+ 'yid' => array(
+ 'name' => 'receive_date',
+ 'title' => ts('This Year'),
+ 'operatorType' => CRM_Report_Form::OP_SELECT,
+ 'options' => $optionYear,
+ 'default' => date('Y'),
+ ),
+ 'financial_type_id' => array(
+ 'title' => ts('Financial Type'),
+ 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
+ 'options' => CRM_Contribute_PseudoConstant::financialType(),
+ ),
+ 'contribution_status_id' => array(
+ 'title' => ts('Contribution Status'),
+ 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
+ 'options' => CRM_Contribute_PseudoConstant::contributionStatus(),
+ 'default' => array('1'),
+ ),
+ ),
+ ),
+ );
// If we have a campaign, build out the relevant elements
if ($campaignEnabled && !empty($this->activeCampaigns)) {
}
public function groupBy() {
- $this->_groupBy =
- "GROUP BY {$this->_aliases['civicrm_contribution']}.contact_id, " .
+ $this->_groupBy = "GROUP BY {$this->_aliases['civicrm_contribution']}.contact_id, " .
self::fiscalYearOffset($this->_aliases['civicrm_contribution'] .
'.receive_date') . " WITH ROLLUP";
$this->assign('chartSupported', TRUE);
$sql = "{$this->_select} {$this->_from} {$this->_where} {$this->_groupBy}";
}
else {
- $sql =
- "{$this->_select} {$this->_from} WHERE {$this->_aliases['civicrm_contact']}.id IN (" .
+ $sql = "{$this->_select} {$this->_from} WHERE {$this->_aliases['civicrm_contact']}.id IN (" .
implode(',', $contactIds) .
") AND {$this->_aliases['civicrm_contribution']}.is_test = 0 {$this->_statusClause} {$this->_groupBy} ";
}
foreach ($rows as $key => $row) {
$display['life_time'] = CRM_Utils_Array::value('life_time', $display) +
$row['civicrm_life_time_total'];
- $display[$previous_year] =
- CRM_Utils_Array::value($previous_year, $display) + $row[$previous_year];
+ $display[$previous_year] = CRM_Utils_Array::value($previous_year, $display) + $row[$previous_year];
}
$config = CRM_Core_Config::Singleton();
'type' => CRM_Utils_Type::T_MONEY,
'default' => TRUE,
'required' => TRUE,
- 'clause' => '
-contribution_civireport1.total_amount_count as contribution1_total_amount_count,
-contribution_civireport1.total_amount_sum as contribution1_total_amount_sum',
+ 'clause' => 'contribution_civireport1.total_amount_count as contribution1_total_amount_count, contribution_civireport1.total_amount_sum as contribution1_total_amount_sum',
),
'total_amount2' => array(
'name' => 'total_amount',
'type' => CRM_Utils_Type::T_MONEY,
'default' => TRUE,
'required' => TRUE,
- 'clause' => '
-contribution_civireport2.total_amount_count as contribution2_total_amount_count,
-contribution_civireport2.total_amount_sum as contribution2_total_amount_sum',
+ 'clause' => 'contribution_civireport2.total_amount_count as contribution2_total_amount_count, contribution_civireport2.total_amount_sum as contribution2_total_amount_sum',
),
),
'grouping' => 'contri-fields',
public function where() {
if (!$this->_amountClauseWithAND) {
- $this->_amountClauseWithAND =
- "!({$this->_aliases['civicrm_contribution']}1.total_amount_count IS NULL AND {$this->_aliases['civicrm_contribution']}2.total_amount_count IS NULL)";
+ $this->_amountClauseWithAND
+ = "!({$this->_aliases['civicrm_contribution']}1.total_amount_count IS NULL AND {$this->_aliases['civicrm_contribution']}2.total_amount_count IS NULL)";
}
$clauses = array("atleast_one_amount" => $this->_amountClauseWithAND);
//store contributions in array 'contact_sums' for comparison
$contact_sums = array();
while ($dao->fetch()) {
- $contact_sums[$dao->contact_id] =
- array(
+ $contact_sums[$dao->contact_id]
+ = array(
'contribution1_total_amount_sum' => $dao->contribution1_total_amount_sum,
'contribution2_total_amount_sum' => $dao->contribution2_total_amount_sum,
);
$count = $count2 = 0;
while ($dao->fetch()) {
if ($dao->amount) {
- $amount[] =
- CRM_Utils_Money::format($dao->amount, $dao->currency) . "(" .
+ $amount[]
+ = CRM_Utils_Money::format($dao->amount, $dao->currency) . "(" .
$dao->count . ")";
$average[] = CRM_Utils_Money::format($dao->avg, $dao->currency);
}
$count += $dao->count;
if ($dao->amount2) {
- $amount2[] =
- CRM_Utils_Money::format($dao->amount2, $dao->currency) . "(" .
+ $amount2[]
+ = CRM_Utils_Money::format($dao->amount2, $dao->currency) . "(" .
$dao->count . ")";
$average2[] = CRM_Utils_Money::format($dao->avg2, $dao->currency);
}
$rows[$uid]['change'] = ts('New Donor');
}
if ($row['contribution1_total_amount_count']) {
- $rows[$uid]['contribution1_total_amount_sum'] =
- $row['contribution1_total_amount_sum'] .
+ $rows[$uid]['contribution1_total_amount_sum']
+ = $row['contribution1_total_amount_sum'] .
" ({$row['contribution1_total_amount_count']})";
}
if ($row['contribution2_total_amount_count']) {
- $rows[$uid]['contribution2_total_amount_sum'] =
- $row['contribution2_total_amount_sum'] .
+ $rows[$uid]['contribution2_total_amount_sum']
+ = $row['contribution2_total_amount_sum'] .
" ({$row['contribution2_total_amount_count']})";
}
}
'pieChart' => 'Pie Chart',
);
- /**
- */
/**
*/
public function __construct() {
$this->_columns = array(
- 'civicrm_contact' => array(
- 'dao' => 'CRM_Contact_DAO_Contact',
- 'fields' => array(
- 'id' => array(
- 'no_display' => TRUE,
- 'required' => TRUE,
- ),
- 'display_name' => array(
- 'title' => ts('Contact Name'),
- 'required' => TRUE,
- 'no_repeat' => TRUE,
- ),
- 'first_name' => array(
- 'title' => ts('First Name'),
- ),
- 'last_name' => array(
- 'title' => ts('Last Name'),
- ),
- 'contact_type' => array(
- 'title' => ts('Contact Type'),
- ),
- 'contact_sub_type' => array(
- 'title' => ts('Contact Subtype'),
- ),
+ 'civicrm_contact' => array(
+ 'dao' => 'CRM_Contact_DAO_Contact',
+ 'fields' => array(
+ 'id' => array(
+ 'no_display' => TRUE,
+ 'required' => TRUE,
+ ),
+ 'display_name' => array(
+ 'title' => ts('Contact Name'),
+ 'required' => TRUE,
+ 'no_repeat' => TRUE,
+ ),
+ 'first_name' => array(
+ 'title' => ts('First Name'),
+ ),
+ 'last_name' => array(
+ 'title' => ts('Last Name'),
+ ),
+ 'contact_type' => array(
+ 'title' => ts('Contact Type'),
+ ),
+ 'contact_sub_type' => array(
+ 'title' => ts('Contact Subtype'),
),
),
- )
- + $this->getAddressColumns()
- + array(
- 'civicrm_contribution' => array(
- 'dao' => 'CRM_Contribute_DAO_Contribution',
- 'fields' => array(
- 'total_amount' => array(
- 'title' => ts('Amount Statistics'),
- 'required' => TRUE,
- 'statistics' => array(
- 'sum' => ts('Aggregate Amount'),
- 'count' => ts('Donations'),
- 'avg' => ts('Average'),
- ),
- ),
- 'currency' => array(
- 'required' => TRUE,
- 'no_display' => TRUE,
+ ),
+ );
+ $this->_columns += $this->getAddressColumns();
+ $this->_columns += array(
+ 'civicrm_contribution' => array(
+ 'dao' => 'CRM_Contribute_DAO_Contribution',
+ 'fields' => array(
+ 'total_amount' => array(
+ 'title' => ts('Amount Statistics'),
+ 'required' => TRUE,
+ 'statistics' => array(
+ 'sum' => ts('Aggregate Amount'),
+ 'count' => ts('Donations'),
+ 'avg' => ts('Average'),
),
),
- 'filters' => array(
- 'receive_date' => array(
- 'default' => 'this.year',
- 'operatorType' => CRM_Report_Form::OP_DATE,
- ),
- 'currency' => array(
- 'title' => 'Currency',
- 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
- 'options' => CRM_Core_OptionGroup::values('currencies_enabled'),
- 'default' => NULL,
- 'type' => CRM_Utils_Type::T_STRING,
- ),
- 'total_range' => array(
- 'title' => ts('Show no. of Top Donors'),
- 'type' => CRM_Utils_Type::T_INT,
- 'default_op' => 'eq',
- ),
- 'financial_type_id' => array(
- 'name' => 'financial_type_id',
- 'title' => ts('Financial Type'),
- 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
- 'options' => CRM_Contribute_PseudoConstant::financialType(),
- ),
- 'contribution_status_id' => array(
- 'title' => ts('Contribution Status'),
- 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
- 'options' => CRM_Contribute_PseudoConstant::contributionStatus(),
- 'default' => array(1),
- ),
+ 'currency' => array(
+ 'required' => TRUE,
+ 'no_display' => TRUE,
),
),
- 'civicrm_email' => array(
- 'dao' => 'CRM_Core_DAO_Email',
- 'fields' => array(
- 'email' => array(
- 'title' => ts('Email'),
- 'default' => TRUE,
- 'no_repeat' => TRUE,
- ),
+ 'filters' => array(
+ 'receive_date' => array(
+ 'default' => 'this.year',
+ 'operatorType' => CRM_Report_Form::OP_DATE,
+ ),
+ 'currency' => array(
+ 'title' => 'Currency',
+ 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
+ 'options' => CRM_Core_OptionGroup::values('currencies_enabled'),
+ 'default' => NULL,
+ 'type' => CRM_Utils_Type::T_STRING,
+ ),
+ 'total_range' => array(
+ 'title' => ts('Show no. of Top Donors'),
+ 'type' => CRM_Utils_Type::T_INT,
+ 'default_op' => 'eq',
+ ),
+ 'financial_type_id' => array(
+ 'name' => 'financial_type_id',
+ 'title' => ts('Financial Type'),
+ 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
+ 'options' => CRM_Contribute_PseudoConstant::financialType(),
+ ),
+ 'contribution_status_id' => array(
+ 'title' => ts('Contribution Status'),
+ 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
+ 'options' => CRM_Contribute_PseudoConstant::contributionStatus(),
+ 'default' => array(1),
),
- 'grouping' => 'email-fields',
),
- 'civicrm_phone' => array(
- 'dao' => 'CRM_Core_DAO_Phone',
- 'fields' => array(
- 'phone' => array(
- 'title' => ts('Phone'),
- 'default' => TRUE,
- 'no_repeat' => TRUE,
- ),
+ ),
+ 'civicrm_email' => array(
+ 'dao' => 'CRM_Core_DAO_Email',
+ 'fields' => array(
+ 'email' => array(
+ 'title' => ts('Email'),
+ 'default' => TRUE,
+ 'no_repeat' => TRUE,
+ ),
+ ),
+ 'grouping' => 'email-fields',
+ ),
+ 'civicrm_phone' => array(
+ 'dao' => 'CRM_Core_DAO_Phone',
+ 'fields' => array(
+ 'phone' => array(
+ 'title' => ts('Phone'),
+ 'default' => TRUE,
+ 'no_repeat' => TRUE,
),
- 'grouping' => 'phone-fields',
),
- );
+ 'grouping' => 'phone-fields',
+ ),
+ );
$this->_groupFilter = TRUE;
$this->_tagFilter = TRUE;
foreach ($rows as $key => $value) {
if ($value['civicrm_event_id']) {
$graphRows['totalParticipants'][] = ($rows[$key]['civicrm_line_item_participant_count_count']);
- $graphRows[$this->_interval][] =
- substr($rows[$key]['civicrm_event_title'], 0, 12) . "..(" .
+ $graphRows[$this->_interval][] = substr($rows[$key]['civicrm_event_title'], 0, 12) . "..(" .
$rows[$key]['civicrm_event_id'] . ") ";
$graphRows['value'][] = ($rows[$key]['civicrm_line_item_participant_count_count']);
}
// If we have active campaigns add those elements to both the fields and filters
if ($campaignEnabled && !empty($this->activeCampaigns)) {
- $this->_columns['civicrm_participant']['fields']['campaign_id'] =
- array(
- 'title' => ts('Campaign'),
- 'default' => 'false',
- );
- $this->_columns['civicrm_participant']['filters']['campaign_id'] =
- array(
- 'title' => ts('Campaign'),
- 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
- 'options' => $this->activeCampaigns,
- );
- $this->_columns['civicrm_participant']['order_bys']['campaign_id'] =
- array('title' => ts('Campaign'));
-
+ $this->_columns['civicrm_participant']['fields']['campaign_id'] = array(
+ 'title' => ts('Campaign'),
+ 'default' => 'false',
+ );
+ $this->_columns['civicrm_participant']['filters']['campaign_id'] = array(
+ 'title' => ts('Campaign'),
+ 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
+ 'options' => $this->activeCampaigns,
+ );
+ $this->_columns['civicrm_participant']['order_bys']['campaign_id'] = array(
+ 'title' => ts('Campaign'),
+ );
}
$this->_currencyColumn = 'civicrm_participant_fee_currency';
}
/**
+ * Searches database for priceset values.
+ *
* @return array
*/
public function getPriceLevels() {
}
return $elements;
- } //searches database for priceset values
-
+ }
public function preProcess() {
parent::preProcess();
$this->_where = "WHERE {$this->_aliases['civicrm_participant']}.is_test = 0 ";
}
else {
- $this->_where =
- "WHERE {$this->_aliases['civicrm_participant']}.is_test = 0 AND " .
+ $this->_where = "WHERE {$this->_aliases['civicrm_participant']}.is_test = 0 AND " .
implode(' AND ', $clauses);
}
if ($this->_aclWhere) {
return $participant_info;
}
- //build header for table
+ /**
+ * Build header for table.
+ */
public function buildColumnHeaders() {
-
$this->_columnHeaders = array();
foreach ($this->_columns as $tableName => $table) {
if (array_key_exists('fields', $table)) {
if (!empty($this->_params['charts'])) {
foreach ($rows as $key => $value) {
$graphRows['totalAmount'][] = $graphRows['value'][] = CRM_Utils_Array::value('totalAmount', $rows[$key]);
- $graphRows[$this->_interval][] =
- substr($rows[$key]['civicrm_event_title'], 0, 12) . "..(" .
+ $graphRows[$this->_interval][] = substr($rows[$key]['civicrm_event_title'], 0, 12) . "..(" .
$rows[$key]['civicrm_event_id'] . ") ";
}
// are grouped together across price sets but there may be a separate need to group
// by id so that entries in one price set are distinct from others. Not quite sure what
// to call the distinction for end users benefit
- array(
- 'price_field_value_label' => array(
- 'title' => ts('Price Field Value Label'),
- 'name' => 'label',
- ),
+ array(
+ 'price_field_value_label' => array(
+ 'title' => ts('Price Field Value Label'),
+ 'name' => 'label',
),
+ ),
),
);
}
'filters' => array(
'id' => array(
'title' => ts('Contact ID'),
- )
- ,
+ ),
'sort_name' => array(
'title' => ts('Contact Name'),
),
*/
public function alterNickName($value, &$row) {
if (empty($row['civicrm_contact_id'])) {
- return;
+ return NULL;
}
$contactID = $row['civicrm_contact_id'];
return "<div id=contact-{$contactID} class='crm-entity'>
*/
public function alterParticipantStatus($value) {
if (empty($value)) {
- return;
+ return NULL;
}
return CRM_Event_PseudoConstant::participantStatus($value, FALSE, 'label');
}
*/
public function alterParticipantRole($value) {
if (empty($value)) {
- return;
+ return NULL;
}
$roles = explode(CRM_Core_DAO::VALUE_SEPARATOR, $value);
$value = array();
* @param $awardedGrantsAmount
* @param bool $customData
*/
- static function getStatistics(
+ public static function getStatistics(
&$grantStatistics, $fieldValue, $values,
$awardedGrants, $awardedGrantsAmount, $customData = FALSE
) {
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2014
* $Id$
- *
*/
class CRM_Report_Form_Membership_Summary extends CRM_Report_Form {
);
/**
- */
- /**
+ * Constructor function.
*/
public function __construct() {
// UI for selecting columns to appear in the report list
- // array conatining the columns, group_bys and filters build and provided to Form
+ // array containing the columns, group_bys and filters build and provided to Form
$this->_columns = array(
'civicrm_contact' => array(
'dao' => 'CRM_Contact_DAO_Contact',
parent::__construct();
}
+ /**
+ * Pre-process function.
+ */
public function preProcess() {
$this->assign('reportTitle', ts('Membership Summary Report'));
parent::preProcess();
}
/**
+ * Set default values.
+ *
* @return array
+ * Default values.
*/
public function setDefaultValues() {
return parent::setDefaultValues();
}
+ /**
+ * Generate select clause.
+ */
public function select() {
$select = array();
$this->_columnHeaders = array();
}
/**
+ * Set form rules.
+ *
* @param $fields
* @param $files
* @param $self
LEFT JOIN civicrm_contribution {$this->_aliases['civicrm_contribution']}
ON {$this->_aliases['civicrm_membership']}.contact_id = {$this->_aliases['civicrm_contribution']}.contact_id
";
- // include address field if address column is to be included
+ // Include address table if address column is to be included.
if ($this->_addressField) {
$this->_from .= "LEFT JOIN civicrm_address {$this->_aliases['civicrm_address']} ON {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_address']}.contact_id AND {$this->_aliases['civicrm_address']}.is_primary = 1\n";
}
- // include email field if email column is to be included
+ // Include email table if email column is to be included.
if ($this->_emailField) {
$this->_from .= "LEFT JOIN civicrm_email {$this->_aliases['civicrm_email']} ON {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_email']}.contact_id AND {$this->_aliases['civicrm_email']}.is_primary = 1\n";
}
}
/**
- * @param $rows
+ * Generate statistics (bottom section of the report).
+ *
+ * @param array $rows
*
* @return array
*/
}
/**
- * @param $rows
+ * Make changes to how data is displayed.
+ *
+ * @param array $rows
*/
public function alterDisplay(&$rows) {
// custom code to alter rows
if (array_key_exists('civicrm_contact_sort_name', $row) &&
array_key_exists('civicrm_contact_id', $row)
) {
- $url = CRM_Utils_System::url('civicrm/report/member/detail',
+ $url = CRM_Utils_System::url(
+ 'civicrm/report/member/detail',
'reset=1&force=1&id_op=eq&id_value=' . $row['civicrm_contact_id'],
$this->_absoluteUrl
);
- $rows[$rowNum]['civicrm_contact_sort_name'] =
- "<a href='$url'>" . $row["civicrm_contact_sort_name"] . '</a>';
+ $rows[$rowNum]['civicrm_contact_sort_name']
+ = "<a href='$url'>" . $row["civicrm_contact_sort_name"] . '</a>';
$entryFound = TRUE;
}
}
$this->_columns = array(
- 'civicrm_contact' => array(
- 'dao' => 'CRM_Contact_DAO_Contact',
- 'fields' => array(
- 'sort_name' => array(
- 'title' => ts('Contact Name'),
- 'required' => TRUE,
- 'no_repeat' => TRUE,
- ),
+ 'civicrm_contact' => array(
+ 'dao' => 'CRM_Contact_DAO_Contact',
+ 'fields' => array(
+ 'sort_name' => array(
+ 'title' => ts('Contact Name'),
+ 'required' => TRUE,
+ 'no_repeat' => TRUE,
),
- 'filters' => array(
- 'sort_name' => array('title' => ts('Contact Name')),
- 'id' => array('no_display' => TRUE),
- ),
- 'grouping' => 'contact-fields',
),
- 'civicrm_email' => array(
- 'dao' => 'CRM_Core_DAO_Email',
- 'fields' => array(
- 'email' => array('no_repeat' => TRUE),
- ),
- 'grouping' => 'contact-fields',
+ 'filters' => array(
+ 'sort_name' => array('title' => ts('Contact Name')),
+ 'id' => array('no_display' => TRUE),
+ ),
+ 'grouping' => 'contact-fields',
+ ),
+ 'civicrm_email' => array(
+ 'dao' => 'CRM_Core_DAO_Email',
+ 'fields' => array(
+ 'email' => array('no_repeat' => TRUE),
),
- 'civicrm_pledge' => array(
- 'dao' => 'CRM_Pledge_DAO_Pledge',
- 'fields' => array(
- 'id' => array(
- 'no_display' => TRUE,
- 'required' => TRUE,
- ),
- 'contact_id' => array(
- 'no_display' => TRUE,
- 'required' => TRUE,
- ),
- 'amount' => array(
- 'title' => ts('Pledge Amount'),
- 'required' => TRUE,
- 'type' => CRM_Utils_Type::T_MONEY,
- ),
- 'currency' => array(
- 'required' => TRUE,
- 'no_display' => TRUE,
- ),
- 'frequency_unit' => array(
- 'title' => ts('Frequency Unit'),
- ),
- 'installments' => array(
- 'title' => ts('Installments'),
- ),
- 'pledge_create_date' => array(
- 'title' => ts('Pledge Made Date'),
- ),
- 'start_date' => array(
- 'title' => ts('Pledge Start Date'),
- 'type' => CRM_Utils_Type::T_DATE,
- ),
- 'end_date' => array(
- 'title' => ts('Pledge End Date'),
- 'type' => CRM_Utils_Type::T_DATE,
- ),
- 'status_id' => array(
- 'title' => ts('Pledge Status'),
- 'required' => TRUE,
- ),
+ 'grouping' => 'contact-fields',
+ ),
+ 'civicrm_pledge' => array(
+ 'dao' => 'CRM_Pledge_DAO_Pledge',
+ 'fields' => array(
+ 'id' => array(
+ 'no_display' => TRUE,
+ 'required' => TRUE,
),
- 'filters' => array(
- 'pledge_create_date' => array(
- 'title' => 'Pledge Made Date',
- 'operatorType' => CRM_Report_Form::OP_DATE,
- ),
- 'pledge_amount' => array(
- 'title' => ts('Pledged Amount'),
- 'operatorType' => CRM_Report_Form::OP_INT,
- ),
- 'currency' => array(
- 'title' => 'Currency',
- 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
- 'options' => CRM_Core_OptionGroup::values('currencies_enabled'),
- 'default' => NULL,
- 'type' => CRM_Utils_Type::T_STRING,
- ),
- 'sid' => array(
- 'name' => 'status_id',
- 'title' => ts('Pledge Status'),
- 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
- 'options' => CRM_Core_OptionGroup::values('contribution_status'),
- ),
-
+ 'contact_id' => array(
+ 'no_display' => TRUE,
+ 'required' => TRUE,
+ ),
+ 'amount' => array(
+ 'title' => ts('Pledge Amount'),
+ 'required' => TRUE,
+ 'type' => CRM_Utils_Type::T_MONEY,
+ ),
+ 'currency' => array(
+ 'required' => TRUE,
+ 'no_display' => TRUE,
+ ),
+ 'frequency_unit' => array(
+ 'title' => ts('Frequency Unit'),
+ ),
+ 'installments' => array(
+ 'title' => ts('Installments'),
+ ),
+ 'pledge_create_date' => array(
+ 'title' => ts('Pledge Made Date'),
+ ),
+ 'start_date' => array(
+ 'title' => ts('Pledge Start Date'),
+ 'type' => CRM_Utils_Type::T_DATE,
+ ),
+ 'end_date' => array(
+ 'title' => ts('Pledge End Date'),
+ 'type' => CRM_Utils_Type::T_DATE,
+ ),
+ 'status_id' => array(
+ 'title' => ts('Pledge Status'),
+ 'required' => TRUE,
),
),
- 'civicrm_pledge_payment' => array(
- 'dao' => 'CRM_Pledge_DAO_PledgePayment',
- 'fields' => array(
- 'total_paid' => array(
- 'title' => ts('Total Amount Paid'),
- 'type' => CRM_Utils_Type::T_MONEY,
- ),
- 'balance_due' => array(
- 'title' => ts('Balance Due'),
- 'default' => TRUE,
- 'type' => CRM_Utils_Type::T_MONEY,
- ),
+ 'filters' => array(
+ 'pledge_create_date' => array(
+ 'title' => 'Pledge Made Date',
+ 'operatorType' => CRM_Report_Form::OP_DATE,
+ ),
+ 'pledge_amount' => array(
+ 'title' => ts('Pledged Amount'),
+ 'operatorType' => CRM_Report_Form::OP_INT,
+ ),
+ 'currency' => array(
+ 'title' => 'Currency',
+ 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
+ 'options' => CRM_Core_OptionGroup::values('currencies_enabled'),
+ 'default' => NULL,
+ 'type' => CRM_Utils_Type::T_STRING,
+ ),
+ 'sid' => array(
+ 'name' => 'status_id',
+ 'title' => ts('Pledge Status'),
+ 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
+ 'options' => CRM_Core_OptionGroup::values('contribution_status'),
+ ),
+ ),
+ ),
+ 'civicrm_pledge_payment' => array(
+ 'dao' => 'CRM_Pledge_DAO_PledgePayment',
+ 'fields' => array(
+ 'total_paid' => array(
+ 'title' => ts('Total Amount Paid'),
+ 'type' => CRM_Utils_Type::T_MONEY,
+ ),
+ 'balance_due' => array(
+ 'title' => ts('Balance Due'),
+ 'default' => TRUE,
+ 'type' => CRM_Utils_Type::T_MONEY,
),
),
- )
- + $this->getAddressColumns(array('group_by' => FALSE))
- + $this->getPhoneColumns();
+ ),
+ );
+
+ $this->_columns += $this->getAddressColumns(array('group_by' => FALSE)) + $this->getPhoneColumns();
+
// If we have a campaign, build out the relevant elements
$this->_tagFilter = TRUE;
if ($campaignEnabled && !empty($this->activeCampaigns)) {
*/
public function __construct() {
$this->_columns = array(
- 'civicrm_contact' => array(
- 'dao' => 'CRM_Contact_DAO_Contact',
- 'fields' => array(
- 'sort_name' => array(
- 'title' => ts('Contact Name'),
- 'no_repeat' => TRUE,
- ),
- 'postal_greeting_display' => array('title' => ts('Postal Greeting')),
- 'id' => array(
- 'no_display' => TRUE,
- 'required' => TRUE,
- ),
+ 'civicrm_contact' => array(
+ 'dao' => 'CRM_Contact_DAO_Contact',
+ 'fields' => array(
+ 'sort_name' => array(
+ 'title' => ts('Contact Name'),
+ 'no_repeat' => TRUE,
),
- 'grouping' => 'contact-fields',
- 'group_bys' => array(
- 'id' => array('title' => ts('Contact ID')),
- 'sort_name' => array(
- 'title' => ts('Contact Name'),
- ),
+ 'postal_greeting_display' => array('title' => ts('Postal Greeting')),
+ 'id' => array(
+ 'no_display' => TRUE,
+ 'required' => TRUE,
),
),
- 'civicrm_email' => array(
- 'dao' => 'CRM_Core_DAO_Email',
- 'fields' => array(
- 'email' => array(
- 'no_repeat' => TRUE,
- 'title' => ts('email'),
- ),
+ 'grouping' => 'contact-fields',
+ 'group_bys' => array(
+ 'id' => array('title' => ts('Contact ID')),
+ 'sort_name' => array(
+ 'title' => ts('Contact Name'),
),
- 'grouping' => 'contact-fields',
),
- 'civicrm_pledge' => array(
- 'dao' => 'CRM_Pledge_DAO_Pledge',
- 'fields' => array(
- 'id' => array(
- 'no_display' => TRUE,
- 'required' => FALSE,
- ),
- 'currency' => array(
- 'required' => TRUE,
- 'no_display' => TRUE,
- ),
- 'amount' => array(
- 'title' => ts('Pledge Amount'),
- 'required' => TRUE,
- 'type' => CRM_Utils_Type::T_MONEY,
- 'statistics' => array(
- 'sum' => ts('Aggregate Amount Pledged'),
- 'count' => ts('Pledges'),
- 'avg' => ts('Average'),
- ),
- ),
- 'frequency_unit' => array(
- 'title' => ts('Frequency Unit'),
- ),
- 'installments' => array(
- 'title' => ts('Installments'),
- ),
- 'pledge_create_date' => array(
- 'title' => ts('Pledge Made Date'),
- ),
- 'start_date' => array(
- 'title' => ts('Pledge Start Date'),
- 'type' => CRM_Utils_Type::T_DATE,
- ),
- 'end_date' => array(
- 'title' => ts('Pledge End Date'),
- 'type' => CRM_Utils_Type::T_DATE,
- ),
- 'status_id' => array(
- 'title' => ts('Pledge Status'),
- ),
+ ),
+ 'civicrm_email' => array(
+ 'dao' => 'CRM_Core_DAO_Email',
+ 'fields' => array(
+ 'email' => array(
+ 'no_repeat' => TRUE,
+ 'title' => ts('email'),
),
- 'filters' => array(
- 'pledge_create_date' => array(
- 'title' => 'Pledge Made Date',
- 'operatorType' => CRM_Report_Form::OP_DATE,
- ),
- 'pledge_amount' => array(
- 'title' => ts('Pledged Amount'),
- 'operatorType' => CRM_Report_Form::OP_INT,
- ),
- 'currency' => array(
- 'title' => 'Currency',
- 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
- 'options' => CRM_Core_OptionGroup::values('currencies_enabled'),
- 'default' => NULL,
- 'type' => CRM_Utils_Type::T_STRING,
- ),
- 'sid' => array(
- 'name' => 'status_id',
- 'title' => ts('Pledge Status'),
- 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
- 'options' => CRM_Core_OptionGroup::values('contribution_status'),
- ),
+ ),
+ 'grouping' => 'contact-fields',
+ ),
+ 'civicrm_pledge' => array(
+ 'dao' => 'CRM_Pledge_DAO_Pledge',
+ 'fields' => array(
+ 'id' => array(
+ 'no_display' => TRUE,
+ 'required' => FALSE,
),
- 'group_bys' => array(
- 'pledge_create_date' => array(
- 'frequency' => TRUE,
- 'default' => TRUE,
- 'chart' => TRUE,
- ),
- 'frequency_unit' => array(
- 'title' => ts('Frequency Unit'),
- ),
- 'status_id' => array(
- 'title' => ts('Pledge Status'),
+ 'currency' => array(
+ 'required' => TRUE,
+ 'no_display' => TRUE,
+ ),
+ 'amount' => array(
+ 'title' => ts('Pledge Amount'),
+ 'required' => TRUE,
+ 'type' => CRM_Utils_Type::T_MONEY,
+ 'statistics' => array(
+ 'sum' => ts('Aggregate Amount Pledged'),
+ 'count' => ts('Pledges'),
+ 'avg' => ts('Average'),
),
),
+ 'frequency_unit' => array(
+ 'title' => ts('Frequency Unit'),
+ ),
+ 'installments' => array(
+ 'title' => ts('Installments'),
+ ),
+ 'pledge_create_date' => array(
+ 'title' => ts('Pledge Made Date'),
+ ),
+ 'start_date' => array(
+ 'title' => ts('Pledge Start Date'),
+ 'type' => CRM_Utils_Type::T_DATE,
+ ),
+ 'end_date' => array(
+ 'title' => ts('Pledge End Date'),
+ 'type' => CRM_Utils_Type::T_DATE,
+ ),
+ 'status_id' => array(
+ 'title' => ts('Pledge Status'),
+ ),
),
- 'civicrm_pledge_payment' => array(
- 'dao' => 'CRM_Pledge_DAO_PledgePayment',
- 'fields' => array(
- 'total_paid' => array(
- 'title' => ts('Total Amount Paid'),
- 'type' => CRM_Utils_Type::T_STRING,
- 'dbAlias' => 'sum(pledge_payment_civireport.actual_amount)',
- ),
+ 'filters' => array(
+ 'pledge_create_date' => array(
+ 'title' => 'Pledge Made Date',
+ 'operatorType' => CRM_Report_Form::OP_DATE,
+ ),
+ 'pledge_amount' => array(
+ 'title' => ts('Pledged Amount'),
+ 'operatorType' => CRM_Report_Form::OP_INT,
+ ),
+ 'currency' => array(
+ 'title' => 'Currency',
+ 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
+ 'options' => CRM_Core_OptionGroup::values('currencies_enabled'),
+ 'default' => NULL,
+ 'type' => CRM_Utils_Type::T_STRING,
+ ),
+ 'sid' => array(
+ 'name' => 'status_id',
+ 'title' => ts('Pledge Status'),
+ 'operatorType' => CRM_Report_Form::OP_MULTISELECT,
+ 'options' => CRM_Core_OptionGroup::values('contribution_status'),
+ ),
+ ),
+ 'group_bys' => array(
+ 'pledge_create_date' => array(
+ 'frequency' => TRUE,
+ 'default' => TRUE,
+ 'chart' => TRUE,
+ ),
+ 'frequency_unit' => array(
+ 'title' => ts('Frequency Unit'),
+ ),
+ 'status_id' => array(
+ 'title' => ts('Pledge Status'),
+ ),
+ ),
+ ),
+ 'civicrm_pledge_payment' => array(
+ 'dao' => 'CRM_Pledge_DAO_PledgePayment',
+ 'fields' => array(
+ 'total_paid' => array(
+ 'title' => ts('Total Amount Paid'),
+ 'type' => CRM_Utils_Type::T_STRING,
+ 'dbAlias' => 'sum(pledge_payment_civireport.actual_amount)',
),
),
- ) + $this->addAddressFields();
+ ),
+ ) + $this->addAddressFields();
$this->_groupFilter = TRUE;
$this->_tagFilter = TRUE;
* Retrieve all the values that match the current input parameters
* Used by the selector
*/
- function all(
+ public function all(
$offset = 0, $rowcount = 0, $sort = NULL,
$includeContactIDs = FALSE
);
* Name of component if report list is filtered
*
* @var string
- **/
+ */
protected $_compName = NULL;
/**
* ID of component if report list is filtered
*
* @var int
- **/
+ */
protected $_compID = NULL;
/**
* ID of grouping if report list is filtered
*
* @var int
- **/
+ */
protected $_grouping = NULL;
/**
* ID of parent report template if list is filtered by template
*
* @var int
- **/
+ */
protected $_ovID = NULL;
-
/**
* Title of parent report template if list is filtered by template
*
* @var string
- **/
+ */
protected $_title = NULL;
/**
/**
* 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, NULL, FALSE, TRUE);
CRM_Core_BAO_File::uploadNames()
);
- $config = CRM_Core_Config::singleton();
- $this->addActions($config->uploadDir,
+ $this->addActions(CRM_Core_Config::singleton()->uploadDir,
$uploadNames
);
}
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2014
* $Id: $
- *
*/
/**
- *
+ * SMS Form.
*/
class CRM_SMS_Form_Provider extends CRM_Core_Form {
protected $_id = NULL;
}
/**
- * Build the form object
- *
- * @return void
+ * Build the form object.
*/
public function buildQuickForm() {
parent::buildQuickForm();
$this->addRule('title', ts('This Title already exists in Database.'), 'objectExists', array(
'CRM_SMS_DAO_Provider',
- $this->_id
+ $this->_id,
));
$this->add('text', 'username', ts('Username'),
}
/**
- * This virtual function is used to set the default values of
- * various form elements
- *
- * access public
+ * Set the default values of various form elements.
*
- * @return array
- * reference to the array of default values
- */
- /**
* @return array
*/
public function setDefaultValues() {
$dao = new CRM_SMS_DAO_Provider();
$dao->id = $this->_id;
- if ($name)
+ if ($name) {
$dao->name = $name;
+ }
if (!$dao->find(TRUE)) {
return $defaults;
}
/**
- * Process the form submission
- *
- *
- * @return void
+ * Process the form submission.
*/
public function postProcess() {
* @param object $controller
* @param \const|int $action
*
- * @internal param \CRM_SMS_Controller $object
* @return \CRM_SMS_StateMachine_Send CRM_SMS_StateMachine
*/
public function __construct($controller, $action = CRM_Core_Action::NONE) {
$defaultLocation = $this->_location_types[$defaultLocationType->id];
unset($this->_location_types[$defaultLocationType->id]);
$this->_location_types = array(
- $defaultLocationType->id => $defaultLocation
+ $defaultLocationType->id => $defaultLocation,
) + $this->_location_types;
}
$showBestResult = FALSE;
if (in_array($ufField->field_name, array(
'country',
- 'state_province'
+ 'state_province',
)) && count($config->countryLimit) > 1
) {
// get state or country field weight if exists
'Participant',
'Contribution',
'Membership',
- 'Activity'
+ 'Activity',
))) {
$individualSubTypes = CRM_Contact_BAO_ContactType::subTypes('Individual');
foreach ($groupType as $value) {
* @param array $errors
* Collect errors.
*
- * @return Array
+ * @return array
* list of errors to be posted back to the form
*/
public static function formRuleCustomDataExtentColumnValue($customField, $gid, $fieldType, &$errors) {
'Contribution',
'Membership',
'Activity',
- 'Case'
+ 'Case',
))) {
$params = array('id' => $customField->custom_group_id);
$customGroup = array();
'Contribution',
'Participant',
'Membership',
- 'Activity'
+ 'Activity',
))
) {
$errors['in_selector'] = ts("'In Selector' cannot be checked for %1 fields.", array(1 => $entityName));
if ($fieldType != $profileType) {
$errors['field_name'] = ts('Cannot add or update profile field type "%1" with combination of "%2".', array(
1 => $fieldType,
- 2 => $profileType
+ 2 => $profileType,
));
}
}
) {
$errors['field_name'] = ts('Cannot add or update profile field type "%1" with combination of "%2".', array(
1 => $fieldType,
- 2 => $profileType
+ 2 => $profileType,
));
}
}
*
* @return array
*/
- function &actionLinks() {
+ public function &actionLinks() {
if (!isset(self::$_actionLinks)) {
self::$_actionLinks = array(
CRM_Core_Action::UPDATE => array(
if (in_array($fieldName, $locationFields)) {
$result['schema'][$fieldName]['civiIsLocation'] = TRUE;
}
- if (in_array($fieldName, array('phone', 'phone_and_ext'))) { // FIXME what about phone_ext?
+ if (in_array($fieldName, array('phone', 'phone_and_ext'))) {
+ // FIXME what about phone_ext?
$result['schema'][$fieldName]['civiIsPhone'] = TRUE;
}
}
* @param string $method
* @param null|string $name
*/
- function __construct(
+ public function __construct(
$state = NULL,
$action = CRM_Core_Action::NONE,
$method = 'post',
if ($upgrade->checkVersionRelease($rev, 'alpha1')) {
if (!(is_callable(array(
$versionObject,
- 'verifyPreDBstate'
+ 'verifyPreDBstate',
)))
) {
CRM_Core_Error::fatal("verifyPreDBstate method was not found for $rev");
if (is_callable(array(
$versionObject,
- $phpFunctionName
+ $phpFunctionName,
))) {
$versionObject->$phpFunctionName($rev, $originalVer, $latestVer);
}
// set post-upgrade-message if any
if (is_callable(array(
$versionObject,
- 'setPostUpgradeMessage'
+ 'setPostUpgradeMessage',
))) {
$postUpgradeMessage = file_get_contents($postUpgradeMessageFile);
$versionObject->setPostUpgradeMessage($postUpgradeMessage, $rev);
$versionObject = $this->incrementalPhpObject($rev);
if (is_callable(array(
$versionObject,
- 'setPreUpgradeMessage'
+ 'setPreUpgradeMessage',
))) {
$versionObject->setPreUpgradeMessage($preUpgradeMessage, $rev, $currentVer);
}
}
}
// Drop index UI_title for civicrm_price_set
- $domain = new CRM_Core_DAO_Domain;
+ $domain = new CRM_Core_DAO_Domain();
$domain->find(TRUE);
if ($domain->locales) {
$locales = explode(CRM_Core_DAO::VALUE_SEPARATOR, $domain->locales);
$dao = CRM_Core_DAO::executeQuery($query);
if (!$dao->N) {
- $domain = new CRM_Core_DAO_Domain;
+ $domain = new CRM_Core_DAO_Domain();
$domain->find(TRUE);
if ($domain->locales) {
$addTo[2] = $dao->contribution_page_id;
$options = array(
'otherAmount' => $dao->is_allow_other_amount,
- 'membership' => $dao->membership_block_id
+ 'membership' => $dao->membership_block_id,
);
self::createPriceSet($daoName, $addTo, $options);
}
'2' => array('membership_amount', 'String'),
'3' => array(
CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $result->membership_id, 'membership_type_id'),
- 'Integer'
+ 'Integer',
),
);
$res = CRM_Core_DAO::executeQuery($sql, $params);
if (!empty($defaults)) {
$lineParams['price_field_id'] = $defaults['id'];
$lineParams['label'] = $defaults['label'];
- $lineParams['price_field_value_id'] =
- CRM_Core_DAO::getFieldValue('CRM_Upgrade_Snapshot_V4p2_Price_DAO_FieldValue', $defaults['id'], 'id', 'price_field_id');
+ $lineParams['price_field_value_id']
+ = CRM_Core_DAO::getFieldValue('CRM_Upgrade_Snapshot_V4p2_Price_DAO_FieldValue', $defaults['id'], 'id', 'price_field_id');
}
else {
- $lineParams['price_field_id'] =
- CRM_Core_DAO::getFieldValue('CRM_Upgrade_Snapshot_V4p2_Price_DAO_Field', $priceSetId, 'id', 'price_set_id');
+ $lineParams['price_field_id']
+ = CRM_Core_DAO::getFieldValue('CRM_Upgrade_Snapshot_V4p2_Price_DAO_Field', $priceSetId, 'id', 'price_set_id');
$lineParams['label'] = 'Contribution Amount';
}
$lineParams['qty'] = 1;
$dao->start_date,
$dao->end_date,
$memStatus,
- $status
+ $status,
);
}
}
--- /dev/null
+{* file to handle db changes in 4.6.alpha3 during upgrade *}
$label = ts('Additional Contribution');
$useRequired = 0;
}
- elseif (!empty($fieldOptions[$optionKey]['label'])) { //check for label.
+ elseif (!empty($fieldOptions[$optionKey]['label'])) {
$label = $fieldOptions[$optionKey]['label'];
}
}
}
$element = &$qf->add('select', $elementName, $label,
- array(
- '' => ts('- select -')
- ) + $selectOption,
+ array('' => ts('- select -')) + $selectOption,
$useRequired && $field->is_required,
array('price' => json_encode($priceVal))
);
$dao = CRM_Core_DAO::executeQuery($query, array(
1 => array($optionGroupName, 'String'),
- 2 => array($optionLabel, 'String')
+ 2 => array($optionLabel, 'String'),
));
while ($dao->fetch()) {
* @param int $id
* Field Id.
*
- * @return boolean
- *
+ * @return mixed
+ * Boolean-ish
*/
public static function deleteField($id) {
$field = new CRM_Upgrade_Snapshot_V4p2_Price_DAO_Field();
* Validate the priceset
*
* @param int $priceSetId
- * , array $fields.
- *
- * retrun the error string
- *
- * @param $fields
- * @param $error
- *
+ * @param array $fields
+ * @param array $error
*/
-
public static function priceSetValidation($priceSetId, $fields, &$error) {
// check for at least one positive
// amount price field should be selected.
* @param int $id
* Price Set id.
*
- * @return boolean
+ * @return bool
* false if fields exist for this set, true if the
* set could be deleted
*
*
* @return void
*/
- static function buildPriceSet(&$form) {
+ public static function buildPriceSet(&$form) {
$priceSetId = $form->get('priceSetId');
$userid = $form->getVar('_userID');
if (!$priceSetId) {
$className = CRM_Utils_System::getClassName($form);
if (in_array($className, array(
'CRM_Contribute_Form_Contribution',
- 'CRM_Member_Form_Membership'
+ 'CRM_Member_Form_Membership',
))) {
$validFieldsOnly = FALSE;
}
* check the current Membership
* having end date null.
*/
- static function checkCurrentMembership(&$options, $userid) {
+ public static function checkCurrentMembership(&$options, $userid) {
if (!$userid || empty($options)) {
return;
}
*
* @return array
*/
- static function setDefaultPriceSet(&$form, &$defaults) {
+ public static function setDefaultPriceSet(&$form, &$defaults) {
if (!isset($form->_priceSet) || empty($form->_priceSet['fields'])) {
return $defaults;
}
/**
* Get field ids of a price set
*
- * @param int id Price Set id
+ * @param int $id Price Set id
*
* @return array
* Array of the field ids
*
* @return CRM_Upgrade_Snapshot_V4p2_Price_DAO_Field
*/
- static function copy($id) {
+ public static function copy($id) {
$maxId = CRM_Core_DAO::singleValueQuery("SELECT max(id) FROM civicrm_price_set");
$title = ts('[Copy id %1]', array(1 => $maxId + 1));
*
* @return bool
*/
- function checkPermission($sid) {
+ public function checkPermission($sid) {
if ($sid &&
self::eventPriceSetDomainID()
) {
}
/**
- * @param $values
+ * @param array $values
* @param bool $castToString
- *
- * @return mixed|void
*/
public function decodeOutput(&$values, $castToString = FALSE) {
if (is_array($values)) {
* @param array $array
* (optional) Array to be checked for emptiness.
*
- * @return boolean
+ * @return bool
* True if the array is empty.
*/
public static function crmIsEmptyArray($array = array()) {
* @return array
* Each item is a distinct combination of values from $dimensions.
*
- * For example, the product of
- * {
+ * For example, the product of
+ * {
* fg => {red, blue},
* bg => {white, black}
- * }
- * would be
- * {
+ * }
+ * would be
+ * {
* {fg => red, bg => white},
* {fg => red, bg => black},
* {fg => blue, bg => white},
* {fg => blue, bg => black}
- * }
+ * }
*/
public static function product($dimensions, $template = array()) {
if (empty($dimensions)) {
* 'day' => '25', 'month' => '10',
* 'year' => '2007' );
*
- * @param array $dayParamsArray of the day, month, year.
+ * @param array $dayParams of the day, month, year.
* Array of the day, month, year.
* values.
* @param string $format
$from['Y'] = $now['year'];
$from['H'] = 00;
$from['i'] = $to['s'] = 00;
- $to = self::intervalAdd('month', +1, $from);
+ $to = self::intervalAdd('month', 1, $from);
$to = self::intervalAdd('second', -1, $to);
break;
}
$from['M'] = $now['mon'];
$from['Y'] = $now['year'];
$from = self::intervalAdd('day', -1 * ($now['wday']) + 7, $from);
- $to = self::intervalAdd('day', +6, $from);
+ $to = self::intervalAdd('day', 6, $from);
break;
case 'starting':
$from['Y'] = $now['year'];
$from['H'] = 00;
$from['i'] = $to['s'] = 00;
- $to = self::intervalAdd('day', +7, $from);
+ $to = self::intervalAdd('day', 7, $from);
$to = self::intervalAdd('second', -1, $to);
break;
}
$to['d'] = $now['mday'];
$to['M'] = $now['mon'];
$to['Y'] = $now['year'];
- $to = self::intervalAdd('day', +1, $to);
+ $to = self::intervalAdd('day', 1, $to);
$from['d'] = $to['d'];
$from['M'] = $to['M'];
$from['Y'] = $to['Y'];
foreach (array(
'from',
- 'to'
+ 'to',
) as $item) {
if (!empty($$item)) {
$dateRange[$item] = self::format($$item);
* @param string $name
* Name of file.
*
- * @return boolean
+ * @return bool
* true if file is ascii
*/
public static function isAscii($name) {
* @param string $name
* Name of file.
*
- * @return boolean
+ * @return bool
* true if file is html
*/
public static function isHtml($name) {
}
/**
- * @param $source
- * @param $destination
+ * @param string $source
+ * @param string $destination
*/
- static function copyDir($source, $destination) {
+ public static function copyDir($source, $destination) {
if ($dh = opendir($source)) {
@mkdir($destination);
while (FALSE !== ($file = readdir($dh))) {
* @param string $name
* Name of file.
*
- * @return boolean
+ * @return bool
* whether the file was recoded properly
*/
public static function toUtf8($name) {
* @param string $name
* Name of file.
*
- * @return boolean
+ * @return bool
* whether the file can be include()d or require()d
*/
public static function isIncludable($name) {
* @param bool $stateName
* This parameter currently has no function.
*
- * @return boolean
+ * @return bool
* true if we modified the address, false otherwise
*/
public static function format(&$values, $stateName = FALSE) {
$add = 'q=' . urlencode('select * from geo.placefinder where ');
- $add .= join(urlencode(' and '), $whereComponents);
+ $add .= implode(urlencode(' and '), $whereComponents);
$add .= "&appid=" . urlencode($config->mapAPIKey);
*
* @return mixed
*/
- function invoke(
+ public function invoke(
$numParams,
&$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6,
$fnSuffix
*
* @return mixed
*/
- function invoke(
+ public function invoke(
$numParams,
&$arg1, &$arg2, &$arg3, &$arg4, &$arg5, &$arg6,
$fnSuffix
) {
// suppress all hok calls during soap
- return;
+ return NULL;
}
}
* @param array $params
* (by reference).
*
- * @return boolean
- * true if a mail was sent, else false
+ * @return bool
+ * TRUE if a mail was sent, else FALSE.
*/
public static function send(&$params) {
$returnPath = CRM_Core_BAO_MailSettings::defaultReturnPath();
$headers = array_merge($headers, $params['headers']);
}
$headers['From'] = $params['from'];
- $headers['To'] =
- self::formatRFC822Email(
- CRM_Utils_Array::value('toName', $params),
- CRM_Utils_Array::value('toEmail', $params),
- FALSE
- );
+ $headers['To'] = self::formatRFC822Email(
+ CRM_Utils_Array::value('toName', $params),
+ CRM_Utils_Array::value('toEmail', $params),
+ FALSE
+ );
$headers['Cc'] = CRM_Utils_Array::value('cc', $params);
$headers['Bcc'] = CRM_Utils_Array::value('bcc', $params);
$headers['Subject'] = CRM_Utils_Array::value('subject', $params);
*/
public static function errorMessage($mailer, $result) {
$message = '<p>' . ts('An error occurred when CiviCRM attempted to send an email (via %1). If you received this error after submitting on online contribution or event registration - the transaction was completed, but we were unable to send the email receipt.', array(
- 1 => 'SMTP'
+ 1 => 'SMTP',
)) . '</p>' . '<p>' . ts('The mail library returned the following error message:') . '<br /><span class="font-red"><strong>' . $result->getMessage() . '</strong></span></p>' . '<p>' . ts('This is probably related to a problem in your Outbound Email Settings (Administer CiviCRM » System Settings » Outbound Email), OR the FROM email address specifically configured for your contribution page or event. Possible causes are:') . '</p>';
if (is_a($mailer, 'Mail_smtp')) {
}
$message .= '<li>' . ts('The FROM Email Address configured for this feature may not be a valid sender based on your email service provider rules.') . '</li>' . '</ul>' . '<p>' . ts('Check <a href="%1">this page</a> for more information.', array(
- 1 => CRM_Utils_System::docURL2('user/advanced-configuration/email-system-configuration', TRUE)
+ 1 => CRM_Utils_System::docURL2('user/advanced-configuration/email-system-configuration', TRUE),
)) . '</p>';
return $message;
/**
* Get the Active outBound email
*
- * @return boolean
- * true if valid outBound email configuration found, false otherwise
+ * @return bool
+ * TRUE if valid outBound email configuration found, false otherwise.
*/
public static function validOutBoundMail() {
$mailingInfo = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME,
/**
* Process the default mailbox (ie. that is used by civiMail for the bounce)
*
- * @return boolean
- * always returns true (for the api). at a later stage we should
- * fix this to return true on success / false on failure etc
+ * @return bool
+ * Always returns true (for the api). at a later stage we should
+ * fix this to return true on success / false on failure etc.
*/
public static function processBounces() {
- $dao = new CRM_Core_DAO_MailSettings;
+ $dao = new CRM_Core_DAO_MailSettings();
$dao->domain_id = CRM_Core_Config::domainID();
$dao->is_default = TRUE;
$dao->find();
* @return void
*/
public static function processActivities() {
- $dao = new CRM_Core_DAO_MailSettings;
+ $dao = new CRM_Core_DAO_MailSettings();
$dao->domain_id = CRM_Core_Config::domainID();
$dao->is_default = FALSE;
$dao->find();
* @return void
*/
public static function process($civiMail = TRUE) {
- $dao = new CRM_Core_DAO_MailSettings;
+ $dao = new CRM_Core_DAO_MailSettings();
$dao->domain_id = CRM_Core_Config::domainID();
$dao->find();
// 0 = activities; 1 = bounce;
$usedfor = $dao->is_default;
- $emailActivityTypeId =
- (defined('EMAIL_ACTIVITY_TYPE_ID') && EMAIL_ACTIVITY_TYPE_ID) ? EMAIL_ACTIVITY_TYPE_ID : CRM_Core_OptionGroup::getValue(
+ $emailActivityTypeId
+ = (defined('EMAIL_ACTIVITY_TYPE_ID') && EMAIL_ACTIVITY_TYPE_ID) ? EMAIL_ACTIVITY_TYPE_ID : CRM_Core_OptionGroup::getValue(
'activity_type',
'Inbound Email',
'name'
'Individual',
'Organization',
'Household',
- 'Case'
+ 'Case',
))) {
if ($object->extends == 'Event') {
$key = 'event_type';
* @param $whereField
* @param null $additionalWhereCond
*/
- function table(
+ public function table(
&$ids,
$tableName,
&$fields,
* @param null $lastExportTime
* @param bool $discoverContacts
*/
- function run(
+ public function run(
$fileName,
$lastExportTime = NULL,
$discoverContacts = FALSE
if (!self::$_currencySymbols) {
self::$_currencySymbols = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'currency', array(
'keyColumn' => 'name',
- 'labelColumn' => 'symbol'
+ 'labelColumn' => 'symbol',
));
}
* @param string $author
* @param string $title
*/
- static function &pdflib(
+ public static function &pdflib(
$fileName,
$searchPath,
&$values,
return CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/api/explorer'));
}
- /** used to load a template "inline", eg. for ajax, without having to build a menu for each template */
- static function loadTemplate() {
+ /**
+ * used to load a template "inline", eg. for ajax, without having to build a menu for each template
+ */
+ public static function loadTemplate() {
$request = CRM_Utils_Request::retrieve('q', 'String');
if (FALSE !== strpos($request, '..')) {
die ("SECURITY FATAL: the url can't contain '..'. Please report the issue on the forum at civicrm.org");
}
}
- /** This is a wrapper so you can call an api via json (it returns json too)
+ /**
+ * This is a wrapper so you can call an api via json (it returns json too)
* http://example.org/civicrm/api/json?entity=Contact&action=Get"&json={"contact_type":"Individual","email.get.email":{}} to take all the emails from individuals
* works for POST & GET (POST recommended)
- **/
+ */
public static function ajaxJson() {
$requestParams = CRM_Utils_Request::exportValues();
if (!is_array($params)) {
CRM_Utils_JSON::output(array(
'is_error' => 1,
- 'error_message',
- 'invalid json format: ?{"param_with_double_quote":"value"}'
+ 'error_message' => 'invalid json format: ?{"param_with_double_quote":"value"}',
));
}
/**
* Singleton function used to manage this object
*
- * @param string the key to permit session scope's
*
* @return object
*/
*
* @return void
*/
- static function add(
+ public static function add(
$title,
$url,
$id,
/**
* Create a new SELECT query
*
- * @param string $from
+ * @param string $table
* Table-name and optional alias.
*/
public function __construct($table) {
return sha1($result[2]);
}
- /*** MAILER API ***/
+ /**
+ * MAILER API
+ */
public function mailer_event_bounce($key, $job, $queue, $hash, $body) {
$this->verify($key);
$params = array(
* Convert a display name into a potential variable
* name that we could use in forms/code
*
- * @param name Name of the string
- *
+ * @param $title title of the string
* @param int $maxLength
*
* @return string
* @param bool $utf8
* Attempt utf8 match on failure (default yes).
*
- * @return boolean
+ * @return bool
* true if string is ascii
*/
public static function isAscii($str, $utf8 = TRUE) {
* @param string $str
* Input string.
*
- * @return boolean
+ * @return bool
*/
public static function isUtf8($str) {
if (!function_exists(mb_detect_encoding)) {
* @param string $url2
* The second url to be matched against.
*
- * @return boolean
+ * @return bool
* true if the urls match, else false
*/
public static function match($url1, $url2) {
* @param string $str
* The string to be translated.
*
- * @return boolean
+ * @return bool
*/
public static function strtobool($str) {
if (!is_scalar($str)) {
* @param string $str
* The string to be translated.
*
- * @return boolean
+ * @return bool
*/
public static function strtoboolstr($str) {
if (!is_scalar($str)) {
* @return string
* the sanitized string
*/
- static function stripPathChars(
+ public static function stripPathChars(
$string,
$search = NULL,
$replace = NULL
* @param bool $case
* Boolean indicating whether you want the comparison to be case sensitive or not.
*
- * @return boolean
+ * @return bool
* TRUE (string are identical); FALSE (strings are not identical)
*/
public static function compareStr($strOne, $strTwo, $case) {
* (because most other odd characters are %-escaped in URLs; and %-escaped
* strings don't need any extra escaping in HTML).
*
- * @param string $url
+ * @param string $htmlUrl
* URL with HTML entities.
* @return string
* URL without HTML entities
*
* @return string
*/
- static function theme(
+ public static function theme(
&$content,
$print = FALSE,
$maintenance = FALSE
* @return string
* An HTML string containing a link to the given path.
*/
- static function url(
+ public static function url(
$path = NULL,
$query = NULL,
$absolute = FALSE,
*
* @return string
*/
- static function href(
+ public static function href(
$text, $path = NULL, $query = NULL, $absolute = TRUE,
$fragment = NULL, $htmlize = TRUE, $frontend = FALSE, $forceBackend = FALSE
) {
* @param string $message
* (optional) The message to provide in the body of the redirect page.
*/
- static function jsRedirect(
+ public static function jsRedirect(
$url = NULL,
$title = NULL,
$message = NULL
* @param bool $output
* @param string $disposition
*/
- static function download(
+ public static function download(
$name, $mimeType, &$buffer,
$ext = NULL,
$output = TRUE,
* @param array $params
* An array of parameters (see CRM_Utils_System::docURL2 method for names)
*
- * @return string
+ * @return void|string
* URL or link to documentation page, based on provided parameters.
*/
public static function docURL($params) {
if (!isset($params['page'])) {
- return;
+ return NULL;
}
if (CRM_Utils_Array::value('resource', $params) == 'wiki') {
CRM_ACL_BAO_Cache::resetCache();
// reset various static arrays used here
- CRM_Contact_BAO_Contact::$_importableFields =
- CRM_Contact_BAO_Contact::$_exportableFields =
- CRM_Contribute_BAO_Contribution::$_importableFields =
- CRM_Contribute_BAO_Contribution::$_exportableFields =
- CRM_Pledge_BAO_Pledge::$_exportableFields =
- CRM_Contribute_BAO_Query::$_contributionFields =
- CRM_Core_BAO_CustomField::$_importFields =
- CRM_Core_BAO_Cache::$_cache =
- CRM_Core_DAO::$_dbColumnValueCache = NULL;
+ CRM_Contact_BAO_Contact::$_importableFields = CRM_Contact_BAO_Contact::$_exportableFields
+ = CRM_Contribute_BAO_Contribution::$_importableFields
+ = CRM_Contribute_BAO_Contribution::$_exportableFields
+ = CRM_Pledge_BAO_Pledge::$_exportableFields = CRM_Contribute_BAO_Query::$_contributionFields
+ = CRM_Core_BAO_CustomField::$_importFields
+ = CRM_Core_BAO_Cache::$_cache = CRM_Core_DAO::$_dbColumnValueCache = NULL;
CRM_Core_OptionGroup::flushAll();
CRM_Utils_PseudoConstant::flushAll();
* @return string
* , formatted url.
*/
- static function languageNegotiationURL(
+ public static function languageNegotiationURL(
$url,
$addLanguagePart = TRUE,
$removeLanguagePart = FALSE
* (optional) Sent by contribution/event reg/profile pages which uses a id
* specific extra file name if present.
*/
- static function appendTPLFile(
+ public static function appendTPLFile(
$fileName,
&$content,
$overideFileName = NULL
* @return string
* Formatted url.
*/
- function languageNegotiationURL(
+ public function languageNegotiationURL(
$url,
$addLanguagePart = TRUE,
$removeLanguagePart = FALSE
* @param string $username
*
* @throws CRM_Core_Exception
- * @return int|NULL
+ * @return;
*/
public function getUfId($username) {
$className = get_class($this);
* @param string $dir
*
* @return array
- * - $url, (Joomla - non admin url)
- * - $siteName,
- * - $siteRoot
+ * - $url, (Joomla - non admin url)
+ * - $siteName,
+ * - $siteRoot
*/
public function getDefaultSiteSettings($dir) {
$config = CRM_Core_Config::singleton();
/**
* Get currently logged in user uf id.
*
- * @return int
+ * @return;
* $userID logged in user uf id.
*/
public function getLoggedInUfID() {
/**
* Get currently logged in user unique identifier - this tends to be the email address or user name.
*
- * @return string
+ * @return;
* logged in user unique identifier
*/
public function getLoggedInUniqueIdentifier() {
/**
* Rewrite various system urls to https
*
- * @param null
- *
* @return void
*/
public function mapConfigToSSL() {
* Load cms bootstrap?.
* @param NULL|string $realPath filename of script
*
- * @return mixed
- * false if no auth
- * array(
- * contactID, ufID, unique string ) if success
+ * @return mixed false if no auth array(contactID, ufID, unique string ) if success
*/
public static function authenticate($name, $password, $loadCMSBootstrap = FALSE, $realPath = NULL) {
require_once 'DB.php';
* e.g. for drupal: records a watchdog message about the new session, saves the login timestamp,
* calls hook_user op 'login' and generates a new session.
*
- * @param array params
+ * @param array $params
*
* FIXME: Document values accepted/required by $params
*/
/**
* Check is user logged in.
*
- * @return boolean
+ * @return bool
*/
public function isUserLoggedIn() {
$isloggedIn = FALSE;
/**
* Rewrite various system urls to https
- *
- * @param null
- *
- * @return void
*/
public function mapConfigToSSL() {
global $base_url;
if (!$contactID) {
return FALSE;
}
- else { //success
+ else {
+ //success
if ($loadCMSBootstrap) {
$bootStrapParams = array();
if ($name && $password) {
* e.g. for drupal : records a watchdog message about the new session,
* saves the login timestamp, calls hook_user op 'login' and generates a new session.
*
- * @param array params
+ * @param array $params
*
* FIXME: Document values accepted/required by $params
*/
/**
* Check is user logged in.
*
- * @return boolean
+ * @return bool
*/
public function isUserLoggedIn() {
$isloggedIn = FALSE;
* @return void
*/
public function setTitle($title, $pageTitle) {
- return;
+ return NULL;
}
/**
* @param string $str
* The permission to check.
*
- * @return boolean
+ * @return bool
* true if yes, else false
*/
public function checkPermission($str) {
* @return void
*/
public function appendBreadCrumb($title, $url) {
- return;
+ return NULL;
}
/**
* @return void
*/
public function addHTMLHead($head) {
- return;
+ return NULL;
}
/**
/**
* Figure out the post url for the form
*
- * @param the default action if one is pre-specified
- *
* @return string
* the url to post the form
*/
* If present, add destination to querystring (works for Drupal only).
*
* @throws Exception
- * @return string
+ * @return;
* loginURL for the current CMS
*/
public function getLoginURL($destination = '') {
* @param null $pageTitle
*/
public function setTitle($title, $pageTitle = NULL) {
- return;
+ return NULL;
}
/**
* @param $breadCrumbs
*/
public function appendBreadCrumb($breadCrumbs) {
- return;
+ return NULL;
}
public function resetBreadCrumb() {
- return;
+ return NULL;
}
/**
* @param string $head
*/
public function addHTMLHead($head) {
- return;
+ return NULL;
}
public function mapConfigToSSL() {
/**
* @param mix $action
*
- * @return string
+ * @return void
*/
public function postURL($action) {
- return;
+ return NULL;
}
/**
*
* @return string
*/
- function url(
+ public function url(
$path = NULL, $query = NULL, $absolute = FALSE,
$fragment = NULL, $htmlize = TRUE,
$frontend = FALSE, $forceBackend = FALSE
* @param string $message
*/
public function setMessage($message) {
- return;
+ return NULL;
}
public function permissionDenied() {
* with the locale or null for none
*/
/**
- * @return string
+ * @return void
*/
public function getUFLocale() {
return NULL;
* @param string $destination
* If present, add destination to querystring (works for Drupal only).
*
- * @throws Exception
- * @return string
+ * @Throws Exception
* loginURL for the current CMS
*/
public function getLoginURL($destination = '') {
* Name of the node we are searching for.
* @param array (ref) $parentNode which parent node should we search in ?
*
- * @return array(
- * ref) | false node if found else false
+ * @return array(ref) | false node if found else false
*/
- //public function &findNode(&$parentNode, $name)
public function &findNode($name, &$parentNode) {
// if no parent node specified, please start from root node
if (!$parentNode) {
* Check if node is a leaf node.
* Currently leaf nodes are strings and non-leaf nodes are arrays
*
- * @param array (
- * ref) $node node which needs to checked
+ * @param array $node node which needs to checked
*
- * @return boolean
+ * @return bool
*/
public function isLeafNode(&$node) {
return (count($node['children']) ? TRUE : FALSE);
*
* @param string $parentName
* Name of the parent ?.
- * @param array (ref) - node to be added
+ * @param array (ref) $node - node to be added
*
* @return void
*/
/**
* Add Data
*
- * @param string $parentName
- * Name of the parent ?.
- * @param mixed - data to be added
- * @param string - key to be used (optional)
+ * @param string $parentName Name of the parent ?.
+ * @param string $childName - key to be used (optional)
+ * @param mixed $data - data to be added
*
* @return void
*/
/**
* Get Tree
*
- * @param none
- *
* @return tree
*/
public function getTree() {
/**
* Print the tree
*
- * @param none
- *
* @return void
*/
public function display() {
break;
default:
- CRM_Core_Error::fatal("Cannot recognize $type for $data");
+ CRM_Core_Error::fatal(
+ $type . " is not a recognised (camel cased) data type."
+ );
break;
}
* @param int $contributionPageID
* @param string $widgetID
*
- * @return stdClass
+ * @return object
*/
public function getContributionPageData($contributionPageID, $widgetID) {
$config = CRM_Core_Config::singleton();
$activityStatusGroup = civicrm_api3('option_group', 'get', array('name' => 'activity_status'));
$activityStatus = array(
'name' => $status,
- 'option_group_id' => $activityStatusGroup['id']
+ 'option_group_id' => $activityStatusGroup['id'],
);
$activityStatusID = civicrm_api3('option_value', 'get', $activityStatus);
$activityStatusID = $activityStatusID['values'][$activityStatusID['id']]['value'];
$dispatcher->addListener('DAO::post-delete', array('\CRM_Core_BAO_RecurringEntity', 'triggerDelete'));
$dispatcher->addListener('hook_civicrm_unhandled_exception', array(
'CRM_Core_LegacyErrorHandler',
- 'handleException'
+ 'handleException',
));
return $dispatcher;
}
* @return \Civi\Core\Transaction\Frame
*/
public function getBaseFrame() {
- if (empty($this->frames)) return NULL;
+ if (empty($this->frames)) {
+ return NULL;
+ }
return $this->frames[count($this->frames) - 1];
}
$results = array(
'title' => 'CiviCRM InnoDB support',
'severity' => $this::REQUIREMENT_ERROR,
- 'details' => 'Could not determine if MySQL has InnoDB support. Assuming none.'
+ 'details' => 'Could not determine if MySQL has InnoDB support. Assuming none.',
);
$conn = @mysql_connect($db_config['host'], $db_config['username'], $db_config['password']);
$defLocType = CRM_Core_BAO_LocationType::getDefault();
$params['email'] = array(
1 => array(
- 'email' => $email,
+ 'email' => $email,
'is_primary' => 1,
'location_type_id' => ($defLocType->id) ? $defLocType->id : 1,
),
if (!empty($params['home_url'])) {
$websiteTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Website', 'website_type_id');
$params['website'] = array(
- 1 => array(
- 'website_type_id' => key($websiteTypes),
+ 1 => array(
+ 'website_type_id' => key($websiteTypes),
'url' => $params['home_url'],
),
);
/**
* Retrieve one or more contacts, given a set of search params
*
- * @param array input parameters
- *
* @return array
* API Result Array
*/
if ($listCurrentEmployer && !empty($currEmpDetails)) {
$contactList = array(
array(
- 'data' => $currEmpDetails['data'],
+ 'data' => $currEmpDetails['data'],
'id' => $currEmpDetails['id'],
),
);
* @param array $errors
* Collect validation errors.
*
- * @return array
+ * @return array|NULL
* Validation errors
* @todo remove this function - not in use but need to review functionality before
* removing as it might be useful in wrapper layer
*/
function _civicrm_api3_custom_field_validate_field($fieldName, $value, $fieldDetails, &$errors = array()) {
- return;
+ return NULL;
//see comment block
if (!$value) {
return $errors;
* Array to search on.
*
* @return array
- * * {@getfields CustomGroup_get}
- * @example CustomGroupGet.php
- **/
+ */
function civicrm_api3_custom_group_get($params) {
return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
*/
/**
- * {@getfields EntityTag_get}
- * @example EntityTagGet.php
+ * Get entity tags.
*
* @param array $params
*
}
/**
- * Adjust Metadata for Get action
+ * Adjust Metadata for Get action.
+ *
+ * The metadata is used for setting defaults, documentation & validation.
*
- * The metadata is used for setting defaults, documentation & validation
* @param array $params
* Array or parameters determined by getfields.
*/
}
/**
+ * Create an entity tag.
*
* @param array $params
*
* @return array
- * {@getfields EntityTag_create}
- * @example EntityTagCreate.php
*/
function civicrm_api3_entity_tag_create($params) {
return _civicrm_api3_entity_tag_common($params, 'add');
}
/**
- * {@getfields EntityTag_delete}
- * @example EntityTagGet.php
+ * Mark entity tag as removed.
*
* @param array $params
*
}
/**
- * modify metadata
+ * Modify metadata.
+ *
* @param array $params
*/
function _civicrm_api3_entity_tag_delete_spec(&$params) {
}
/**
+ * Helper function for formatting tags (part of api v2 legacy).
*
* @param array $params
* @param string $op
*
* @return array
- * <type>
*/
function _civicrm_api3_entity_tag_common($params, $op = 'add') {
* @return array
* Information about operation results
*
- * On success, the return array will be structured as follows:
- * <code>array(
+ * On success, the return array will be structured as follows:
+ * <code>array(
* "is_error" => 0,
* "version" => 3,
* "count" => 3,
* "added" => integer,
* "total_count" => integer
* )
- * )</code>
+ * )</code>
*
- * On failure, the return array will be structured as follows:
- * <code>array(
+ * On failure, the return array will be structured as follows:
+ * <code>array(
* 'is_error' => 1,
* 'error_message' = string,
* 'error_data' = mixed or undefined
- * )</code>
- * {@getfields GroupContact_create}
+ * )</code>
+ * {@getfields GroupContact_create}
*/
function civicrm_api3_group_contact_create($params) {
// Nonstandard bao - doesn't accept ID as a param, so convert id to group_id + contact_id
* @param array $params
* @param string $op
*
- * @return Array
+ * @return array
* @todo behaviour is highly non-standard - need to figure out how to make this 'behave'
* & at the very least return IDs & details of the groups created / changed
*/
$extraReturnValues['not_removed'] += $nr;
}
}
- $dao = null;// can't pass this by reference
- return civicrm_api3_create_success(1,$params,'group_contact','create',$dao,$extraReturnValues);
+ $dao = NULL;// can't pass this by reference
+ return civicrm_api3_create_success(1, $params, 'group_contact', 'create', $dao, $extraReturnValues);
}
/**
* Deletes an existing IM
*
* @param array $params
- * {@getfields im_delete}
*
* @return array
* API result Array
* Associative array of property name/value pairs to insert in new job.
*
* @return array
- * {@getfields Job_create}
+ *
+ * {@getfields Job_create}
*/
function civicrm_api3_job_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
/**
* Retrieve one or more job
- * @param array input parameters
+ *
+ * @param array $params
+ * input parameters
* @return array
- * api result array
- * {@getfields email_get}
+ *
+ * {@getfields email_get}
*/
function civicrm_api3_job_get($params) {
return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
*
* @param array $params
*
- * @return array
- * API Result Array
* {@getfields Job_delete}
*/
function civicrm_api3_job_delete($params) {
* and results are handled in the job log.
*
* @param array $params
- * (reference ) input parameters.
+ * input parameters (unused).
*
* @return array
* API Result Array
*/
-function civicrm_api3_job_execute(/** @noinspection PhpUnusedParameterInspection */
- $params) {
+function civicrm_api3_job_execute($params) {
+ // @noinspection PhpUnusedParameterInspection
+
$facility = new CRM_Core_JobManager();
$facility->execute(FALSE);
* Geocode group of contacts based on given params
*
* @param array $params
- * (reference ) input parameters.
+ * input parameters.
*
* @return array
* API Result Array
function civicrm_api3_job_geocode($params) {
$gc = new CRM_Utils_Address_BatchUpdate($params);
-
$result = $gc->run();
if ($result['is_error'] == 0) {
'type' => CRM_Utils_Type::T_STRING,
);
$params['gt'] = array(
- 'api.required' => 1,
- 'title' => 'Greeting Type',
- 'type' => CRM_Utils_Type::T_STRING,
+ 'api.required' => 1,
+ 'title' => 'Greeting Type',
+ 'type' => CRM_Utils_Type::T_STRING,
);
}
CRM_Utils_Mail_EmailProcessor::processActivities();
$values = array();
$lock->release();
- return civicrm_api3_create_success($values, $params,'mailing','activities');
+ return civicrm_api3_create_success($values, $params, 'mailing', 'activities');
}
catch (Exception $e) {
$lock->release();
* @param array $params
* Input parameters NOT USED.
*
- * @return boolean
+ * @return bool
* true if success, else false
*/
-function civicrm_api3_job_process_membership(/** @noinspection PhpUnusedParameterInspection */
- $params) {
+function civicrm_api3_job_process_membership($params) {
$lock = new CRM_Core_Lock('civimail.job.updateMembership');
if (!$lock->isAcquired()) {
return civicrm_api3_create_error('Could not acquire lock, another Membership Processing process is running');
* @param array $params
* (reference ) input parameters.
*
- * @return boolean
+ * @return bool
* true if success, else false
*/
function civicrm_api3_job_process_respondent($params) {
);
$params['mode'] = array(
'title' => 'Mode',
- 'description' => 'helps decide how to behave when there are conflicts.
- A \'safe\' value skips the merge if there are no conflicts.
- Does a force merge otherwise.',
+ 'description' => 'helps decide how to behave when there are conflicts. A \'safe\' value skips the merge if there are no conflicts. Does a force merge otherwise.',
'type' => CRM_Utils_Type::T_STRING,
);
$params['auto_flip'] = array(
* 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
- * (reference ) - sends in various config parameters to decide what needs to be cleaned.
- *
- * @return boolean
- * true if success, else false
+ * Sends in various config parameters to decide what needs to be cleaned.
*/
function civicrm_api3_job_cleanup($params) {
- $session = CRM_Utils_Array::value('session', $params, true );
- $tempTable = CRM_Utils_Array::value('tempTables', $params, true );
- $jobLog = CRM_Utils_Array::value('jobLog', $params, true );
- $prevNext = CRM_Utils_Array::value('prevNext', $params, true );
- $dbCache = CRM_Utils_Array::value('dbCache', $params, false);
- $memCache = CRM_Utils_Array::value('memCache', $params, false);
+ $session = CRM_Utils_Array::value('session', $params, TRUE);
+ $tempTable = CRM_Utils_Array::value('tempTables', $params, TRUE);
+ $jobLog = CRM_Utils_Array::value('jobLog', $params, TRUE);
+ $prevNext = CRM_Utils_Array::value('prevNext', $params, TRUE);
+ $dbCache = CRM_Utils_Array::value('dbCache', $params, FALSE);
+ $memCache = CRM_Utils_Array::value('memCache', $params, FALSE);
if ($session || $tempTable || $prevNext) {
CRM_Core_BAO_Cache::cleanup($session, $tempTable, $prevNext);
* @return array
* @throws \API_Exception
*/
-function civicrm_api3_job_disable_expired_relationships(/** @noinspection PhpUnusedParameterInspection */
- $params) {
+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.');
$limit = CRM_Utils_Array::value('limit', $params, 0);
- CRM_Contact_BAO_GroupContactCache::loadAll(null, $limit);
+ CRM_Contact_BAO_GroupContactCache::loadAll(NULL, $limit);
$lock->release();
return civicrm_api3_create_success();
*
* @param array $params
* @return array API Success Array
- * API Success Array
+ * API Success Array
* @throws \API_Exception
* @throws \Civi\API\Exception\UnauthorizedException
*/
return civicrm_api3_create_success($params);
}
else {
- throw new API_Exception(ts('Queue event could not be found'),'no_queue_event
+ throw new API_Exception(ts('Queue event could not be found'), 'no_queue_event
');
}
}
switch ($detail) {
case 'Delivered':
$stats[$params['mailing_id']] += array(
- $detail => CRM_Mailing_Event_BAO_Delivered::getTotalCount($params['mailing_id'], $params['job_id'], FALSE, $params['date']),
+ $detail => CRM_Mailing_Event_BAO_Delivered::getTotalCount($params['mailing_id'], $params['job_id'], FALSE, $params['date']),
);
break;
case 'Bounces':
$stats[$params['mailing_id']] += array(
- $detail => CRM_Mailing_Event_BAO_Bounce::getTotalCount($params['mailing_id'], $params['job_id'], FALSE, $params['date']),
+ $detail => CRM_Mailing_Event_BAO_Bounce::getTotalCount($params['mailing_id'], $params['job_id'], FALSE, $params['date']),
);
break;
case 'Unsubscribers':
$stats[$params['mailing_id']] += array(
- $detail => CRM_Mailing_Event_BAO_Unsubscribe::getTotalCount($params['mailing_id'], $params['job_id'], FALSE, NULL, $params['date']),
+ $detail => CRM_Mailing_Event_BAO_Unsubscribe::getTotalCount($params['mailing_id'], $params['job_id'], FALSE, NULL, $params['date']),
);
break;
case 'Unique Clicks':
$stats[$params['mailing_id']] += array(
- $detail => CRM_Mailing_Event_BAO_TrackableURLOpen::getTotalCount($params['mailing_id'], $params['job_id'], FALSE, NULL, $params['date']),
+ $detail => CRM_Mailing_Event_BAO_TrackableURLOpen::getTotalCount($params['mailing_id'], $params['job_id'], FALSE, NULL, $params['date']),
);
break;
case 'Opened':
$stats[$params['mailing_id']] += array(
- $detail => CRM_Mailing_Event_BAO_Opened::getTotalCount($params['mailing_id'], $params['job_id'], FALSE, $params['date']),
+ $detail => CRM_Mailing_Event_BAO_Opened::getTotalCount($params['mailing_id'], $params['job_id'], FALSE, $params['date']),
);
break;
}
* @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.
* @throws Exception
* @return array
* api result array
- * {@getfields mailing_event_confirm_create}
*/
function civicrm_api3_mailing_event_confirm_create($params) {
}
/**
- * Adjust Metadata for Create action
+ * Adjust Metadata for Create action.
+ *
+ * The metadata is used for setting defaults, documentation & validation.
*
- * The metadata is used for setting defaults, documentation & validation
* @param array $params
* Array or parameters determined by getfields.
*/
* @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'
*
* @return array
* api result array
- * {@getfields mailing_event_subscribe_create}
*/
function civicrm_api3_mailing_event_resubscribe_create($params) {
}
/**
- * Adjust Metadata for Create action
+ * Adjust Metadata for Create action.
+ *
+ * The metadata is used for setting defaults, documentation & validation.
*
- * The metadata is used for setting defaults, documentation & validation
* @param array $params
* Array or parameters determined by getfields.
*/
* Array of one or more valid.
*
* @return array
- * API return Array of matching mailing jobs
- * {@getfields mailing_job_get}
+ * 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);
*
* @return array
* api result
- * {@getfields membership_delete}
+ * {@getfields membership_delete}
*/
function civicrm_api3_membership_delete($params) {
return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
*
* @return array
* Array of newly created membership property values.
- * {@getfields membership_create}
+ * {@getfields membership_create}
*/
function civicrm_api3_membership_create($params) {
// check params for membership id during update
// Fixme: This code belongs in the BAO
$action = CRM_Core_Action::ADD;
// we need user id during add mode
- $ids = array();
- if (!empty($params['contact_id'])) {
- $ids['userId'] = $params['contact_id'];
- }
+ $ids = array();
+ if (!empty($params['contact_id'])) {
+ $ids['userId'] = $params['contact_id'];
+ }
//for edit membership id should be present
if (!empty($params['id'])) {
$ids['membership'] = $params['id'];
$params['status_id'] = array('IN' => CRM_Member_BAO_MembershipStatus::getMembershipStatusCurrent());
}
- $options = _civicrm_api3_get_options_from_params($params, TRUE,'membership', 'get');
+ $options = _civicrm_api3_get_options_from_params($params, TRUE, 'membership', 'get');
if ($options['is_count']) {
return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
return civicrm_api3_create_success($membershipValues, $params, 'membership', 'get');
}
- $members = _civicrm_api3_membership_relationsship_get_customv2behaviour($params, $membershipValues, $contactID);
+ $members = _civicrm_api3_membership_relationsship_get_customv2behaviour($params, $membershipValues, $contactID);
return civicrm_api3_create_success($members, $params, 'membership', 'get');
}
/**
* @param array $params
*
- * @return boolean
- * | error true if successfull, error otherwise
- * {@getfields message_template_delete}
+ * @return bool
+ * API result array
*/
function civicrm_api3_message_template_delete($params) {
return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
* @return array
* array of properties,
* if error an array with an error id and error message
- * {@getfields note_get}
+ *
+ * {@getfields note_get}
*/
function civicrm_api3_note_get($params) {
*
* @return array
* API Result Array
- * message otherwise
- * {@getfields OptionGroup_delete}
+ * {@getfields OptionGroup_delete}
*/
function civicrm_api3_option_group_delete($params) {
return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
* Gets field for civicrm_pledge_payment functions
*
* @param array $params
- *
- * @return array
- * fields valid for other functions
+ * Modifiable list of fields allowed for the PledgePayment.get action.
*/
function civicrm_api3_pledge_payment_get_spec(&$params) {
$params['option.create_new'] = array('title' => "Create new field rather than update an unpaid payment");
* @package CiviCRM_APIv3
* @subpackage API_ActivityProfile
* @copyright CiviCRM LLC (c) 2004-2014
- * @version $Id: ActivityProfile.php 30486 2011-05-20 16:12:09Z rajan $
+ * @version $Id: Profile.php 30486 2011-05-20 16:12:09Z rajan $
*
*/
/**
* Retrieve Profile field values.
*
- * @param array $params
- * Associative array of property name/value.
- * pairs to get profile field values
- *
- * @throws API_Exception
- * @return array
- *
* NOTE this api is not standard & since it is tested we need to honour that
* but the correct behaviour is for it to return an id indexed array as this supports
* multiple instances - if a single profile is passed in we will not return a normal api result array
* in order to avoid breaking code. (This could still be confusing :-( but we have to keep the tested behaviour working
*
* Note that if contact_id is empty an array of defaults is returned
+ *
+ * @param array $params
+ * Associative array of property name/value.
+ * pairs to get profile field values
+ *
+ * @throws API_Exception
+ * @return array
*/
function civicrm_api3_profile_get($params) {
$nonStandardLegacyBehaviour = is_numeric($params['profile_id']) ? TRUE : FALSE;
*
* @return array
* API result array
- * {@getfields UFGroup_create}
+ * {@getfields UFGroup_create}
* @example UFGroupCreate.php
*/
function civicrm_api3_uf_group_create($params) {
*
* @return array
* Array of matching profiles
- * {@getfields UFGroup_get}
+ * {@getfields UFGroup_get}
* @example UFGroupGet.php
*/
function civicrm_api3_uf_group_get($params) {
*
* @return array
* api result array
- * {@getfields uf_match_create}
+ * {@getfields uf_match_create}
*/
function civicrm_api3_uf_match_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
*
* @return array
* api result array
- * {@getfields uf_match_create}
+ * {@getfields uf_match_create}
*/
function civicrm_api3_uf_match_delete($params) {
return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
* String DAO to check for required fields (create functions only).
* @param array $keyoptions
* List of required fields options. One of the options is required.
- *
- * @return null
- * or throws error if there the required fields not present
- * @
*/
function civicrm_api3_verify_one_mandatory($params, $daoName = NULL, $keyoptions = array()) {
$keys = array(array());
* @param array $keys
* List of required fields. A value can be an array denoting that either this or that is required.
* @param bool $verifyDAO
- *
- * @throws API_Exception
- * @return null
- * or throws error if there the required fields not present
- *
- * @todo see notes on _civicrm_api3_check_required_fields regarding removing $daoName param
*/
function civicrm_api3_verify_mandatory($params, $daoName = NULL, $keys = array(), $verifyDAO = TRUE) {
$getCount,
$skipPermissions
);
- if ($getCount) { // only return the count of contacts
+ if ($getCount) {
+ // only return the count of contacts
return $entities;
}
* @param array $params
* @param string $mode
* @param string $entity
- * @return array(CRM_Core_DAO|CRM_Contact_BAO_Query)
+ * @return array
+ * [CRM_Core_DAO|CRM_Contact_BAO_Query]
*/
function _civicrm_api3_get_query_object($params, $mode, $entity) {
- $options = _civicrm_api3_get_options_from_params($params, TRUE, $entity, 'get');
- $sort = CRM_Utils_Array::value('sort', $options, NULL);
- $offset = CRM_Utils_Array::value('offset', $options);
- $rowCount = CRM_Utils_Array::value('limit', $options);
- $inputParams = CRM_Utils_Array::value('input_params', $options, array());
+ $options = _civicrm_api3_get_options_from_params($params, TRUE, $entity, 'get');
+ $sort = CRM_Utils_Array::value('sort', $options, NULL);
+ $offset = CRM_Utils_Array::value('offset', $options);
+ $rowCount = CRM_Utils_Array::value('limit', $options);
+ $inputParams = CRM_Utils_Array::value('input_params', $options, array());
$returnProperties = CRM_Utils_Array::value('return', $options, NULL);
if (empty($returnProperties)) {
$returnProperties = CRM_Contribute_BAO_Query::defaultReturnProperties($mode);
/**
* 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 $bao
+ *
+ * @param CRM_Core_DAO $bao
* @param bool $unique
- * @return
+ *
+ * @return array
*/
function _civicrm_api3_build_fields_array(&$bao, $unique = TRUE) {
$fields = $bao->fields();
/**
* 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
*
- * @return mixed
+ * @return array
*/
function _civicrm_api3_get_unique_name_array(&$bao) {
$fields = $bao->fields();
* @param bool $autoFind
*
* @return array
- *
*/
function _civicrm_api3_dao_to_array($dao, $params = NULL, $uniqueFields = TRUE, $entity = "", $autoFind = TRUE) {
$result = array();
* && 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
*
- * @param array $params
* @param string $entity
* Entity name in CamelCase.
+ * @param array $params
*
* @return bool
*/
* @param array $values
* (reference) array.
* @param array|bool $uniqueFields
- *
- * @return array
*/
function _civicrm_api3_object_to_array(&$dao, &$values, $uniqueFields = FALSE) {
_civicrm_api3_validate_date($params, $fieldName, $fieldInfo);
break;
- case 32://blob
+ case 32:
+ //blob
_civicrm_api3_validate_html($params, $fieldName, $fieldInfo);
break;
if (strpos($op, 'NULL') !== FALSE || strpos($op, 'EMPTY') !== FALSE) {
break;
}
- foreach((array)$fieldValue as $fieldvalue) {
+ foreach ((array) $fieldValue as $fieldvalue) {
if (!CRM_Utils_Rule::money($fieldvalue) && !empty($fieldvalue)) {
throw new Exception($fieldName . " is not a valid amount: " . $params[$fieldName]);
}
* @throws \API_Exception
*/
function _civicrm_api3_validate_constraint(&$fieldValue, &$fieldName, &$fieldInfo) {
- $dao = new $fieldInfo['FKClassName'];
+ $daoName = $fieldInfo['FKClassName'];
+ $dao = new $daoName();
$dao->id = $fieldValue;
$dao->selectAdd();
$dao->selectAdd('id');
/**
* Translate the custom field data_type attribute into a std 'type'
* @param $dataType
- * @return
+ * @return int
*/
function _getStandardTypeFromCustomDataType($dataType) {
$mapping = array(
&& $uniqueName
&& $field != $uniqueName
&& array_key_exists($uniqueName, $apiRequest['params'])
- )
- {
+ ) {
$apiRequest['params'][$field] = CRM_Utils_Array::value($values['uniqueName'], $apiRequest['params']);
// note that it would make sense to unset the original field here but tests need to be in place first
}
if (!is_numeric($fieldValue) && is_scalar($fieldValue)) {
$realContactId = _civicrm_api3_resolve_contactID($fieldValue);
if ('unknown-user' === $realContactId) {
- throw new API_Exception("\"$fieldName\" \"{$fieldValue}\" cannot be resolved to a contact ID", 2002, array('error_field' => $fieldName,"type"=>"integer"));
- } elseif (is_numeric($realContactId)) {
+ throw new API_Exception("\"$fieldName\" \"{$fieldValue}\" cannot be resolved to a contact ID", 2002, array('error_field' => $fieldName, "type" => "integer"));
+ }
+ elseif (is_numeric($realContactId)) {
$fieldValue = $realContactId;
}
}
}
// Check our field length
- if(is_string($fieldValue) && !empty($fieldInfo['maxlength']) && strlen($fieldValue) > $fieldInfo['maxlength']
+ if (is_string($fieldValue) && !empty($fieldInfo['maxlength']) && strlen($fieldValue) > $fieldInfo['maxlength']
) {
throw new API_Exception( $fieldValue . " is " . strlen($fieldValue) . " characters - longer than $fieldName length" . $fieldInfo['maxlength'] . ' characters',
- 2100, array('field' => $fieldName, "max_length"=>$fieldInfo['maxlength'])
+ 2100, array('field' => $fieldName, "max_length" => $fieldInfo['maxlength'])
);
}
}
}
if ($fieldValue) {
if (!CRM_Utils_Rule::xssString($fieldValue)) {
- throw new API_Exception('Illegal characters in input (potential scripting attack)', array("field"=>$fieldName,"error_code"=>"xss"));
+ throw new API_Exception('Illegal characters in input (potential scripting attack)', array("field" => $fieldName, "error_code" => "xss"));
}
}
}
/**
* 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)
+ * @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) {
*
* @param array $params
* @param string $fieldName
- * @return string|int|boolean|date|null
+ * @return mixed
*/
function _civicrm_api3_field_value_check(&$params, $fieldName) {
$fieldValue = CRM_Utils_Array::value($fieldName, $params);
* in order to correct the condition where a contribution row is linked to > 1 membership.
*/
+/**
+ * Initialization
+ */
function initialize() {
session_start();
if (!function_exists('drush_get_context')) {
* In addition, there are several additional classes that inherit
* civicrm_cli to do more precise functions.
*
- **/
+ */
/**
* base class for doing all command line operations via civicrm
* used by cli.php
- **/
+ */
class civicrm_cli {
// required values that must be passed
// via the command line
/**
* class used by csv/export.php to export records from
* the database in a csv file format.
- **/
+ */
class civicrm_cli_csv_exporter extends civicrm_cli {
var $separator = ',';
/**
*/
- function __construct() {
+ public function __construct() {
$this->_required_arguments = array('entity');
parent::initialize();
}
- function run() {
+ public function run() {
$out = fopen("php://output", 'w');
fputcsv($out, $this->columns, $this->separator, '"');
* and civicrm_cli_csv_deleter to add or delete
* records based on those found in a csv file
* passed to the script.
- **/
+ */
class civicrm_cli_csv_file extends civicrm_cli {
var $header;
var $separator = ',';
/**
*/
- function __construct() {
+ public function __construct() {
$this->_required_arguments = array('entity', 'file');
$this->_additional_arguments = array('f' => 'file');
parent::initialize();
}
- function run() {
+ public function run() {
$this->row = 1;
$handle = fopen($this->_file, "r");
$this->processLine($params);
}
fclose($handle);
- return;
+ return NULL;
}
/* return a params as expected */
*
* @return array
*/
- function convertLine($data) {
+ public function convertLine($data) {
$params = array();
foreach ($this->header as $i => $field) {
//split any multiselect data, denoted with CRM_Core_DAO::VALUE_SEPARATOR
* class for processing records to add
* used by csv/import.php
*
- **/
+ */
class civicrm_cli_csv_importer extends civicrm_cli_csv_file {
/**
* @param array $params
*/
- function processline($params) {
+ public function processline($params) {
$result = civicrm_api($this->_entity, 'Create', $params);
if ($result['is_error']) {
echo "\nERROR line " . $this->row . ": " . $result['error_message'] . "\n";
* class for processing records to delete
* used by csv/delete.php
*
- **/
+ */
class civicrm_cli_csv_deleter extends civicrm_cli_csv_file {
/**
* @param array $params
*/
- function processline($params) {
+ public function processline($params) {
$result = civicrm_api($this->_entity, 'Delete', $params);
if ($result['is_error']) {
echo "\nERROR line " . $this->row . ": " . $result['error_message'] . "\n";
* php bin/csv/delete.php -e <entity> --file /path/to/csv/file [ -s site.org ]
* e.g.: php bin/csv/delete.php -e Contact --file /tmp/delete.csv
*
- **/
+ */
require_once dirname(__DIR__) . '/cli.class.php';
}
}
}
-
- return;
}
run();
echo
echo "Usage: setup.sh [options] [schema file] [database data file] [database name] [database user] [database password] [database host] [database port] [additional args]"
echo "[options] is a mix of zero or more of following:"
- echo " -a (All) Implies -Dgsdf (default)"
- echo " -D (Download) Download depdencies"
- echo " -g (GenCode) Generate DAO files, SQL files, etc"
- echo " -s (Schema) Load new schema in DB"
- echo " -d (Data) Load default data in DB"
- echo " -f (Flush) Flush caches and settings"
+ echo " -a (All) Implies -Dgsef (default)"
+ echo " -D (Download) Download dependencies"
+ echo " -g (GenCode) Generate DAO files, SQL files, etc"
+ echo " -s (Schema) Load new schema in DB"
+ echo " -d (Data-Plain) Load basic dataset in DB"
+ echo " -e (Data-Examples) Load example dataset in DB"
+ echo " -f (Flush) Flush caches and settings"
echo
echo "Example: Perform a full setup"
echo " setup.sh -a"
echo " setup.sh -Dg"
echo
echo "Example: Keep the existing code but reset the DB"
- echo " setup.sh -sdf"
+ echo " setup.sh -sef"
exit 0
fi
DO_SCHEMA=
DO_DATA=
DO_FLUSH=
+DEFAULT_DATA=
-while getopts "aDgsdf" opt; do
+while getopts "aDgsdef" opt; do
case $opt in
a)
DO_DOWNLOAD=1
;;
d)
DO_DATA=1
+ DEFAULT_DATA=civicrm_data.mysql
+ FOUND_ACTION=1
+ ;;
+ e)
+ DO_DATA=1
+ DEFAULT_DATA=civicrm_generated.mysql
FOUND_ACTION=1
;;
f)
DO_SCHEMA=1
DO_DATA=1
DO_FLUSH=1
+ DEFAULT_DATA=civicrm_generated.mysql
fi
shift $((OPTIND-1))
if [ -n "$DO_DATA" ]; then
pushd "$CALLEDPATH/../sql"
- # load civicrm_generated.mysql sample data unless special DBLOAD is passed
+ # load default data set unless system is configured with override
if [ -z $DBLOAD ]; then
- echo; echo Populating database with example data - civicrm_generated.mysql
- $MYSQLCMD < civicrm_generated.mysql
+ echo;
+ echo "Populating database with dataset - $DEFAULT_DATA"
+ $MYSQLCMD < "$DEFAULT_DATA"
else
echo; echo Populating database with required data - civicrm_data.mysql
$MYSQLCMD < civicrm_data.mysql
float:right;
}
#crm-container .widget-icon.close-icon {
+ background-position: -80px -128px;
float:right;
}
#crm-container .widget-icon:hover {
global $installType;
$installType = strtolower($_SESSION['civicrm_install_type']);
-if (!in_array($installType, array(
- 'drupal',
- 'wordpress'
-))
-) {
+if (!in_array($installType, array('drupal', 'wordpress'))) {
$errorTitle = "Oops! Unsupported installation mode";
$errorMsg = "";
errorDisplayPage($errorTitle, $errorMsg);
$errorMsg = "Please untar (uncompress) your downloaded copy of CiviCRM in the <strong>" . implode(CIVICRM_DIRECTORY_SEPARATOR, array(
'sites',
'all',
- 'modules'
+ 'modules',
)) . "</strong> directory below your Drupal root directory. Refer to the online " . $docLink . " for more information.";
errorDisplayPage($errorTitle, $errorMsg);
}
$errorMsg = "CiviCRM has already been installed in this Drupal site. <ul><li>To <strong>start over</strong>, you must delete or rename the existing CiviCRM settings file - <strong>civicrm.settings.php</strong> - from <strong>" . implode(CIVICRM_DIRECTORY_SEPARATOR, array(
'[your Drupal root directory]',
'sites',
- $siteDir
+ $siteDir,
)) . "</strong>.</li><li>To <strong>upgrade an existing installation</strong>, refer to the online " . $docLink . ".</li></ul>";
}
elseif ($installType == 'wordpress') {
* @param $databaseConfig
* @param $dbName
*/
- function checkdatabase($databaseConfig, $dbName) {
+ public function checkdatabase($databaseConfig, $dbName) {
if ($this->requireFunction('mysql_connect',
array(
"PHP Configuration",
/**
* Check everything except the database
*/
- function check() {
+ public function check() {
global $crmPath, $installType;
$this->errors = NULL;
"PHP Configuration",
"PHP5 installed",
NULL,
- "PHP version " . phpversion()
+ "PHP version " . phpversion(),
));
// Check that we can identify the root folder successfully
array(
"File permissions",
"$dir folder exists",
- "There is no $dir folder"
+ "There is no $dir folder",
), TRUE
);
}
$this->requireServerVariables(array('SCRIPT_NAME', 'HTTP_HOST', 'SCRIPT_FILENAME'), array(
"Webserver config",
"Recognised webserver",
- "You seem to be using an unsupported webserver. The server variables SCRIPT_NAME, HTTP_HOST, SCRIPT_FILENAME need to be set."
+ "You seem to be using an unsupported webserver. The server variables SCRIPT_NAME, HTTP_HOST, SCRIPT_FILENAME need to be set.",
));
// Check for MySQL support
* @param $recommended
* @param $testDetails
*/
- function requireMemory($min, $recommended, $testDetails) {
+ public function requireMemory($min, $recommended, $testDetails) {
$this->testing($testDetails);
$mem = $this->getPHPMemory();
/**
* @return float
*/
- function getPHPMemory() {
+ public function getPHPMemory() {
$memString = ini_get("memory_limit");
switch (strtolower(substr($memString, -1))) {
}
}
- function listErrors() {
+ public function listErrors() {
if ($this->errors) {
echo "<p>The following problems are preventing me from installing CiviCRM:</p>";
foreach ($this->errors as $error) {
/**
* @param null $section
*/
- function showTable($section = NULL) {
+ public function showTable($section = NULL) {
if ($section) {
$tests = $this->tests[$section];
echo "<table class=\"testResults\" width=\"100%\">";
*
* @return bool
*/
- function requireFunction($funcName, $testDetails) {
+ public function requireFunction($funcName, $testDetails) {
$this->testing($testDetails);
if (!function_exists($funcName)) {
/**
* @param $testDetails
*/
- function checkXCache($testDetails) {
+ public function checkXCache($testDetails) {
if (function_exists('xcache_isset') &&
ini_get('xcache.size') > 0
) {
* @param $testDetails
* @param null $maxVersion
*/
- function requirePHPVersion($minVersion, $testDetails, $maxVersion = NULL) {
+ public function requirePHPVersion($minVersion, $testDetails, $maxVersion = NULL) {
$this->testing($testDetails);
* @param $testDetails
* @param bool $absolute
*/
- function requireFile($filename, $testDetails, $absolute = FALSE) {
+ public function requireFile($filename, $testDetails, $absolute = FALSE) {
$this->testing($testDetails);
if (!$absolute) {
$filename = $this->getBaseDir() . $filename;
/**
* @param $testDetails
*/
- function requireNoPathSeparator($testDetails) {
+ public function requireNoPathSeparator($testDetails) {
$this->testing($testDetails);
if (substr_count($this->getBaseDir(), PATH_SEPARATOR)) {
$this->error($testDetails);
* @param string $filename
* @param $testDetails
*/
- function requireNoFile($filename, $testDetails) {
+ public function requireNoFile($filename, $testDetails) {
$this->testing($testDetails);
$filename = $this->getBaseDir() . $filename;
if (file_exists($filename)) {
* @param string $filename
* @param $testDetails
*/
- function moveFileOutOfTheWay($filename, $testDetails) {
+ public function moveFileOutOfTheWay($filename, $testDetails) {
$this->testing($testDetails);
$filename = $this->getBaseDir() . $filename;
if (file_exists($filename)) {
* @param $testDetails
* @param bool $absolute
*/
- function requireWriteable($filename, $testDetails, $absolute = FALSE) {
+ public function requireWriteable($filename, $testDetails, $absolute = FALSE) {
$this->testing($testDetails);
if (!$absolute) {
$filename = $this->getBaseDir() . $filename;
* @param string $moduleName
* @param $testDetails
*/
- function requireApacheModule($moduleName, $testDetails) {
+ public function requireApacheModule($moduleName, $testDetails) {
$this->testing($testDetails);
if (!in_array($moduleName, apache_get_modules())) {
$this->error($testDetails);
* @param $password
* @param $testDetails
*/
- function requireMysqlConnection($server, $username, $password, $testDetails) {
+ public function requireMysqlConnection($server, $username, $password, $testDetails) {
$this->testing($testDetails);
$conn = @mysql_connect($server, $username, $password);
* @param $server
* @param $testDetails
*/
- function requireMySQLServer($server, $testDetails) {
+ public function requireMySQLServer($server, $testDetails) {
$this->testing($testDetails);
$conn = @mysql_connect($server, NULL, NULL);
* @param $version
* @param $testDetails
*/
- function requireMySQLVersion($version, $testDetails) {
+ public function requireMySQLVersion($version, $testDetails) {
$this->testing($testDetails);
if (!mysql_get_server_info()) {
* @param $database
* @param $testDetails
*/
- function requireMySQLInnoDB($server, $username, $password, $database, $testDetails) {
+ public function requireMySQLInnoDB($server, $username, $password, $database, $testDetails) {
$this->testing($testDetails);
$conn = @mysql_connect($server, $username, $password);
if (!$conn) {
* @param $database
* @param $testDetails
*/
- function requireMySQLTempTables($server, $username, $password, $database, $testDetails) {
+ public function requireMySQLTempTables($server, $username, $password, $database, $testDetails) {
$this->testing($testDetails);
$conn = @mysql_connect($server, $username, $password);
if (!$conn) {
* @param $database
* @param $testDetails
*/
- function requireMySQLTrigger($server, $username, $password, $database, $testDetails) {
+ public function requireMySQLTrigger($server, $username, $password, $database, $testDetails) {
$this->testing($testDetails);
$conn = @mysql_connect($server, $username, $password);
if (!$conn) {
* @param $database
* @param $testDetails
*/
- function requireMySQLLockTables($server, $username, $password, $database, $testDetails) {
+ public function requireMySQLLockTables($server, $username, $password, $database, $testDetails) {
$this->testing($testDetails);
$conn = @mysql_connect($server, $username, $password);
if (!$conn) {
}
$result = mysql_query('DROP TEMPORARY TABLE civicrm_install_temp_table_test');
- return;
}
/**
* @param $password
* @param $testDetails
*/
- function requireMySQLAutoIncrementIncrementOne($server, $username, $password, $testDetails) {
+ public function requireMySQLAutoIncrementIncrementOne($server, $username, $password, $testDetails) {
$this->testing($testDetails);
$conn = @mysql_connect($server, $username, $password);
if (!$conn) {
* @param $minValueKB
* @param $testDetails
*/
- function requireMySQLThreadStack($server, $username, $password, $database, $minValueKB, $testDetails) {
+ public function requireMySQLThreadStack($server, $username, $password, $database, $minValueKB, $testDetails) {
$this->testing($testDetails);
$conn = @mysql_connect($server, $username, $password);
if (!$conn) {
* @param $testDetails
* @param bool $onlyRequire
*/
- function requireDatabaseOrCreatePermissions(
+ public function requireDatabaseOrCreatePermissions(
$server,
$username,
$password,
* @param $varNames
* @param $errorMessage
*/
- function requireServerVariables($varNames, $errorMessage) {
+ public function requireServerVariables($varNames, $errorMessage) {
//$this->testing($testDetails);
foreach ($varNames as $varName) {
if (!$_SERVER[$varName]) {
*
* @return bool
*/
- function isRunningApache($testDetails) {
+ public function isRunningApache($testDetails) {
$this->testing($testDetails);
if (function_exists('apache_get_modules') || stristr($_SERVER['SERVER_SIGNATURE'], 'Apache')) {
return TRUE;
/**
* @return string
*/
- function getBaseDir() {
+ public function getBaseDir() {
return dirname($_SERVER['SCRIPT_FILENAME']) . CIVICRM_DIRECTORY_SEPARATOR;
}
/**
* @param $testDetails
*/
- function testing($testDetails) {
+ public function testing($testDetails) {
if (!$testDetails) {
return;
}
/**
* @param $testDetails
*/
- function error($testDetails) {
+ public function error($testDetails) {
$section = $testDetails[0];
$test = $testDetails[1];
/**
* @param $testDetails
*/
- function warning($testDetails) {
+ public function warning($testDetails) {
$section = $testDetails[0];
$test = $testDetails[1];
/**
* @return int
*/
- function hasErrors() {
- return sizeof($this->errors);
+ public function hasErrors() {
+ return count($this->errors);
}
/**
* @return int
*/
- function hasWarnings() {
- return sizeof($this->warnings);
+ public function hasWarnings() {
+ return count($this->warnings);
}
}
* @param $password
* @param $database
*/
- function createDatabaseIfNotExists($server, $username, $password, $database) {
+ public function createDatabaseIfNotExists($server, $username, $password, $database) {
$conn = @mysql_connect($server, $username, $password);
if (@mysql_select_db($database)) {
*
* @return mixed
*/
- function install($config) {
+ public function install($config) {
global $installDirPath;
// create database if does not exists
foreach (array_diff($perms, $allPerms) as $perm) {
watchdog('civicrm',
'Cannot grant the %perm permission because it does not yet exist.',
- array(
- '%perm' => $perm
- ), WATCHDOG_ERROR
+ array('%perm' => $perm),
+ WATCHDOG_ERROR
);
}
$perms = array_intersect($perms, $allPerms);
p.warning {
padding: 0.5em;
background-color: #e70;
- border: 1px #A70 solid;
+ border: 1px #a70 solid;
color: white;
clear: both;
}
'is_contact' => 0,
'description' => "Set this value to Yes if you want CiviCRM error/debugging messages to also appear in Drupal error logs",
'prefetch' => 1,
- 'help_text' => "Set this value to Yes if you want CiviCRM error/debugging messages the appear in your CMS' error log.
-In the case of Drupal, this will cause all CiviCRM error messages to appear in the watchdog (assuming you have Drupal's watchdog enabled)",
+ 'help_text' => "Set this value to Yes if you want CiviCRM error/debugging messages the appear in your CMS' error log. In the case of Drupal, this will cause all CiviCRM error messages to appear in the watchdog (assuming you have Drupal's watchdog enabled)",
),
'backtrace' => array(
'group_name' => 'Developer Preferences',
LOCK TABLES `civicrm_domain` WRITE;
/*!40000 ALTER TABLE `civicrm_domain` DISABLE KEYS */;
-INSERT INTO `civicrm_domain` (`id`, `name`, `description`, `config_backend`, `version`, `contact_id`, `locales`, `locale_custom_strings`) VALUES (1,'Default Domain Name',NULL,NULL,'4.6.alpha2',1,NULL,'a:1:{s:5:\"en_US\";a:0:{}}');
+INSERT INTO `civicrm_domain` (`id`, `name`, `description`, `config_backend`, `version`, `contact_id`, `locales`, `locale_custom_strings`) VALUES (1,'Default Domain Name',NULL,NULL,'4.6.alpha3',1,NULL,'a:1:{s:5:\"en_US\";a:0:{}}');
/*!40000 ALTER TABLE `civicrm_domain` ENABLE KEYS */;
UNLOCK TABLES;
/**
* @param $formValues
*/
- function __construct(&$formValues) {
+ public function __construct(&$formValues) {
parent::__construct($formValues);
}
* Modifiable.
* @return void
*/
- function buildForm(&$form) {
+ public function buildForm(&$form) {
CRM_Utils_System::setTitle(ts('My Search Title'));
$form->add('text',
* - summary: string
* - total: numeric
*/
- function summary() {
+ public function summary() {
return NULL;
// return array(
// 'summary' => 'This is a summary',
*
* @return array, keys are printable column headers and values are SQL column names
*/
- function &columns() {
+ public function &columns() {
// return by reference
$columns = array(
ts('Contact ID') => 'contact_id',
*
* @return string, sql
*/
- function all($offset = 0, $rowcount = 0, $sort = NULL, $includeContactIDs = FALSE) {
+ public function all($offset = 0, $rowcount = 0, $sort = NULL, $includeContactIDs = FALSE) {
// delegate to $this->sql(), $this->select(), $this->from(), $this->where(), etc.
return $this->sql($this->select(), $offset, $rowcount, $sort, $includeContactIDs, NULL);
}
*
* @return string, sql fragment with SELECT arguments
*/
- function select() {
+ public function select() {
return "
contact_a.id as contact_id ,
contact_a.contact_type as contact_type,
*
* @return string, sql fragment with FROM and JOIN clauses
*/
- function from() {
+ public function from() {
return "
FROM civicrm_contact contact_a
LEFT JOIN civicrm_address address ON ( address.contact_id = contact_a.id AND
*
* @return string, sql fragment with conditional expressions
*/
- function where($includeContactIDs = FALSE) {
+ public function where($includeContactIDs = FALSE) {
$params = array();
$where = "contact_a.contact_type = 'Household'";
*
* @return string, template path (findable through Smarty template path)
*/
- function templateFile() {
+ public function templateFile() {
return 'CRM/Contact/Form/Search/Custom.tpl';
}
* Modifiable SQL result row.
* @return void
*/
- function alterRow(&$row) {
+ public function alterRow(&$row) {
$row['sort_name'] .= ' ( altered )';
}
*/
private static function getInstance() {
if (is_null(self::$instance)) {
- self::$instance = new self;
+ self::$instance = new self();
}
return self::$instance;
}
*/
private static function getInstance() {
if (is_null(self::$instance)) {
- self::$instance = new self;
+ self::$instance = new self();
}
return self::$instance;
}
*/
private static function getInstance() {
if (is_null(self::$instance)) {
- self::$instance = new self;
+ self::$instance = new self();
}
return self::$instance;
}
* @package CiviCRM
*/
class CRM_Bridge_OG_DrupalTest extends CiviUnitTestCase {
- /*
+ /**
* Test that one (ane only one) role (option value) is deleted by the updateCiviACLRole function
*/
public function testACLRoleDeleteFunctionality() {
*/
private static function getInstance() {
if (is_null(self::$instance)) {
- self::$instance = new self;
+ self::$instance = new CiviTestSuite();
}
return self::$instance;
}
* Class CRM_Contact_BAO_ContactTest
*/
class CRM_Contact_BAO_ContactTest extends CiviUnitTestCase {
+
+ /**
+ * Set up function.
+ */
public function setUp() {
parent::setUp();
}
/**
- * Test case for add( )
+ * Test case for add( ).
+ *
* test with empty params.
*/
public function testAddWithEmptyParams() {
$params = array();
$contact = CRM_Contact_BAO_Contact::add($params);
- //Now check Contact object
+ // Now check Contact object.
$this->assertNull($contact);
}
/**
- * Test case for add( )
- * test with names
- * (create and update modes)
+ * Test case for add( ).
+ *
+ * Test with names (create and update modes)
*/
public function testAddWithNames() {
$firstName = 'Shane';
$contact = CRM_Contact_BAO_Contact::add($params);
- //Now check $contact is object of contact DAO..
+ // Now check $contact is object of contact DAO.
$this->assertInstanceOf('CRM_Contact_DAO_Contact', $contact, 'Check for created object');
$this->assertEquals($firstName, $contact->first_name, 'Check for first name creation.');
$this->assertEquals($lastName, $contact->last_name, 'Check for last name creation.');
$contactId = $contact->id;
- //update and change first name and last name, using add( )
+ // Update and change first name and last name, using add( ).
$firstName = 'Jane';
$params = array(
'first_name' => $firstName,
$contact = CRM_Contact_BAO_Contact::add($params);
- //Now check $contact is object of contact DAO..
+ // Now check $contact is object of contact DAO.
$this->assertInstanceOf('CRM_Contact_DAO_Contact', $contact, 'Check for created object');
$this->assertEquals($firstName, $contact->first_name, 'Check for updated first name.');
}
/**
- * Test case for add( )
- * test with all contact params
- * (creat and update modes)
+ * Test case for add.
+ *
+ * Test with all contact params
+ * (create and update modes)
*/
public function testAddWithAll() {
- //take the common contact params
+ // Take the common contact params.
$params = $this->contactParams();
unset($params['location']);
$prefComm = $params['preferred_communication_method'];
-
- //create the contact using add()
$contact = CRM_Contact_BAO_Contact::add($params);
$contactId = $contact->id;
- //Now check $contact is object of contact DAO..
$this->assertInstanceOf('CRM_Contact_DAO_Contact', $contact, 'Check for created object');
- //Now check values of object with params.
$this->assertEquals($params['first_name'], $contact->first_name, 'Check for first name creation.');
$this->assertEquals($params['last_name'], $contact->last_name, 'Check for last name creation.');
$this->assertEquals($params['middle_name'], $contact->middle_name, 'Check for middle name creation.');
}
$this->assertAttributesEquals($checkPrefComm, $prefComm);
- //now update the contact using add( )
$updateParams = array(
'contact_type' => 'Individual',
'first_name' => 'Jane',
$prefComm = $updateParams['preferred_communication_method'];
$updateParams['contact_id'] = $contactId;
- //create the contact using add()
$contact = CRM_Contact_BAO_Contact::create($updateParams);
$contactId = $contact->id;
- //Now check $contact is object of contact DAO..
$this->assertInstanceOf('CRM_Contact_DAO_Contact', $contact, 'Check for created object');
- //Now check values of object with params.
$this->assertEquals($updateParams['first_name'], $contact->first_name, 'Check for first name creation.');
$this->assertEquals($updateParams['last_name'], $contact->last_name, 'Check for last name creation.');
$this->assertEquals($updateParams['middle_name'], $contact->middle_name, 'Check for middle name creation.');
}
$this->assertAttributesEquals($checkPrefComm, $prefComm);
- //cleanup DB by deleting the contact
Contact::delete($contactId);
}
/**
- * Test case for add( )
- * test with All contact types.
+ * Test case for add( ) with All contact types.
*/
public function testAddWithAllContactTypes() {
$firstName = 'Bill';
}
/**
- * Test case for create( )
- * test with missing params.
+ * Test case for create.
+ *
+ * Test with missing params.
*/
public function testCreateWithEmptyParams() {
$params = array(
}
/**
- * Test case for create( )
- * test with all params.
+ * Test case for create.
+ *
+ * Test with all params.
* ( create and update modes ).
*/
public function testCreateWithAll() {
);
$compareParams = array('phone' => '9766323895');
$this->assertDBCompareValues('CRM_Core_DAO_Phone', $searchParams, $compareParams);
- //As we are not updating note
- //Now check DB for New Note
- $noteId = $this->assertDBNotNull('CRM_Core_DAO_Note', $updateParams['note'], 'id', 'note',
+ // As we are not updating note.
+ // Now check DB for New Note.
+ $this->assertDBNotNull('CRM_Core_DAO_Note', $updateParams['note'], 'id', 'note',
'Database check for New created note '
);
- //delete all notes related to contact
+ // Delete all notes related to contact.
CRM_Core_BAO_Note::cleanContactNotes($contactId);
- //cleanup DB by deleting the contact
+ // Cleanup DB by deleting the contact.
Contact::delete($contactId);
$this->quickCleanup(array('civicrm_contact', 'civicrm_note'));
}
/**
- * Test case for resolveDefaults( )
- * test all pseudoConstant, stateProvince, country.
+ * Test case for resolveDefaults( ).
+ *
+ * Test all pseudoConstant, stateProvince, country.
*/
public function testResolveDefaults() {
$params = array(
}
/**
- * Test case for retrieve( )
- * test with all values.
+ * Test case for retrieve( ).
+ *
+ * Test with all values.
*/
public function testRetrieve() {
//take the common contact params
}
/**
- * Test case for deleteContact( )
+ * Test case for deleteContact( ).
*/
public function testDeleteContact() {
$contactParams = $this->contactParams();
}
/**
- * Test case for createProfileContac( )
- * test with all params.
- * ( create and update modes )
+ * Test case for createProfileContact.
*/
public function testCreateProfileContact() {
$fields = CRM_Contact_BAO_Contact::exportableFields('Individual');
}
/**
- * Test case for getContactDetails( )
+ * Test case for getContactDetails( ).
*/
public function testGetContactDetails() {
//get the contact params
}
/**
- * Test case for
- * importableFields( ) and exportableFields( )
+ * Test case for importableFields( ) and exportableFields( ).
*/
public function testFields() {
$allImpFileds = CRM_Contact_BAO_Contact::importableFields('All');
}
/**
- * Test case for getPrimaryEmail( )
+ * Test case for getPrimaryEmail.
*/
public function testGetPrimaryEmail() {
//get the contact params
}
/**
- * Test case for getPrimaryOpenId( )
+ * Test case for getPrimaryOpenId( ).
*/
public function testGetPrimaryOpenId() {
//get the contact params
}
/**
- * Test case for matchContactOnEmail( )
+ * Test case for matchContactOnEmail( ).
*/
public function testMatchContactOnEmail() {
//get the contact params
}
/**
- * Test case for getContactType( )
+ * Test case for getContactType( ).
*/
public function testGetContactType() {
//get the contact params
}
/**
- * Test case for displayName( )
+ * Test case for displayName( ).
*/
public function testDisplayName() {
//get the contact params
}
/**
- * Test case for getDisplayAndImage( )
+ * Test case for getDisplayAndImage( ).
*/
public function testGetDisplayAndImage() {
//get the contact params
Contact::delete($contactId);
}
- // /**
- // * test logged in user has permissions for
- // * various operation types
- // */
- // function testPermissionedContact()
- // {
- // $contactId = Contact::createIndividual();
- // require_once 'CRM/Contact/BAO/Contact/Permission.php';
- // $userViewPermission = CRM_Contact_BAO_Contact_Permission::allow($contactId);
- // $this->assertEquals( $userViewPermission, true, 'Check user for view contact permission.' );
- //
- // $userEditPermission = CRM_Contact_BAO_Contact_Permission::allow($contactId, CRM_Core_Permission::EDIT);
- // $this->assertEquals( $userEditPermission, true, 'Check user for edit contact permission.' );
- //
- // Contact::delete($contactId);
- // }
-
/**
- * Build common params
+ * Build common params.
*/
private function contactParams() {
}
/**
- * Ensure that created_date and modified_date are set
+ * Ensure that created_date and modified_date are set.
*/
- public function testTimestamps_contact() {
+ public function testTimestampContact() {
$test = $this;
$this->_testTimestamps(array(
'UPDATE' => function ($contactId) use ($test) {
'contact_type' => 'Individual',
'contact_id' => $contactId,
);
- $contact = CRM_Contact_BAO_Contact::add($params);
- $test->assertInstanceOf('CRM_Contact_DAO_Contact', $contact, 'Check for created object');
+ $contact = CRM_Contact_BAO_Contact::add($params);
+ $test->assertInstanceOf('CRM_Contact_DAO_Contact', $contact, 'Check for created object');
},
));
}
/**
- * Ensure that civicrm_contact.modified_date is updated when manipulating a phone record
+ * Ensure that civicrm_contact.modified_date is updated when manipulating a phone record.
*/
- public function testTimestamps_email() {
+ public function testTimestampsEmail() {
$test = $this;
$this->_testTimestamps(array(
'INSERT' => function ($contactId) use ($test) {
}
/**
- * Ensure that civicrm_contact.modified_date is updated when manipulating an email
+ * Ensure that civicrm_contact.modified_date is updated when manipulating an email.
*/
- public function testTimestamps_phone() {
+ public function testTimestampsPhone() {
$test = $this;
$this->_testTimestamps(array(
'INSERT' => function ($contactId) use ($test) {
}
/**
- * Ensure that civicrm_contact.modified_date is updated when contact-related
- * custom data
+ * Ensure that civicrm_contact.modified_date is updated correctly.
+ *
+ * Looking at it when contact-related custom data is updated.
*/
- public function testTimestamps_custom() {
+ public function testTimestampsCustom() {
$customGroup = Custom::createGroup(array(), 'Individual');
$this->assertNotNull($customGroup);
$fields = array(
* @return CRM_Contact_Form_Search_Custom_GroupTestDataProvider
*/
public function dataProvider() {
- return new CRM_Contact_Form_Search_Custom_GroupTestDataProvider;
+ return new CRM_Contact_Form_Search_Custom_GroupTestDataProvider();
}
public function setUp() {
*/
private static function getInstance() {
if (is_null(self::$instance)) {
- self::$instance = new self;
+ self::$instance = new self();
}
return self::$instance;
}
* Class CRM_Core_BAO_ActionScheduleTest
*/
class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase {
+
/**
* @var object see CiviTest/CiviMailUtils
*/
- var $mut;
+ public $mut;
public function setUp() {
parent::setUp();
require_once 'CiviTest/CiviMailUtils.php';
$this->mut = new CiviMailUtils($this, TRUE);
- $this->fixtures['rolling_membership'] = array(// createTestObject
+ $this->fixtures['rolling_membership'] = array(
'membership_type_id' => array(
'period_type' => 'rolling',
'duration_unit' => 'month',
'is_override' => 0,
);
- $this->fixtures['rolling_membership_past'] = array(// createTestObject
+ $this->fixtures['rolling_membership_past'] = array(
'membership_type_id' => array(
'period_type' => 'rolling',
'duration_unit' => 'month',
'is_override' => 'NULL',
);
- $this->fixtures['phonecall'] = array(// createTestObject
+ $this->fixtures['phonecall'] = array(
'status_id' => 1,
'activity_type_id' => 2,
'activity_date_time' => '20120615100000',
'is_current_revision' => 1,
'is_deleted' => 0,
);
- $this->fixtures['contact'] = array(// API
+ $this->fixtures['contact'] = array(
'is_deceased' => 0,
'contact_type' => 'Individual',
'email' => 'test-member@example.com',
);
- $this->fixtures['contact_birthdate'] = array(// API
+ $this->fixtures['contact_birthdate'] = array(
'is_deceased' => 0,
'contact_type' => 'Individual',
'email' => 'test-bday@example.com',
'birth_date' => '20050707',
);
- $this->fixtures['sched_activity_1day'] = array(// create()
+ $this->fixtures['sched_activity_1day'] = array(
'name' => 'One_Day_Phone_Call_Notice',
'title' => 'One Day Phone Call Notice',
'limit_to' => '1',
'start_action_unit' => 'day',
'subject' => '1-Day (repeating)',
);
- $this->fixtures['sched_membership_join_2week'] = array(// create()
+ $this->fixtures['sched_membership_join_2week'] = array(
'name' => 'sched_membership_join_2week',
'title' => 'sched_membership_join_2week',
'absolute_date' => '',
'start_action_unit' => 'week',
'subject' => 'subject sched_membership_join_2week',
);
- $this->fixtures['sched_membership_end_2week'] = array(// create()
+ $this->fixtures['sched_membership_end_2week'] = array(
'name' => 'sched_membership_end_2week',
'title' => 'sched_membership_end_2week',
'absolute_date' => '',
'subject' => 'subject sched_membership_end_2week',
);
- $this->fixtures['sched_membership_end_2month'] = array(// create()
+ $this->fixtures['sched_membership_end_2month'] = array(
'name' => 'sched_membership_end_2month',
'title' => 'sched_membership_end_2month',
'absolute_date' => '',
'subject' => 'subject sched_membership_end_2month',
);
- $this->fixtures['sched_contact_bday_yesterday'] = array(// create()
+ $this->fixtures['sched_contact_bday_yesterday'] = array(
'name' => 'sched_contact_bday_yesterday',
'title' => 'sched_contact_bday_yesterday',
'absolute_date' => '',
'subject' => 'subject sched_contact_bday_yesterday',
);
- $this->fixtures['sched_contact_bday_anniv'] = array(// create()
+ $this->fixtures['sched_contact_bday_anniv'] = array(
'name' => 'sched_contact_bday_anniv',
'title' => 'sched_contact_bday_anniv',
'absolute_date' => '',
'subject' => 'subject sched_contact_bday_anniv',
);
- $this->fixtures['sched_contact_grad_tomorrow'] = array(// create()
+ $this->fixtures['sched_contact_grad_tomorrow'] = array(
'name' => 'sched_contact_grad_tomorrow',
'title' => 'sched_contact_grad_tomorrow',
'absolute_date' => '',
'subject' => 'subject sched_contact_grad_tomorrow',
);
- $this->fixtures['sched_contact_grad_anniv'] = array(// create()
+ $this->fixtures['sched_contact_grad_anniv'] = array(
'name' => 'sched_contact_grad_anniv',
'title' => 'sched_contact_grad_anniv',
'absolute_date' => '',
'start_action_unit' => 'week',
'subject' => 'subject sched_contact_grad_anniv',
);
- $this->fixtures['sched_membership_end_2month_repeat_twice_4_weeks'] = array(// create()
+ $this->fixtures['sched_membership_end_2month_repeat_twice_4_weeks'] = array(
'name' => 'sched_membership_end_2month',
'title' => 'sched_membership_end_2month',
'absolute_date' => '',
'start_action_unit' => 'month',
'subject' => 'subject sched_membership_end_2month',
);
- $this->fixtures['sched_membership_end_limit_to_none'] = array(// create()
+ $this->fixtures['sched_membership_end_limit_to_none'] = array(
'name' => 'limit to none',
'title' => 'limit to none',
'absolute_date' => '',
/**
* Tears down the fixture, for example, closes a network connection.
+ *
* This method is called after a test is executed.
*/
public function tearDown() {
$this->mut->clearMessages();
$this->mut->stop();
unset($this->mut);
- $this->quickCleanup(array('civicrm_action_schedule', 'civicrm_action_log', 'civicrm_membership', 'civicrm_email'));
+ $this->quickCleanup(array(
+ 'civicrm_action_schedule',
+ 'civicrm_action_log',
+ 'civicrm_membership',
+ 'civicrm_email',
+ ));
$this->_tearDown();
}
- public function testActivityDateTime_Match_NonRepeatableSchedule() {
+ public function testActivityDateTimeMatchNonRepeatableSchedule() {
$actionScheduleDao = CRM_Core_BAO_ActionSchedule::add($this->fixtures['sched_activity_1day']);
$this->assertTrue(is_numeric($actionScheduleDao->id));
$activityContact->save();
$this->assertCronRuns(array(
- array(// Before the 24-hour mark, no email
+ array(
+ // Before the 24-hour mark, no email
'time' => '2012-06-14 04:00:00',
'recipients' => array(),
),
- array(// After the 24-hour mark, an email
+ array(
+ // After the 24-hour mark, an email
'time' => '2012-06-14 15:00:00',
'recipients' => array(array('test-member@example.com')),
),
- array(// Run cron again; message already sent
+ array(
+ // Run cron again; message already sent
'time' => '',
'recipients' => array(),
),
));
}
- public function testActivityDateTime_Match_RepeatableSchedule() {
+ public function testActivityDateTimeMatchRepeatableSchedule() {
$actionScheduleDao = CRM_Core_BAO_ActionSchedule::add($this->fixtures['sched_activity_1day_r']);
$this->assertTrue(is_numeric($actionScheduleDao->id));
$activityContact->save();
$this->assertCronRuns(array(
- array(// Before the 24-hour mark, no email
+ array(
+ // Before the 24-hour mark, no email
'time' => '012-06-14 04:00:00',
'recipients' => array(),
),
- array(// After the 24-hour mark, an email
+ array(
+ // After the 24-hour mark, an email
'time' => '2012-06-14 15:00:00',
'recipients' => array(array('test-member@example.com')),
),
- array(// Run cron 4 hours later; first message already sent
+ array(
+ // Run cron 4 hours later; first message already sent
'time' => '2012-06-14 20:00:00',
'recipients' => array(),
),
- array(// Run cron 6 hours later; send second message
+ array(
+ // Run cron 6 hours later; send second message.
'time' => '2012-06-14 21:00:01',
'recipients' => array(array('test-member@example.com')),
),
* For contacts/members which match schedule based on join date,
* an email should be sent.
*/
- public function testMembershipJoinDate_Match() {
+ public function testMembershipJoinDateMatch() {
$membership = $this->createTestObject('CRM_Member_DAO_Membership', array_merge($this->fixtures['rolling_membership'], array('status_id' => 1)));
$this->assertTrue(is_numeric($membership->id));
$result = $this->callAPISuccess('Email', 'create', array(
// start_date=2012-03-15 ; schedule is 2 weeks after start_date
$this->assertCronRuns(array(
- array(// Before the 2-week mark, no email
+ array(
+ // Before the 2-week mark, no email.
'time' => '2012-03-28 01:00:00',
'recipients' => array(),
),
- array(// After the 2-week mark, send an email
+ array(
+ // After the 2-week mark, send an email.
'time' => '2012-03-29 01:00:00',
'recipients' => array(array('test-member@example.com')),
),
}
/**
+ * Test end date email sent.
+ *
* For contacts/members which match schedule based on join date,
* an email should be sent.
*/
- public function testMembershipJoinDate_NonMatch() {
+ public function testMembershipJoinDateNonMatch() {
$membership = $this->createTestObject('CRM_Member_DAO_Membership', $this->fixtures['rolling_membership']);
$this->assertTrue(is_numeric($membership->id));
$result = $this->callAPISuccess('Email', 'create', array(
// start_date=2012-03-15 ; schedule is 2 weeks after start_date
$this->assertCronRuns(array(
- array(// After the 2-week mark, don't send email because we have different membership type
+ array(
+ // After the 2-week mark, don't send email because we have different membership type.
'time' => '2012-03-29 01:00:00',
'recipients' => array(),
),
}
/**
- * Test that the first and SECOND notifications are sent out
+ * Test that the first and SECOND notifications are sent out.
*/
- public function testMembershipEndDate_Repeat() {
+ public function testMembershipEndDateRepeat() {
// creates membership with end_date = 20120615
$membership = $this->createTestObject('CRM_Member_DAO_Membership', array_merge($this->fixtures['rolling_membership'], array('status_id' => 2)));
$result = $this->callAPISuccess('Email', 'create', array(
// end_date=2012-06-15 ; schedule is 2 weeks before end_date
$this->assertCronRuns(array(
- array(// After the 2-week mark, send an email
+ array(
+ // After the 2-week mark, send an email.
'time' => '2012-08-15 01:00:00',
'recipients' => array(array('test-member@example.com')),
),
- array(// After the 2-week mark, send an email
+ array(
+ // After the 2-week mark, send an email.
'time' => '2012-09-12 01:00:00',
'recipients' => array(array('test-member@example.com')),
),
}
/**
+ * Test behaviour when date changes.
+ *
* Test that the first notification is sent but the second is NOT sent if the end date changes in
* between
* see CRM-15376
*/
- public function testMembershipEndDate_Repeat_ChangedEndDate_CRM_15376() {
+ public function testMembershipEndDateRepeatChangedEndDate_CRM_15376() {
// creates membership with end_date = 20120615
$membership = $this->createTestObject('CRM_Member_DAO_Membership', array_merge($this->fixtures['rolling_membership'], array('status_id' => 2)));
$this->callAPISuccess('Email', 'create', array(
$this->callAPISuccess('action_schedule', 'create', $actionSchedule);
// end_date=2012-06-15 ; schedule is 2 weeks before end_date
$this->assertCronRuns(array(
- array(// After the 2-week mark, send an email
+ array(
+ // After the 2-week mark, send an email.
'time' => '2012-08-15 01:00:00',
'recipients' => array(array('test-member@example.com')),
),
));
- //extend membership - reminder should NOT go out
+ // Extend membership - reminder should NOT go out.
$this->callAPISuccess('membership', 'create', array('id' => $membership->id, 'end_date' => '2014-01-01'));
$this->assertCronRuns(array(
- array(// After the 2-week mark, send an email
+ array(
+ // After the 2-week mark, send an email.
'time' => '2012-09-12 01:00:00',
'recipients' => array(),
),
}
/**
+ * Test membership end date email sends.
+ *
* For contacts/members which match schedule based on end date,
* an email should be sent.
*/
- public function testMembershipEndDate_Match() {
+ public function testMembershipEndDateMatch() {
// creates membership with end_date = 20120615
$membership = $this->createTestObject('CRM_Member_DAO_Membership', array_merge($this->fixtures['rolling_membership'], array('status_id' => 2)));
$this->assertTrue(is_numeric($membership->id));
// end_date=2012-06-15 ; schedule is 2 weeks before end_date
$this->assertCronRuns(array(
- array(// Before the 2-week mark, no email
+ array(
+ // Before the 2-week mark, no email.
'time' => '2012-05-31 01:00:00',
- // 'time' => '2012-06-01 01:00:00', // FIXME: Is this the right boundary?
+ // 'time' => '2012-06-01 01:00:00',
+ // FIXME: Is this the right boundary?
'recipients' => array(),
),
- array(// After the 2-week mark, send an email
+ array(
+ // After the 2-week mark, send an email.
'time' => '2012-06-01 01:00:00',
'recipients' => array(array('test-member@example.com')),
),
/**
+ * Test membership end date email.
+ *
* For contacts/members which match schedule based on end date,
* an email should be sent.
*/
- public function testMembershipEndDate_NoMatch() {
+ public function testMembershipEndDateNoMatch() {
// creates membership with end_date = 20120615
$membership = $this->createTestObject('CRM_Member_DAO_Membership', array_merge($this->fixtures['rolling_membership_past'], array('status_id' => 3)));
$this->assertTrue(is_numeric($membership->id));
// end_date=2012-06-15 ; schedule is 2 weeks before end_date
$this->assertCronRuns(array(
- array(// Before the 2-week mark, no email
+ array(
+ // Before the 2-week mark, no email.
'time' => '2012-05-31 01:00:00',
- // 'time' => '2012-06-01 01:00:00', // FIXME: Is this the right boundary?
+ // 'time' => '2012-06-01 01:00:00',
+ // FIXME: Is this the right boundary?
'recipients' => array(),
),
- array(// After the 2-week mark, send an email
+ array(
+ // After the 2-week mark, send an email.
'time' => '2013-05-01 01:00:00',
'recipients' => array(),
),
));
}
- public function testContactBirthDate_noAnniv() {
+ public function testContactBirthDateNoAnniv() {
$contact = $this->callAPISuccess('Contact', 'create', $this->fixtures['contact_birthdate']);
$this->_testObjects['CRM_Contact_DAO_Contact'][] = $contact['id'];
$actionSchedule = $this->fixtures['sched_contact_bday_yesterday'];
$actionScheduleDao = CRM_Core_BAO_ActionSchedule::add($actionSchedule);
$this->assertTrue(is_numeric($actionScheduleDao->id));
$this->assertCronRuns(array(
- array(// On the birthday, no email
+ array(
+ // On the birthday, no email.
'time' => '2005-07-07 01:00:00',
'recipients' => array(),
),
- array(// The next day, send an email
+ array(
+ // The next day, send an email.
'time' => '2005-07-08 20:00:00',
'recipients' => array(array('test-bday@example.com')),
),
));
}
- public function testContactBirthDate_Anniv() {
+ public function testContactBirthDateAnniversary() {
$contact = $this->callAPISuccess('Contact', 'create', $this->fixtures['contact_birthdate']);
$this->_testObjects['CRM_Contact_DAO_Contact'][] = $contact['id'];
$actionSchedule = $this->fixtures['sched_contact_bday_anniv'];
$actionScheduleDao = CRM_Core_BAO_ActionSchedule::add($actionSchedule);
$this->assertTrue(is_numeric($actionScheduleDao->id));
$this->assertCronRuns(array(
- array(// On some random day, no email
+ array(
+ // On some random day, no email.
'time' => '2014-03-07 01:00:00',
'recipients' => array(),
),
- array(// On the eve of their 9th birthday, send an email
+ array(
+ // On the eve of their 9th birthday, send an email.
'time' => '2014-07-06 20:00:00',
'recipients' => array(array('test-bday@example.com')),
),
));
}
- public function testContactCustomDate_noAnniv() {
+ public function testContactCustomDateNoAnniv() {
$group = array(
'title' => 'Test_Group',
'name' => 'test_group',
$actionScheduleDao = CRM_Core_BAO_ActionSchedule::add($actionSchedule);
$this->assertTrue(is_numeric($actionScheduleDao->id));
$this->assertCronRuns(array(
- array(// On some random day, no email
+ array(
+ // On some random day, no email.
'time' => '2014-03-07 01:00:00',
'recipients' => array(),
),
- array(// On the eve of their graduation, send an email
+ array(
+ // On the eve of their graduation, send an email.
'time' => '2013-12-15 20:00:00',
'recipients' => array(array('test-member@example.com')),
),
}
/**
- * Check that limit_to + an empty recipients doesn't sent to multiple contacts
+ * Check that limit_to + an empty recipients doesn't sent to multiple contacts.
*/
public function testMembershipLimitToNone() {
// creates membership with end_date = 20120615
// end_date=2012-06-15 ; schedule is 2 weeks before end_date
$this->assertCronRuns(array(
- array(// Before the 2-week mark, no email
+ array(
+ // Before the 2-week mark, no email.
'time' => '2012-05-31 01:00:00',
// 'time' => '2012-06-01 01:00:00', // FIXME: Is this the right boundary?
'recipients' => array(),
}
- public function testContactCustomDate_Anniv() {
+ public function testContactCustomDateAnniv() {
$group = array(
'title' => 'Test_Group now',
'name' => 'test_group_now',
$actionScheduleDao = CRM_Core_BAO_ActionSchedule::add($actionSchedule);
$this->assertTrue(is_numeric($actionScheduleDao->id));
$this->assertCronRuns(array(
- array(// On some random day, no email
+ array(
+ // On some random day, no email.
'time' => '2014-03-07 01:00:00',
'recipients' => array(),
),
- array(// A week after their 5th anniversary of graduation, send an email
+ array(
+ // A week after their 5th anniversary of graduation, send an email.
'time' => '2018-12-23 20:00:00',
'recipients' => array(array('test-member@example.com')),
),
// TODO // function testEventNameEndDate_Match() { }
/**
- * Run a series of cron jobs and make an assertion about email deliveries
+ * Run a series of cron jobs and make an assertion about email deliveries.
*
* @param array $cronRuns
* array specifying when to run cron and what messages to expect; each item is an array with keys:
/**
* Sets up the fixture, for example, opens a network connection.
+ *
* This method is called before a test is executed.
*/
protected function _setUp() {
/**
* Tears down the fixture, for example, closes a network connection.
+ *
* This method is called after a test is executed.
*/
protected function _tearDown() {
/**
* This is a wrapper for CRM_Core_DAO::createTestObject which tracks
- * created entities and provides for brainless clenaup.
+ * created entities and provides for brainless cleanup.
*
* @see CRM_Core_DAO::createTestObject
+ *
* @param $daoName
* @param array $params
* @param int $numObjects
* @param bool $createOnly
+ *
+ * @return array|NULL|object
*/
function createTestObject($daoName, $params = array(), $numObjects = 1, $createOnly = FALSE) {
$objects = CRM_Core_DAO::createTestObject($daoName, $params, $numObjects, $createOnly);
public function testHookAlterMailer() {
$test = $this;
$mockMailer = new CRM_Utils_FakeObject(array(
- 'send' => function ($recipients, $headers, $body) use ($test) {
- $test->calls['send']++;
- $test->assertEquals(array('to@example.org'), $recipients);
- $test->assertEquals('Subject Example', $headers['Subject']);
- },
+ 'send' => function ($recipients, $headers, $body) use ($test) {
+ $test->calls['send']++;
+ $test->assertEquals(array('to@example.org'), $recipients);
+ $test->assertEquals('Subject Example', $headers['Subject']);
+ },
));
CRM_Utils_Hook::singleton()->setHook('civicrm_alterMailer',
- function (&$mailer, $driver, $params) use ($test, $mockMailer) {
- $test->calls['civicrm_alterMailer']++;
- $test->assertTrue(is_string($driver) && !empty($driver));
- $test->assertTrue(is_array($params));
- $test->assertTrue(is_callable(array($mailer, 'send')));
- $mailer = $mockMailer;
- }
+ function (&$mailer, $driver, $params) use ($test, $mockMailer) {
+ $test->calls['civicrm_alterMailer']++;
+ $test->assertTrue(is_string($driver) && !empty($driver));
+ $test->assertTrue(is_array($params));
+ $test->assertTrue(is_callable(array($mailer, 'send')));
+ $mailer = $mockMailer;
+ }
);
$params = array();
$paypalIPN->main();
$contribution = $this->callAPISuccess('contribution', 'get', array(
'contribution_recur_id' => $this->_contributionRecurID,
- 'sequential' => 1
+ 'sequential' => 1,
));
$this->assertEquals(2, $contribution['count']);
$this->assertEquals('secondone', $contribution['values'][1]['trxn_id']);
$this->assertEquals(strtotime('+ 1 year', strtotime($membershipEndDate)), strtotime($this->callAPISuccessGetValue('membership', array('return' => 'end_date'))));
$contribution = $this->callAPISuccess('contribution', 'get', array(
'contribution_recur_id' => $this->_contributionRecurID,
- 'sequential' => 1
+ 'sequential' => 1,
));
$this->assertEquals(2, $contribution['count']);
$this->assertEquals('secondone', $contribution['values'][1]['trxn_id']);
$this->callAPISuccessGetCount('line_item', array(
'entity_id' => $this->ids['membership'],
- 'entity_table' => 'civicrm_membership'
+ 'entity_table' => 'civicrm_membership',
), 2);
$this->callAPISuccessGetSingle('line_item', array(
'contribution_id' => $contribution['values'][1]['id'],
- 'entity_table' => 'civicrm_membership'
+ 'entity_table' => 'civicrm_membership',
));
$this->callAPISuccessGetSingle('membership_payment', array('contribution_id' => $contribution['values'][1]['id']));
$paypalIPN->main();
$contribution = $this->callAPISuccess('contribution', 'get', array(
'contribution_recur_id' => $this->_contributionRecurID,
- 'sequential' => 1
+ 'sequential' => 1,
));
$this->assertEquals(1, $contribution['count']);
$this->assertEquals('secondone', $contribution['values'][0]['trxn_id']);
'amount_per_cycle' => '15.00',
'mc_gross' => '15.00',
'payment_date' => '03:59:05 Jul 14, 2013 PDT',
- 'rp_invoice_id' => 'i=' . $this->_invoiceID
- . '&m=contribute&c='
- . $this->_contactID
- . '&r=' . $this->_contributionRecurID
- . '&b=' . $this->_contributionID . '&p=' . $this->_contributionPageID,
+ 'rp_invoice_id' => 'i=' . $this->_invoiceID . '&m=contribute&c=' . $this->_contactID . '&r=' . $this->_contributionRecurID . '&b=' . $this->_contributionID . '&p=' . $this->_contributionPageID,
'payment_status' => 'Completed',
'business' => 'nowhere@civicrm.org',
'last_name' => 'Roberty',
CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_PRE_COMMIT, array($this, '_preCommit'), array(
'qwe',
- 'rty'
+ 'rty',
));
CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_POST_COMMIT, array($this, '_postCommit'), array(
'uio',
- 'p[]'
+ 'p[]',
));
CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_PRE_ROLLBACK, array(
$this,
- '_preRollback'
+ '_preRollback',
), array('asd', 'fgh'));
CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_POST_ROLLBACK, array(
$this,
- '_postRollback'
+ '_postRollback',
), array('jkl', ';'));
CRM_Core_DAO::executeQuery('UPDATE civicrm_contact SET id = 100 WHERE id = 100');
CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_PRE_COMMIT, array($this, '_preCommit'), array(
'ewq',
- 'ytr'
+ 'ytr',
));
CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_POST_COMMIT, array($this, '_postCommit'), array(
'oiu',
- '][p'
+ '][p',
));
CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_PRE_ROLLBACK, array(
$this,
- '_preRollback'
+ '_preRollback',
), array('dsa', 'hgf'));
CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_POST_ROLLBACK, array(
$this,
- '_postRollback'
+ '_postRollback',
), array('lkj', ';'));
CRM_Core_DAO::executeQuery('UPDATE civicrm_contact SET id = 100 WHERE id = 100');
* See assertContactsMix.
* @param string $outcome
* 'rollback'|'implicit-commit'|'explicit-commit' how to finish transaction.
- * @return int
- * cid
+ * @return void
*/
public function runBatch($nesting, $callbacks, $existsByOffset, $outcome) {
if ($nesting != 'reuse-tx' && $nesting != 'nest-tx') {
private static $instance = NULL;
/**
+ * Get instance.
*/
private static function getInstance() {
if (is_null(self::$instance)) {
- self::$instance = new self;
+ self::$instance = new self();
}
return self::$instance;
}
/**
- * Build test suite dynamically
+ * Build test suite dynamically.
*/
public static function suite() {
$inst = self::getInstance();
return $inst->implSuite(__FILE__);
}
}
-// class CRM_Core_AllTests
-
// -- set Emacs parameters --
// Local variables:
// mode: php;
$this->_permissionedDisabledGroup = $this->groupCreate(array(
'title' => 'pick-me-disabled',
'is_active' => 0,
- 'name' => 'pick-me-disabled'
+ 'name' => 'pick-me-disabled',
));
$this->_permissionedGroup = $this->groupCreate(array(
'title' => 'pick-me-active',
'is_active' => 1,
- 'name' => 'pick-me-active'
+ 'name' => 'pick-me-active',
));
$this->groupCreate(array('title' => 'not-me-disabled', 'is_active' => 0, 'name' => 'not-me-disabled'));
$this->groupCreate(array('title' => 'not-me-active', 'is_active' => 1, 'name' => 'not-me-active'));
* @return CRM_Mailing_BAO_QueryTestDataProvider
*/
public function dataProvider() {
- return new CRM_Mailing_BAO_QueryTestDataProvider;
+ return new CRM_Mailing_BAO_QueryTestDataProvider();
}
public function setUp() {
*/
private static function getInstance() {
if (is_null(self::$instance)) {
- self::$instance = new self;
+ self::$instance = new self();
}
return self::$instance;
}
parent::setUp();
}
- /* check function add()
- *
- */
+ /**
+ * Check function add()
+ */
public function testAdd() {
$params = array(
'name' => 'pending',
$config = CRM_Core_Config::singleton();
$config->keyDisable = TRUE;
- $membershipRenewal = new CRM_Core_Form;
- $membershipRenewal->controller = new CRM_Core_Controller;
+ $membershipRenewal = new CRM_Core_Form();
+ $membershipRenewal->controller = new CRM_Core_Controller();
$isTestMembership = 0;
- $MembershipRenew =
- CRM_Member_BAO_Membership::renewMembershipFormWrapper(
- $contactId,
- $this->_membershipTypeID,
- $isTestMembership,
- $membershipRenewal,
- NULL,
- NULL
- );
+ $MembershipRenew = CRM_Member_BAO_Membership::renewMembershipFormWrapper(
+ $contactId,
+ $this->_membershipTypeID,
+ $isTestMembership,
+ $membershipRenewal,
+ NULL,
+ NULL
+ );
$endDate = date("Y-m-d", strtotime($membership->end_date . " +1 year"));
$this->assertDBNotNull('CRM_Member_BAO_MembershipLog',
$config = CRM_Core_Config::singleton();
$config->keyDisable = TRUE;
- $membershipRenewal = new CRM_Core_Form;
- $membershipRenewal->controller = new CRM_Core_Controller;
+ $membershipRenewal = new CRM_Core_Form();
+ $membershipRenewal->controller = new CRM_Core_Controller();
$MembershipRenew = CRM_Member_BAO_Membership::renewMembershipFormWrapper($contactId, $this->_membershipTypeID, $isTestMembership = 0, $membershipRenewal, NULL, NULL);
$this->assertDBNotNull('CRM_Member_BAO_MembershipLog',
$this->contactDelete($this->_indiviContactID);
}
- /* check function add()
- *
- */
+ /**
+ * check function add()
+ *
+ */
public function testAdd() {
$ids = array();
$params = array(
$this->membershipTypeDelete(array('id' => $membershipType->id));
}
- /* check function retrive()
- *
- */
+ /**
+ * check function retrive()
+ *
+ */
public function testRetrieve() {
$ids = array();
$params = array(
$this->membershipTypeDelete(array('id' => $membershipType->id));
}
- /* check function isActive()
- *
- */
+ /**
+ * check function isActive()
+ *
+ */
public function testSetIsActive() {
$ids = array();
$params = array(
$this->membershipTypeDelete(array('id' => $membership->id));
}
- /* check function del()
- *
- */
+ /**
+ * check function del()
+ *
+ */
public function testdel() {
$ids = array();
$params = array(
$this->assertEquals($result, TRUE, 'Verify membership deleted.');
}
- /* check function convertDayFormat( )
- *
- */
+ /**
+ * check function convertDayFormat( )
+ *
+ */
public function testConvertDayFormat() {
$ids = array();
$params = array(
$this->membershipTypeDelete(array('id' => $membership->id));
}
- /* check function getMembershipTypes( )
- *
- */
+ /**
+ * check function getMembershipTypes( )
+ *
+ */
public function testGetMembershipTypes() {
$ids = array();
$params = array(
$this->membershipTypeDelete(array('id' => $membership->id));
}
- /* check function getMembershipTypeDetails( )
- *
- */
+ /**
+ * check function getMembershipTypeDetails( )
+ *
+ */
public function testGetMembershipTypeDetails() {
$ids = array();
$params = array(
$this->membershipTypeDelete(array('id' => $membership->id));
}
- /* check function getDatesForMembershipType( )
- *
- */
+ /**
+ * check function getDatesForMembershipType( )
+ *
+ */
public function testGetDatesForMembershipType() {
$ids = array();
$params = array(
$this->membershipTypeDelete(array('id' => $membership->id));
}
- /* check function getRenewalDatesForMembershipType( )
- *
- */
+ /**
+ * check function getRenewalDatesForMembershipType( )
+ *
+ */
public function testGetRenewalDatesForMembershipType() {
$ids = array();
$params = array(
$this->membershipTypeDelete(array('id' => $membershipType->id));
}
- /* check function getMembershipTypesByOrg( )
- *
- */
+ /**
+ * check function getMembershipTypesByOrg( )
+ *
+ */
public function testGetMembershipTypesByOrg() {
$ids = array();
$params = array(
'membership_type_id' => array(),
);
$files = array();
- $obj = new CRM_Member_Form_Membership;
+ $obj = new CRM_Member_Form_Membership();
$rc = $obj->formRule($params, $files, $obj);
$this->assertType('array', $rc,
'In line ' . __LINE__
'membership_type_id' => array('23', '3'),
);
$files = array();
- $obj = new CRM_Member_Form_Membership;
+ $obj = new CRM_Member_Form_Membership();
$rc = call_user_func(array('CRM_Member_Form_Membership', 'formRule'),
$params, $files, $obj
);
'membership_type_id' => array('23', '3'),
);
$files = array();
- $obj = new CRM_Member_Form_Membership;
+ $obj = new CRM_Member_Form_Membership();
$rc = $obj->formRule($params, $files, $obj);
$this->assertType('array', $rc,
'In line ' . __LINE__
'membership_type_id' => array('23', '3'),
);
$files = array();
- $obj = new CRM_Member_Form_Membership;
+ $obj = new CRM_Member_Form_Membership();
$rc = $obj->formRule($params, $files, $obj);
$this->assertType('array', $rc,
'In line ' . __LINE__
'membership_type_id' => array('23', '13'),
);
$files = array();
- $obj = new CRM_Member_Form_Membership;
+ $obj = new CRM_Member_Form_Membership();
$rc = $obj->formRule($params, $files, $obj);
$this->assertType('array', $rc);
$this->assertTrue(array_key_exists('status_id', $rc));
'is_override' => TRUE,
);
$files = array();
- $obj = new CRM_Member_Form_Membership;
+ $obj = new CRM_Member_Form_Membership();
$rc = $obj->formRule($params, $files, $obj);
$this->assertType('array', $rc,
'In line ' . __LINE__
'membership_type_id' => array('23', '3'),
);
$files = array();
- $obj = new CRM_Member_Form_Membership;
+ $obj = new CRM_Member_Form_Membership();
$rc = $obj->formRule($params, $files, $obj);
// Should have found no valid membership status
'membership_type_id' => array('23', '3'),
);
$files = array();
- $obj = new CRM_Member_Form_Membership;
+ $obj = new CRM_Member_Form_Membership();
$rc = $obj->formRule($params, $files, $obj);
// Should have found New membership status
'membership_type_id' => array('23', '3'),
);
$files = array();
- $obj = new CRM_Member_Form_Membership;
+ $obj = new CRM_Member_Form_Membership();
$rc = $obj->formRule($params, $files, $obj);
// Should have found New membership status
'membership_type_id' => array('23', '3'),
);
$files = array();
- $obj = new CRM_Member_Form_Membership;
+ $obj = new CRM_Member_Form_Membership();
$rc = $obj->formRule($params, $files, $obj);
// Should have found Current membership status
'membership_type_id' => array('23', '3'),
);
$files = array();
- $obj = new CRM_Member_Form_Membership;
+ $obj = new CRM_Member_Form_Membership();
$rc = $obj->formRule($params, $files, $obj);
// Should have found Grace membership status
'membership_type_id' => array('23', '3'),
);
$files = array();
- $obj = new CRM_Member_Form_Membership;
+ $obj = new CRM_Member_Form_Membership();
$rc = $obj->formRule($params, $files, $obj);
// Should have found Expired membership status
'membership_type_id' => array('23', '7'),
);
$files = array();
- $obj = new CRM_Member_Form_Membership;
+ $obj = new CRM_Member_Form_Membership();
$rc = $obj->formRule($params, $files, $obj);
// Should have found Current membership status
*/
private static function getInstance() {
if (is_null(self::$instance)) {
- self::$instance = new self;
+ self::$instance = new self();
}
return self::$instance;
}
class CRM_Utils_QueryFormatterTest extends CiviUnitTestCase {
public function dataProvider() {
- $cases = array(); // array(0=>$inputText, 1=>$language, 2=>$options, 3=>$expectedText)
+ // Array(0=>$inputText, 1=>$language, 2=>$options, 3=>$expectedText).
+ $cases = array();
$cases[] = array(
'first second',
CRM_Utils_QueryFormatter::LANG_SQL_LIKE,
CRM_Utils_QueryFormatter::MODE_NONE,
- '%first second%'
+ '%first second%',
);
$cases[] = array(
'first second',
CRM_Utils_QueryFormatter::LANG_SQL_LIKE,
CRM_Utils_QueryFormatter::MODE_PHRASE,
- '%first second%'
+ '%first second%',
);
$cases[] = array(
'first second',
CRM_Utils_QueryFormatter::LANG_SQL_LIKE,
CRM_Utils_QueryFormatter::MODE_WILDPHRASE,
- '%first second%'
+ '%first second%',
);
$cases[] = array(
'first second',
CRM_Utils_QueryFormatter::LANG_SQL_LIKE,
CRM_Utils_QueryFormatter::MODE_WILDWORDS,
- '%first%second%'
+ '%first%second%',
);
$cases[] = array(
'first second',
CRM_Utils_QueryFormatter::LANG_SQL_LIKE,
CRM_Utils_QueryFormatter::MODE_WILDWORDS_SUFFIX,
- '%first%second%'
+ '%first%second%',
);
$cases[] = array(
'first second',
CRM_Utils_QueryFormatter::LANG_SQL_FTS,
CRM_Utils_QueryFormatter::MODE_NONE,
- 'first second'
+ 'first second',
);
$cases[] = array(
'first second',
CRM_Utils_QueryFormatter::LANG_SQL_FTS,
CRM_Utils_QueryFormatter::MODE_PHRASE,
- '"first second"'
+ '"first second"',
);
$cases[] = array(
'first second',
CRM_Utils_QueryFormatter::LANG_SQL_FTS,
CRM_Utils_QueryFormatter::MODE_WILDPHRASE,
- '"*first second*"'
+ '"*first second*"',
);
$cases[] = array(
'first second',
CRM_Utils_QueryFormatter::LANG_SQL_FTS,
CRM_Utils_QueryFormatter::MODE_WILDWORDS,
- '*first* *second*'
+ '*first* *second*',
);
$cases[] = array(
'first second',
CRM_Utils_QueryFormatter::LANG_SQL_FTS,
CRM_Utils_QueryFormatter::MODE_WILDWORDS_SUFFIX,
- 'first* second*'
+ 'first* second*',
);
$cases[] = array(
'first second',
CRM_Utils_QueryFormatter::LANG_SQL_FTSBOOL,
CRM_Utils_QueryFormatter::MODE_NONE,
- '+first +second'
+ '+first +second',
);
$cases[] = array(
'first second',
CRM_Utils_QueryFormatter::LANG_SQL_FTSBOOL,
CRM_Utils_QueryFormatter::MODE_PHRASE,
- '+"first second"'
+ '+"first second"',
);
$cases[] = array(
'first second',
CRM_Utils_QueryFormatter::LANG_SQL_FTSBOOL,
CRM_Utils_QueryFormatter::MODE_WILDPHRASE,
- '+"*first second*"'
+ '+"*first second*"',
);
$cases[] = array(
'first second',
CRM_Utils_QueryFormatter::LANG_SQL_FTSBOOL,
CRM_Utils_QueryFormatter::MODE_WILDWORDS,
- '+*first* +*second*'
+ '+*first* +*second*',
);
$cases[] = array(
'first second',
CRM_Utils_QueryFormatter::LANG_SQL_FTSBOOL,
CRM_Utils_QueryFormatter::MODE_WILDWORDS_SUFFIX,
- '+first* +second*'
+ '+first* +second*',
);
$cases[] = array(
'first second',
CRM_Utils_QueryFormatter::LANG_SOLR,
CRM_Utils_QueryFormatter::MODE_NONE,
- 'first second'
+ 'first second',
);
$cases[] = array(
'first second',
CRM_Utils_QueryFormatter::LANG_SOLR,
CRM_Utils_QueryFormatter::MODE_PHRASE,
- '"first second"'
+ '"first second"',
);
$cases[] = array(
'first second',
CRM_Utils_QueryFormatter::LANG_SOLR,
CRM_Utils_QueryFormatter::MODE_WILDPHRASE,
- '"*first second*"'
+ '"*first second*"',
);
$cases[] = array(
'first second',
CRM_Utils_QueryFormatter::LANG_SOLR,
CRM_Utils_QueryFormatter::MODE_WILDWORDS,
- '*first* *second*'
+ '*first* *second*',
);
$cases[] = array(
'first second',
CRM_Utils_QueryFormatter::LANG_SOLR,
CRM_Utils_QueryFormatter::MODE_WILDWORDS_SUFFIX,
- 'first* second*'
+ 'first* second*',
);
- // if user supplies wildcards, then ignore mode
+ // If user supplies wildcards, then ignore mode.
foreach (array(
CRM_Utils_QueryFormatter::MODE_NONE,
CRM_Utils_QueryFormatter::MODE_WILDPHRASE,
CRM_Utils_QueryFormatter::MODE_WILDWORDS,
- CRM_Utils_QueryFormatter::MODE_WILDWORDS_SUFFIX
+ CRM_Utils_QueryFormatter::MODE_WILDWORDS_SUFFIX,
) as $mode) {
- $cases[] = array('first% second', CRM_Utils_QueryFormatter::LANG_SQL_LIKE, $mode, 'first% second');
- $cases[] = array('first% second', CRM_Utils_QueryFormatter::LANG_SQL_FTS, $mode, 'first* second');
- $cases[] = array('first% second', CRM_Utils_QueryFormatter::LANG_SQL_FTSBOOL, $mode, '+first* +second');
- $cases[] = array('first% second', CRM_Utils_QueryFormatter::LANG_SOLR, $mode, 'first* second');
- $cases[] = array('first second%', CRM_Utils_QueryFormatter::LANG_SQL_LIKE, $mode, 'first second%');
- $cases[] = array('first second%', CRM_Utils_QueryFormatter::LANG_SQL_FTS, $mode, 'first second*');
- $cases[] = array('first second%', CRM_Utils_QueryFormatter::LANG_SQL_FTSBOOL, $mode, '+first +second*');
- $cases[] = array('first second%', CRM_Utils_QueryFormatter::LANG_SOLR, $mode, 'first second*');
+ $cases[] = array(
+ 'first% second',
+ CRM_Utils_QueryFormatter::LANG_SQL_LIKE,
+ $mode,
+ 'first% second',
+ );
+ $cases[] = array(
+ 'first% second',
+ CRM_Utils_QueryFormatter::LANG_SQL_FTS,
+ $mode,
+ 'first* second',
+ );
+ $cases[] = array(
+ 'first% second',
+ CRM_Utils_QueryFormatter::LANG_SQL_FTSBOOL,
+ $mode,
+ '+first* +second',
+ );
+ $cases[] = array(
+ 'first% second',
+ CRM_Utils_QueryFormatter::LANG_SOLR,
+ $mode,
+ 'first* second',
+ );
+ $cases[] = array(
+ 'first second%',
+ CRM_Utils_QueryFormatter::LANG_SQL_LIKE,
+ $mode,
+ 'first second%',
+ );
+ $cases[] = array(
+ 'first second%',
+ CRM_Utils_QueryFormatter::LANG_SQL_FTS,
+ $mode,
+ 'first second*',
+ );
+ $cases[] = array(
+ 'first second%',
+ CRM_Utils_QueryFormatter::LANG_SQL_FTSBOOL,
+ $mode,
+ '+first +second*',
+ );
+ $cases[] = array(
+ 'first second%',
+ CRM_Utils_QueryFormatter::LANG_SOLR,
+ $mode,
+ 'first second*',
+ );
}
return $cases;
}
/**
- * @param $text
- * @param $language
- * @param $mode
- * @param $expectedText
+ * Test format.
+ *
+ * @param string $text
+ * @param string $language
+ * @param string $mode
+ * @param string $expectedText
+ *
* @dataProvider dataProvider
*/
public function testFormat($text, $language, $mode, $expectedText) {
*/
private static function getInstance() {
if (is_null(self::$instance)) {
- self::$instance = new self;
+ self::$instance = new self();
}
return self::$instance;
}
* @param int $id
* Id of the PayPal Pro payment processor.
* to be deleted
- * @return boolean
+ * @return bool
* true if payment processor deleted, false otherwise
*/
public function delete($id) {
* @param $expectedValue
* @param string $message
*/
- function assertDBCompareValue(
+ public function assertDBCompareValue(
&$testCase, $daoName, $searchValue, $returnColumn, $searchColumn,
$expectedValue, $message
) {
// also load the class loader
require_once 'CRM/Core/ClassLoader.php';
CRM_Core_ClassLoader::singleton()->register();
- if (function_exists('_civix_phpunit_setUp')) { // FIXME: loosen coupling
+ if (function_exists('_civix_phpunit_setUp')) {
+ // FIXME: loosen coupling
_civix_phpunit_setUp();
}
}
* @param $expectedValue
* @param $message
*/
- function assertDBCompareValue(
+ public function assertDBCompareValue(
$daoName, $searchValue, $returnColumn, $searchColumn,
$expectedValue, $message
) {
'debug' => 1,
);
$result = $this->civicrm_api($entity, 'getcount', $params);
- if (!is_integer($result) || !empty($result['is_error']) || isset($result['values'])) {
+ if (!is_int($result) || !empty($result['is_error']) || isset($result['values'])) {
throw new Exception('Invalid getcount result : ' . print_r($result, TRUE) . " type :" . gettype($result));
}
if (is_int($count)) {
);
$params = array('contact_type' => $contact_type);
foreach ($samples[$contact_type] as $key => $values) {
- $params[$key] = $values[$seq % sizeof($values)];
+ $params[$key] = $values[$seq % count($values)];
}
if ($contact_type == 'Individual') {
$params['email'] = strtolower(
* Contact ID to delete
*/
public function contactDelete($contactID) {
- $domain = new CRM_Core_BAO_Domain;
+ $domain = new CRM_Core_BAO_Domain();
$domain->contact_id = $contactID;
if (!$domain->find(TRUE)) {
$this->callAPISuccess('contact', 'delete', array(
public function membershipDelete($membershipID) {
$deleteParams = array('id' => $membershipID);
$result = $this->callAPISuccess('Membership', 'Delete', $deleteParams);
- return;
}
/**
return;
}
$result = $this->callAPISuccess('MembershipStatus', 'Delete', array('id' => $membershipStatusID));
- return;
}
/**
/**
* Delete a Location Type
*
- * @param int location type id
+ * @param int locationTypeId
*/
public function locationTypeDelete($locationTypeId) {
$locationType = new CRM_Core_DAO_LocationType();
*
* @param int $groupID
* @param int $totalCount
- * @return int groupId of created group
- * groupId of created group
+ * @return int
+ * groupId of created group
*/
public function groupContactCreate($groupID, $totalCount = 10) {
$params = array('group_id' => $groupID);
/**
* Delete a UF Join Entry
*
- * @param array with missing uf_group_id
+ * @param array $params
+ * with missing uf_group_id
*/
public function ufjoinDelete($params = NULL) {
if ($params === NULL) {
var $abc;
/**
- * @param null $name
+ * @param string|null $name
*/
public function __construct($name = NULL) {
parent::__construct($name);
}
- // called before the test functions will be executed
- // this function is defined in PHPUnit_TestCase and overwritten
- // here
+ /**
+ * Called before the test functions will be executed
+ * this function is defined in PHPUnit_TestCase and overwritten
+ * here
+ */
public function setUp() {
// create a new instance of String with the
// string 'abc'
$this->abc = "hello";
}
- // called after the test functions are executed
- // this function is defined in PHPUnit_TestCase and overwritten
- // here
+ /**
+ * Called after the test functions are executed
+ * this function is defined in PHPUnit_TestCase and overwritten
+ * here.
+ */
public function tearDown() {
// delete your instance
unset($this->abc);
'edit-2-access-all-cases-and-activities',
'edit-2-access-my-cases-and-activities',
'edit-2-administer-civicase',
- 'edit-2-delete-in-civicase'
+ 'edit-2-delete-in-civicase',
);
$this->changePermissions($permission);
'edit-2-access-all-cases-and-activities',
'edit-2-access-my-cases-and-activities',
'edit-2-administer-civicase',
- 'edit-2-delete-in-civicase'
+ 'edit-2-delete-in-civicase',
);
$this->changePermissions($permission);
// verify if custom data is present
$this->openCiviPage('case', 'reset=1');
- $this->clickLink("xpath=//table[@class='caseSelector']/tbody//tr/td[2]/a[text()='{$client['sort_name']}']/../../td[9]/span/a[text()='Manage']");
+ $this->clickLink("xpath=//table[@class='caseSelector']/tbody//tr/td[2]/a[text()='{$client['sort_name']}']/../../td[9]/span/a[1][text()='Manage']");
$this->clickAjaxLink("css=#{$customGrp1} .crm-accordion-header", "css=#{$customGrp1} a.button");
$cusId_1 = 'custom_' . $customId[0] . '_1';
$this->openCiviPage("admin/custom/group/field", array(
'reset' => 1,
'action' => 'browse',
- 'gid' => $customGrpId1
+ 'gid' => $customGrpId1,
));
$custom1 = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//table/tbody//tr[1]/td[8]/span/a[text()='Edit Field']/@href"));
$custom1 = $custom1[1];
$this->openCiviPage("admin/custom/group/field", array(
'reset' => 1,
'action' => 'browse',
- 'gid' => $customGrpId1
+ 'gid' => $customGrpId1,
));
$custom1 = explode('&id=', $this->getAttribute("xpath=//div[@id='field_page']//table/tbody//tr[1]/td[8]/span/a[text()='Edit Field']/@href"));
$custom1 = $custom1[1];
'action' => 'delete',
'reset' => '1',
'gid' => $customGrpId1,
- 'id' => $cValue
+ 'id' => $cValue,
));
$this->clickLink("_qf_DeleteField_next-bottom");
}
'edit-2-access-all-cases-and-activities',
'edit-2-access-my-cases-and-activities',
'edit-2-administer-civicase',
- 'edit-2-delete-in-civicase'
+ 'edit-2-delete-in-civicase',
);
$this->changePermissions($permission);
parent::setUp();
}
- /*
- * test individual pane seperatly.
+ /**
+ * Test individual pane seperatly.
*/
public function testIndividualPanes() {
$this->webtestLogin();
}
}
- /*
- * test by selecting all panes at a time.
+ /**
+ * Test by selecting all panes at a time.
*/
public function testAllPanes() {
$this->webtestLogin();
/**
* @param array $openedPanes
*/
- function _checkOpenedPanes($openedPanes = array()) {
+ public function _checkOpenedPanes($openedPanes = array()) {
if (!$this->isTextPresent('None found.')) {
$this->click('css=div.crm-advanced_search_form-accordion div.crm-accordion-header');
}
* @param $paneRef
* @param array $selectFields
*/
- function _selectPaneFields($paneRef, $selectFields = array()) {
+ public function _selectPaneFields($paneRef, $selectFields = array()) {
$pane = $this->_advanceSearchPanes($paneRef);
$this->click("css=div.crm-accordion-wrapper {$pane['headerLocator']}");
if (!isset($_advance_search_panes) || empty($_advance_search_panes)) {
$_advance_search_panes = array(
- 'location' =>
- array(
- 'headerLocator' => 'div#location',
- 'bodyLocator' => 'select#country',
- 'title' => 'Address Fields',
- 'fields' =>
- array(
- 'Location Type' =>
- array(
- 'type' => 'multiselect2',
- 'locator' => 'location_type',
- 'values' => array(array('Home', 'Work')),
- ),
- 'Country' =>
- array(
- 'type' => 'select',
- 'locator' => 'country',
- 'values' => array('United States'),
- ),
- 'State' =>
- array(
- 'type' => 'multiselect2',
- 'locator' => 'state_province',
- 'values' => array(array('Alabama', 'California', 'New Jersey', 'New York')),
- ),
+ 'location' => array(
+ 'headerLocator' => 'div#location',
+ 'bodyLocator' => 'select#country',
+ 'title' => 'Address Fields',
+ 'fields' => array(
+ 'Location Type' => array(
+ 'type' => 'multiselect2',
+ 'locator' => 'location_type',
+ 'values' => array(array('Home', 'Work')),
+ ),
+ 'Country' => array(
+ 'type' => 'select',
+ 'locator' => 'country',
+ 'values' => array('United States'),
+ ),
+ 'State' => array(
+ 'type' => 'multiselect2',
+ 'locator' => 'state_province',
+ 'values' => array(
+ array('Alabama', 'California', 'New Jersey', 'New York'),
),
+ ),
),
- 'custom' =>
- array(
- 'headerLocator' => 'div#custom',
- 'bodyLocator' => 'div#constituent_information',
- 'title' => 'Custom Data',
- 'fields' =>
- array(
- 'Marital Status' =>
- array(
- 'type' => 'select',
- 'locator' => 'custom_2',
- 'values' => array('Single'),
- ),
- ),
+ ),
+ 'custom' => array(
+ 'headerLocator' => 'div#custom',
+ 'bodyLocator' => 'div#constituent_information',
+ 'title' => 'Custom Data',
+ 'fields' => array(
+ 'Marital Status' => array(
+ 'type' => 'select',
+ 'locator' => 'custom_2',
+ 'values' => array('Single'),
+ ),
),
- 'activity' =>
- array(
- 'headerLocator' => 'div#activity',
- 'bodyLocator' => 'input#activity_subject',
- 'title' => 'Activities',
- 'fields' =>
- array(
- 'Activity Type' =>
- array(
- 'type' => 'checkbox',
- 'values' => array(
- 'activity_type_id[6]',
- 'activity_type_id[3]',
- 'activity_type_id[5]',
- 'activity_type_id[7]'
- ),
- ),
- 'Activity Subject' =>
- array(
- 'type' => 'text',
- 'locator' => 'activity_subject',
- 'values' => array('Test Subject'),
- ),
- 'Activity Status' =>
- array(
- 'type' => 'checkbox',
- 'values' => array('activity_status[1]', 'activity_status[2]'),
- ),
+ ),
+ 'activity' => array(
+ 'headerLocator' => 'div#activity',
+ 'bodyLocator' => 'input#activity_subject',
+ 'title' => 'Activities',
+ 'fields' => array(
+ 'Activity Type' => array(
+ 'type' => 'checkbox',
+ 'values' => array(
+ 'activity_type_id[6]',
+ 'activity_type_id[3]',
+ 'activity_type_id[5]',
+ 'activity_type_id[7]',
),
+ ),
+ 'Activity Subject' => array(
+ 'type' => 'text',
+ 'locator' => 'activity_subject',
+ 'values' => array('Test Subject'),
+ ),
+ 'Activity Status' => array(
+ 'type' => 'checkbox',
+ 'values' => array('activity_status[1]', 'activity_status[2]'),
+ ),
),
- 'relationship' =>
- array(
- 'headerLocator' => 'div#relationship',
- 'bodyLocator' => 'select#relation_type_id',
- 'title' => 'Relationships',
- 'fields' =>
- array(
- 'Relation Type' =>
- array(
- 'type' => 'select',
- 'locator' => 'relation_type_id',
- 'values' => array('Employee of'),
- ),
- 'Relation Target' =>
- array(
- 'type' => 'text',
- 'locator' => 'relation_target_name',
- 'values' => array('Test Contact'),
- ),
- ),
+ ),
+ 'relationship' => array(
+ 'headerLocator' => 'div#relationship',
+ 'bodyLocator' => 'select#relation_type_id',
+ 'title' => 'Relationships',
+ 'fields' => array(
+ 'Relation Type' => array(
+ 'type' => 'select',
+ 'locator' => 'relation_type_id',
+ 'values' => array('Employee of'),
+ ),
+ 'Relation Target' => array(
+ 'type' => 'text',
+ 'locator' => 'relation_target_name',
+ 'values' => array('Test Contact'),
+ ),
),
- 'demographics' =>
- array(
- 'headerLocator' => 'div#demographics',
- 'bodyLocator' => 'input#birth_date_low_display',
- 'title' => 'Demographics',
- 'fields' =>
- array(
- 'Birth Date Range' =>
- array(
- 'type' => 'select',
- 'locator' => 'birth_date_relative',
- 'values' => array('Choose Date Range'),
- ),
- 'Birth Date from' =>
- array(
- 'type' => 'date',
- 'locator' => 'birth_date_low',
- 'values' => array('10 September 1980'),
- ),
- 'Birth Date to' =>
- array(
- 'type' => 'date',
- 'locator' => 'birth_date_high',
- 'values' => array('10 September 2000'),
- ),
- ),
+ ),
+ 'demographics' => array(
+ 'headerLocator' => 'div#demographics',
+ 'bodyLocator' => 'input#birth_date_low_display',
+ 'title' => 'Demographics',
+ 'fields' => array(
+ 'Birth Date Range' => array(
+ 'type' => 'select',
+ 'locator' => 'birth_date_relative',
+ 'values' => array('Choose Date Range'),
+ ),
+ 'Birth Date from' => array(
+ 'type' => 'date',
+ 'locator' => 'birth_date_low',
+ 'values' => array('10 September 1980'),
+ ),
+ 'Birth Date to' => array(
+ 'type' => 'date',
+ 'locator' => 'birth_date_high',
+ 'values' => array('10 September 2000'),
+ ),
),
- 'note' =>
- array(
- 'headerLocator' => 'div#notes',
- 'bodyLocator' => 'input#note',
- 'title' => 'Notes',
- 'fields' =>
- array(
- 'note' =>
- array(
- 'type' => 'text',
- 'locator' => 'css=div#notes-search input#note',
- 'values' => array('Test Note'),
- ),
- ),
+ ),
+ 'note' => array(
+ 'headerLocator' => 'div#notes',
+ 'bodyLocator' => 'input#note',
+ 'title' => 'Notes',
+ 'fields' => array(
+ 'note' => array(
+ 'type' => 'text',
+ 'locator' => 'css=div#notes-search input#note',
+ 'values' => array('Test Note'),
+ ),
),
- 'change_log' =>
- array(
- 'headerLocator' => 'div#changeLog',
- 'bodyLocator' => 'input#changed_by',
- 'title' => 'Change Log',
- 'fields' =>
- array(
- 'Modified By' =>
- array(
- 'type' => 'text',
- 'locator' => 'changed_by',
- 'values' => array('Test User'),
- ),
- ),
+ ),
+ 'change_log' => array(
+ 'headerLocator' => 'div#changeLog',
+ 'bodyLocator' => 'input#changed_by',
+ 'title' => 'Change Log',
+ 'fields' => array(
+ 'Modified By' => array(
+ 'type' => 'text',
+ 'locator' => 'changed_by',
+ 'values' => array('Test User'),
+ ),
),
- 'contribution' =>
- array(
- 'headerLocator' => 'div#CiviContribute',
- 'bodyLocator' => 'select#financial_type_id',
- 'title' => 'Contributions',
- 'fields' =>
- array(
- 'Amount from' =>
- array(
- 'type' => 'text',
- 'locator' => 'contribution_amount_low',
- 'values' => array('10'),
- ),
- 'Amount to' =>
- array(
- 'type' => 'text',
- 'locator' => 'contribution_amount_high',
- 'values' => array('1000'),
- ),
- 'Financial Type' =>
-
- array(
- 'type' => 'select',
- 'locator' => 'financial_type_id',
- 'values' => array('Donation'),
- ),
- 'Contribution Status' =>
- array(
- 'type' => 'checkbox',
- 'values' => array('contribution_status_id[1]', 'contribution_status_id[2]'),
- ),
- ),
+ ),
+ 'contribution' => array(
+ 'headerLocator' => 'div#CiviContribute',
+ 'bodyLocator' => 'select#financial_type_id',
+ 'title' => 'Contributions',
+ 'fields' => array(
+ 'Amount from' => array(
+ 'type' => 'text',
+ 'locator' => 'contribution_amount_low',
+ 'values' => array('10'),
+ ),
+ 'Amount to' => array(
+ 'type' => 'text',
+ 'locator' => 'contribution_amount_high',
+ 'values' => array('1000'),
+ ),
+ 'Financial Type' => array(
+ 'type' => 'select',
+ 'locator' => 'financial_type_id',
+ 'values' => array('Donation'),
+ ),
+ 'Contribution Status' => array(
+ 'type' => 'checkbox',
+ 'values' => array('contribution_status_id[1]', 'contribution_status_id[2]'),
+ ),
),
- 'membership' =>
- array(
- 'headerLocator' => 'div#CiviMember',
- 'bodyLocator' => 'input#member_source',
- 'title' => 'Memberships',
- 'fields' =>
- array(
- 'Membership Type' =>
- array(
- 'type' => 'checkbox',
- 'values' => array('member_membership_type_id[1]', 'member_membership_type_id[2]'),
- ),
- 'Membership Status' =>
- array(
- 'type' => 'checkbox',
- 'values' => array('member_status_id[1]', 'member_status_id[2]'),
- ),
- ),
+ ),
+ 'membership' => array(
+ 'headerLocator' => 'div#CiviMember',
+ 'bodyLocator' => 'input#member_source',
+ 'title' => 'Memberships',
+ 'fields' => array(
+ 'Membership Type' => array(
+ 'type' => 'checkbox',
+ 'values' => array('member_membership_type_id[1]', 'member_membership_type_id[2]'),
+ ),
+ 'Membership Status' => array(
+ 'type' => 'checkbox',
+ 'values' => array('member_status_id[1]', 'member_status_id[2]'),
+ ),
),
- 'event' =>
- array(
- 'headerLocator' => 'div#CiviEvent',
- 'bodyLocator' => 'input#event_id',
- 'title' => 'Events',
- 'fields' =>
- array(
- 'Participant Status' =>
- array(
- 'type' => 'checkbox',
- 'values' => array('participant_status_id[1]', 'participant_status_id[2]'),
- ),
- 'Participant Role' =>
- array(
- 'type' => 'checkbox',
- 'values' => array('participant_role_id[1]', 'participant_role_id[2]'),
- ),
- ),
+ ),
+ 'event' => array(
+ 'headerLocator' => 'div#CiviEvent',
+ 'bodyLocator' => 'input#event_id',
+ 'title' => 'Events',
+ 'fields' => array(
+ 'Participant Status' => array(
+ 'type' => 'checkbox',
+ 'values' => array('participant_status_id[1]', 'participant_status_id[2]'),
+ ),
+ 'Participant Role' => array(
+ 'type' => 'checkbox',
+ 'values' => array('participant_role_id[1]', 'participant_role_id[2]'),
+ ),
),
+ ),
);
}
// fill in Receipt details
$this->type('thankyou_title', "Thank-you Page Title $hash");
- $this->click("xpath=//form[@id='ThankYou']/div[2]/table[1]/tbody/tr[2]/td[2]/div/a/span");
+ $this->click("thankyou_text-plain");
$this->fillRichTextField('thankyou_text', 'This is thankyou message for ' . $pageTitle, 'CKEditor');
- $this->click("xpath=//form[@id='ThankYou']/div[2]/table[1]/tbody/tr[3]/td[2]/div/a/span");
+ $this->click("thankyou_footer-plain");
$this->fillRichTextField('thankyou_footer', 'This is thankyou footer message for ' . $pageTitle, 'CKEditor');
$this->click('is_email_receipt');
$this->waitForElementPresent('bcc_receipt');
$this->type('title', $pageTitle);
$this->click('_qf_SearchContribution_refresh');
$this->waitForPageToLoad($this->getTimeoutMsec());
- $this->isElementPresent("xpath=//table[@id='option11_wrapper']/tbody/tr/td/strong[text()='$pageTitle']");
- $this->waitForElementPresent("xpath=//table[@id='option11']/tbody/tr/td[4]/div[@class='crm-contribution-page-configure-actions']/span[text()='Configure']");
+ $this->isElementPresent("xpath=//table[@class='display dataTable no-footer']/tbody/tr/td[1]/strong[text()='$pageTitle']");
+ $this->waitForElementPresent("xpath=//table[@class='display dataTable no-footer']/tbody/tr/td[4]/div[@class='crm-contribution-page-configure-actions']/span[text()='Configure']");
$this->click("xpath=//table[@id='option11']/tbody/tr/td[4]/div[@class='crm-contribution-page-configure-actions']/span[text()='Configure']");
$this->waitForElementPresent("xpath=//table[@id='option11']/tbody/tr/td[4]/div[@class='crm-contribution-page-configure-actions']/span[text()='Configure']/ul[@class='panel']/li[8]/a[@title='Premiums']");
$this->click("xpath=//table[@id='option11']/tbody/tr/td[4]/div[@class='crm-contribution-page-configure-actions']/span[text()='Configure']/ul[@class='panel']/li[8]/a[@title='Premiums']");
//logout
$this->webtestLogout();
$amountLabel = 'Total Amount';
- $amountValue = '0.00';
+ $amountValue = '1.00';
//Open Live Contribution Page
$this->openCiviPage("contribute/transact", "reset=1&id=$pageId", "_qf_Main_upload-bottom");
'is_deductible' => 1,
);
$this->addeditFinancialType($financialType);
- $this->waitForElementPresent("xpath=//div[@id='ltype']/div/table/tbody//tr/td[text()='" . $financialType['name'] . "']/../td[7]/span/a[text()='Accounts']");
- $this->click("xpath=//div[@id='ltype']/div/table/tbody//tr/td[text()='" . $financialType['name'] . "']/../td[7]/span/a[text()='Accounts']");
+ $this->waitForElementPresent("xpath=//div[@id='ltype']/div/table/tbody//tr/td/div[text()='" . $financialType['name'] . "']/../../td[7]/span/a[text()='Accounts']");
+ $this->click("xpath=//div[@id='ltype']/div/table/tbody//tr/td/div[text()='" . $financialType['name'] . "']/../../td[7]/span/a[text()='Accounts']");
$this->waitForElementPresent("xpath=//a[@id='newfinancialTypeAccount']");
$this->clickAjaxLink("xpath=//a[@id='newfinancialTypeAccount']", "_qf_FinancialTypeAccount_cancel-botttom");
$this->select("account_relationship", "label=Premiums Inventory Account is");
//Assertions
$actualAmount = $this->_getPremiumActualCost($contId, $to, $from, $cost2, "'civicrm_contribution'");
- $this->assertEquals($actualAmount, $cost2, "Verify actual cost for changed premium");
+ $this->assertEquals($actualAmount,null,"Verify actual cost for changed premium");
$deletedAmount = $this->_getPremiumActualCost($contId, $from, $to, $cost, "'civicrm_contribution'");
- $this->assertEquals($deletedAmount, $cost, "Verify actual cost for deleted premium");
+ $this->assertEquals($deletedAmount, null, "Verify actual cost for deleted premium");
}
public function testDeletePremium() {
'is_deductible' => 1,
);
$this->addeditFinancialType($financialType);
- $this->waitForElementPresent("xpath=//div[@id='ltype']/div/table/tbody//tr/td[text()='" . $financialType['name'] . "']/../td[7]/span/a[text()='Accounts']");
- $this->click("xpath=//div[@id='ltype']/div/table/tbody//tr/td[text()='" . $financialType['name'] . "']/../td[7]/span/a[text()='Accounts']");
+ $this->waitForElementPresent("xpath=//div[@id='ltype']/div/table/tbody//tr/td/div[text()='" . $financialType['name'] . "']/../../td[7]/span/a[text()='Accounts']");
+ $this->click("xpath=//div[@id='ltype']/div/table/tbody//tr/td/div[text()='" . $financialType['name'] . "']/../../td[7]/span/a[text()='Accounts']");
$this->waitForElementPresent("xpath=//a[@id='newfinancialTypeAccount']");
$this->clickLink("xpath=//a[@id='newfinancialTypeAccount']", "_qf_FinancialTypeAccount_cancel-botttom", FALSE);
//Assertions
$actualAmount = $this->_getPremiumActualCost($contId, $from, $to, NULL, "'civicrm_contribution'");
- $this->assertEquals($actualAmount, $cost, "Verify actual cost for deleted premium");
+ $this->assertEquals($actualAmount, null, "Verify actual cost for deleted premium");
}
public function testChangePaymentInstrument() {
$this->click('link=Fees');
$this->waitForElementPresent('_qf_Fee_upload_done-bottom');
$this->click('CIVICRM_QFID_1_is_monetary');
- $this->click("xpath=//tr[@class='crm-event-manage-fee-form-block-payment_processor']/td[2]/label[text()='$processorName']");
- $this->select('financial_type_id', 'label=Event Fee');
+ $this->click("xpath=//tbale[@id='paymentProcessor']/tbody/tr[1]/td[2]/label[text()='$processorName']");
+ $this->select('financial_type_id','label=Event Fee');
$this->select('price_set_id', 'label=' . $setTitle);
// intro text for registration page
}
/**
- * @param $customGrpId1
+ * Get custom field ID.
+ *
+ * @param int $customGrpId1
*
* @return array
*/
}
/**
- * @param $profilefield
+ * Test profile creation.
+ *
+*@param $profileField
* @param int $location
* @param $type
*
* @return null
*/
- public function _testCreateProfile($profilefield, $location = 0, $type) {
- $locationfields = array(
+ public function _testCreateProfile($profileField, $location = 0, $type) {
+ $locationFields = array(
'supplemental_address_1',
'supplemental_address_2',
'city',
);
// Add new profile.
- $profilename = "Profile_" . substr(sha1(rand()), 0, 7);
+ $profileName = "Profile_" . substr(sha1(rand()), 0, 7);
$this->openCiviPage("admin/uf/group", "reset=1");
$this->click('newCiviCRMProfile-top');
$this->waitForElementPresent('_qf_Group_next-top');
//Name of profile
- $this->type('title', $profilename);
+ $this->type('title', $profileName);
$this->click('uf_group_type_Profile');
$this->click('_qf_Group_next-top');
$this->waitForPageToLoad($this->getTimeoutMsec());
$profileId = $this->urlArg('gid');
//Add field to profile_testCreateProfile
- foreach ($profilefield as $key => $value) {
+ foreach ($profileField as $key => $value) {
$this->openCiviPage("admin/uf/group/field/add", "reset=1&action=add&gid=$profileId");
- if (in_array($value, $locationfields)) {
+ if (in_array($value, $locationFields)) {
$this->select("field_name[0]", "value={$type}");
$this->select("field_name[1]", "value={$value}");
$this->select("field_name[2]", "value={$location}");
}
/**
+ * Test adding multiple profiles.
+ *
* @param int $profileId
*
* @return null
$this->type("city-Primary", "primecity");
$this->type("phone-Primary-1", "98667764");
$this->type("postal_code-Primary", "6548");
-
+ $this->waitForElementPresent('nick_name');
$this->type("nick_name", "Nick1");
$this->type("url-1", "http://www.part.com");
'edit-1-profile-listings-and-forms',
'edit-1-access-all-custom-data',
'edit-1-register-for-events',
- 'edit-1-make-online-contributions'
+ 'edit-1-make-online-contributions',
);
$this->changePermissions($permission);
// build forward url
$forwardUrl = array(
"mailing/forward",
- "reset=1&jid={$eventQueue->job_id}&qid={$eventQueue->id}&h={$eventQueue->hash}"
+ "reset=1&jid={$eventQueue->job_id}&qid={$eventQueue->id}&h={$eventQueue->hash}",
);
$this->openCiviPage($forwardUrl[0], $forwardUrl[1], NULL);
'Replies',
'Bounces',
'Unsubscribe Requests',
- 'Opt-out Requests'
+ 'Opt-out Requests',
);
//check for report and adv search links
$this->verifyText("xpath=//table//tr[td[1]/text()='Subject']/descendant::td[2]", preg_quote("Test subject $mailingName for Webtest"));
// after asserts do clicks and confirm filters
- $criteriaCheck =
- array(
- 'Intended Recipients' =>
- array(
- 'report' => array('report_name' => 'Mailing Details', 'Mailing' => "Mailing $mailingName Webtest"),
- 'search' => array('Mailing Name IN' => "\"Mailing {$mailingName} Webtest"),
- ),
- 'Successful Deliveries' =>
- array(
- 'report' => array(
- 'report_name' => 'Mailing Details',
- 'Mailing' => "Mailing $mailingName Webtest",
- "Delivery Status" => " Successful"
- ),
- 'search' => array(
- 'Mailing Name IN' => "\"Mailing {$mailingName} Webtest",
- 'Mailing Delivery -' => "Successful"
- ),
- ),
- 'Tracked Opens' =>
- array(
- 'report' => array('report_name' => 'Mail Opened', 'Mailing' => "Mailing $mailingName Webtest"),
- 'search' => array(
- 'Mailing Name IN' => "\"Mailing {$mailingName} Webtest",
- 'Mailing: Trackable Opens -' => "Opened"
- ),
- ),
- 'Click-throughs' =>
- array(
- 'report' => array('report_name' => 'Mail Clickthroughs', 'Mailing' => "Mailing $mailingName Webtest"),
- 'search' => array(
- 'Mailing Name IN' => "\"Mailing {$mailingName} Webtest",
- 'Mailing: Trackable URL Clicks -' => "Clicked"
- ),
- ),
- 'Forwards' =>
- array(
- 'report' => array(
- 'report_name' => 'Mailing Details',
- 'Mailing' => "Mailing $mailingName Webtest",
- 'Forwarded' => 'Is equal to Yes'
- ),
- 'search' => array('Mailing Name IN' => "\"Mailing {$mailingName} Webtest", 'Mailing: -' => "Forwards"),
- ),
- 'Replies' =>
- array(
- 'report' => array(
- 'report_name' => 'Mailing Details',
- 'Mailing' => "Mailing $mailingName Webtest",
- 'Replied' => 'Is equal to Yes'
- ),
- 'search' => array(
- 'Mailing Name IN' => "\"Mailing {$mailingName} Webtest",
- 'Mailing: Trackable Replies -' => "Replied"
- ),
- ),
- 'Bounces' =>
- array(
- 'report' => array('report_name' => 'Mail Bounces', 'Mailing' => "Mailing $mailingName Webtest"),
- 'search' => array(
- 'Mailing Name IN' => "\"Mailing {$mailingName} Webtest",
- 'Mailing Delivery -' => "Bounced"
- ),
- ),
- 'Unsubscribe Requests' =>
- array(
- 'report' => array(
- 'report_name' => 'Mailing Details',
- 'Mailing' => "Mailing $mailingName Webtest",
- 'Unsubscribed' => 'Is equal to Yes'
- ),
- 'search' => array(
- 'Mailing Name IN' => "\"Mailing {$mailingName} Webtest",
- 'Mailing: -' => "Unsubscribe Requests"
- ),
- ),
- 'Opt-out Requests' =>
- array(
- 'report' => array(
- 'report_name' => 'Mailing Details',
- 'Mailing' => "Mailing $mailingName Webtest",
- 'Opted-out' => 'Is equal to Yes'
- ),
- 'search' => array(
- 'Mailing Name IN' => "\"Mailing {$mailingName} Webtest",
- 'Mailing: -' => "Opt-out Requests"
- ),
- ),
- );
+ $criteriaCheck = array(
+ 'Intended Recipients' => array(
+ 'report' => array('report_name' => 'Mailing Details', 'Mailing' => "Mailing $mailingName Webtest"),
+ 'search' => array('Mailing Name IN' => "\"Mailing {$mailingName} Webtest"),
+ ),
+ 'Successful Deliveries' => array(
+ 'report' => array(
+ 'report_name' => 'Mailing Details',
+ 'Mailing' => "Mailing $mailingName Webtest",
+ "Delivery Status" => " Successful",
+ ),
+ 'search' => array(
+ 'Mailing Name IN' => "\"Mailing {$mailingName} Webtest",
+ 'Mailing Delivery -' => "Successful",
+ ),
+ ),
+ 'Tracked Opens' => array(
+ 'report' => array('report_name' => 'Mail Opened', 'Mailing' => "Mailing $mailingName Webtest"),
+ 'search' => array(
+ 'Mailing Name IN' => "\"Mailing {$mailingName} Webtest",
+ 'Mailing: Trackable Opens -' => "Opened",
+ ),
+ ),
+ 'Click-throughs' => array(
+ 'report' => array('report_name' => 'Mail Clickthroughs', 'Mailing' => "Mailing $mailingName Webtest"),
+ 'search' => array(
+ 'Mailing Name IN' => "\"Mailing {$mailingName} Webtest",
+ 'Mailing: Trackable URL Clicks -' => "Clicked",
+ ),
+ ),
+ 'Forwards' => array(
+ 'report' => array(
+ 'report_name' => 'Mailing Details',
+ 'Mailing' => "Mailing $mailingName Webtest",
+ 'Forwarded' => 'Is equal to Yes',
+ ),
+ 'search' => array('Mailing Name IN' => "\"Mailing {$mailingName} Webtest", 'Mailing: -' => "Forwards"),
+ ),
+ 'Replies' => array(
+ 'report' => array(
+ 'report_name' => 'Mailing Details',
+ 'Mailing' => "Mailing $mailingName Webtest",
+ 'Replied' => 'Is equal to Yes',
+ ),
+ 'search' => array(
+ 'Mailing Name IN' => "\"Mailing {$mailingName} Webtest",
+ 'Mailing: Trackable Replies -' => "Replied",
+ ),
+ ),
+ 'Bounces' => array(
+ 'report' => array('report_name' => 'Mail Bounces', 'Mailing' => "Mailing $mailingName Webtest"),
+ 'search' => array(
+ 'Mailing Name IN' => "\"Mailing {$mailingName} Webtest",
+ 'Mailing Delivery -' => "Bounced",
+ ),
+ ),
+ 'Unsubscribe Requests' => array(
+ 'report' => array(
+ 'report_name' => 'Mailing Details',
+ 'Mailing' => "Mailing $mailingName Webtest",
+ 'Unsubscribed' => 'Is equal to Yes',
+ ),
+ 'search' => array(
+ 'Mailing Name IN' => "\"Mailing {$mailingName} Webtest",
+ 'Mailing: -' => "Unsubscribe Requests",
+ ),
+ ),
+ 'Opt-out Requests' => array(
+ 'report' => array(
+ 'report_name' => 'Mailing Details',
+ 'Mailing' => "Mailing $mailingName Webtest",
+ 'Opted-out' => 'Is equal to Yes',
+ ),
+ 'search' => array(
+ 'Mailing Name IN' => "\"Mailing {$mailingName} Webtest",
+ 'Mailing: -' => "Opt-out Requests",
+ ),
+ ),
+ );
$this->criteriaCheck($criteriaCheck, $mailingReportUrl);
}
foreach (array(
'joinDate',
'startDate',
- 'endDate'
+ 'endDate',
) as $date) {
$$date = CRM_Utils_Date::customFormat($$date, $configVars->dateformatFull);
}
foreach (array(
'joinDate',
'startDate',
- 'endDate'
+ 'endDate',
) as $date) {
$$date = CRM_Utils_Date::customFormat($$date, $configVars->dateformatFull);
}
// Is status message correct?
$this->waitForText('crm-notification-container', "{$membershipTypes['membership_type']} membership for $firstName Memberson has been added.");
- $this->waitForElementPresent("xpath=//div[@id='memberships']//table/tbody/tr/td[9]/span[2][text()='more']/ul/li/a[text()='Renew']");
+ $this->waitForElementPresent("xpath=//div[@id='memberships']/div/table/tbody/tr/td[9]/span[2][text()='more']/ul/li[1]/a[text()='Renew']");
// click through to the Membership Renewal Link
- $this->click("xpath=//div[@id='memberships']//table/tbody/tr/td[9]/span[2][text()='more']/ul/li/a[text()='Renew']");
+ $this->click("xpath=//div[@id='memberships']/div/table/tbody/tr/td[9]/span[2][text()='more']/ul/li[1]/a[text()='Renew']");
$this->waitForElementPresent('_qf_MembershipRenewal_cancel-bottom');
foreach (array(
'joinDate',
'startDate',
- 'endDate'
+ 'endDate',
) as $date) {
$$date = CRM_Utils_Date::customFormat($$date, $configVars->dateformatFull);
}
foreach (array(
'joinDate',
'startDate',
- 'endDate'
+ 'endDate',
) as $date) {
$$date = CRM_Utils_Date::customFormat($$date, $configVars->dateformatFull);
}
$test = $this;
$this->customFieldSetLoadOnTheFlyCheck($customSets, $pageUrl,
function () use ($test) {
- $test->select('membership_type_id_0', 'value=1');
+ $test->select('membership_type_id_0', 'value=1');
}
);
}
'edit-1-profile-create',
'edit-1-profile-edit',
'edit-1-profile-listings',
- 'edit-1-profile-view'
+ 'edit-1-profile-view',
);
$this->changePermissions($permission);
* @param string $dataName
* @param array $browser
*/
- function __construct($name = NULL, array$data = array(), $dataName = '', array$browser = array()) {
+ public function __construct($name = NULL, array$data = array(), $dataName = '', array$browser = array()) {
parent::__construct($name, $data, $dataName, $browser);
require_once 'CiviTest/ReleaseTestSettings.php';
//visit the logging contact summary report
$this->openCiviPage('report/logging/contact/summary', 'reset=1');
+ $this->waitForElementPresent('altered_contact_value');
$this->type('altered_contact_value', $firstName);
$this->click("_qf_LoggingSummary_submit");
$this->waitForPageToLoad($this->getTimeoutMsec());
array(
"log_type" => "Relationship",
"altered_contact" => "{$firstName} {$lastName} [Employee of]",
- "action" => "Update"
+ "action" => "Update",
),
array(
"log_type" => "Relationship",
"altered_contact" => "{$firstName} {$lastName} [Employee of]",
- "action" => "Insert"
+ "action" => "Insert",
),
array(
"log_type" => "Relationship",
"altered_contact" => "{$firstName} {$lastName} [Employee of]",
- "action" => "Delete"
+ "action" => "Delete",
),
//group data check
array(
"log_type" => "Group",
"altered_contact" => "{$firstName} {$lastName} [Case Resources]",
- "action" => "Added"
+ "action" => "Added",
),
array(
"log_type" => "Group",
"altered_contact" => "{$firstName} {$lastName} [Case Resources]",
- "action" => "Removed"
+ "action" => "Removed",
),
//note data check
array("log_type" => "Note", "altered_contact" => "{$firstName} {$lastName}", "action" => "Update"),
array(
"log_type" => "Tag",
"altered_contact" => "{$firstName} {$lastName} [Government Entity]",
- "action" => "Insert"
+ "action" => "Insert",
),
array("log_type" => "Tag", "altered_contact" => "{$firstName} {$lastName} [Company]", "action" => "Delete"),
//case data check
array(
"log_type" => "Case",
"altered_contact" => "{$firstName} {$lastName} [Housing Support]",
- "action" => "Update"
+ "action" => "Update",
),
array(
"log_type" => "Case",
"altered_contact" => "{$firstName} {$lastName} [Housing Support]",
- "action" => "Insert"
+ "action" => "Insert",
),
//case activity check
array(
"log_type" => "Activity",
"altered_contact" => "{$firstName} {$lastName} [Interview]",
- "action" => "Update"
+ "action" => "Update",
),
array(
"log_type" => "Activity",
"altered_contact" => "{$firstName} {$lastName} [Interview]",
- "action" => "Insert"
+ "action" => "Insert",
),
);
$this->verifyReportData($data);
array(
'field' => 'Sort Name',
'changed_from' => "{$lastName}, {$originalFirstName}",
- 'changed_to' => "{$lastName}, {$firstName}"
+ 'changed_to' => "{$lastName}, {$firstName}",
),
array(
'field' => 'Display Name',
'changed_from' => "{$originalFirstName} {$lastName}",
- 'changed_to' => "{$firstName} {$lastName}"
+ 'changed_to' => "{$firstName} {$lastName}",
),
array('field' => 'First Name', 'changed_from' => $originalFirstName, 'changed_to' => $firstName),
// array('field' => 'Email Greeting', 'changed_from' => "Dear {$originalFirstName}", 'changed_to' => "Dear {$firstName}"),
array(
"log_type" => "Contact",
"altered_contact" => "{$firstName} {$lastName}",
- "action" => "Delete (to trash)"
- )
+ "action" => "Delete (to trash)",
+ ),
);
$this->verifyReportData($contactDataDelete);
$result = $this->callAPIAndDocument('activity', 'create', $params, __FUNCTION__, __FILE__, $description, $subfile);
$result = $this->callAPISuccess('activity', 'get', array(
- 'id' => $result['id'],
- 'version' => $this->_apiversion,
- 'return.assignee_contact_id' => 1,
- 'return.target_contact_id' => 1
- ));
+ 'id' => $result['id'],
+ 'version' => $this->_apiversion,
+ 'return.assignee_contact_id' => 1,
+ 'return.target_contact_id' => 1,
+ ));
$this->assertEquals($this->_contactID, $result['values'][$result['id']]['assignee_contact_id'][0], 'in line ' . __LINE__);
$this->assertEquals($this->_contactID, $result['values'][$result['id']]['target_contact_id'][0], 'in line ' . __LINE__);
$params['custom_' . $ids['custom_field_id']] = "custom string";
$result = $this->callAPIAndDocument($this->_entity, 'create', $params, __FUNCTION__, __FILE__);
$result = $this->callAPISuccess($this->_entity, 'get', array(
- 'return.custom_' . $ids['custom_field_id'] => 1,
- 'version' => 3,
- 'id' => $result['id']
- ));
+ 'return.custom_' . $ids['custom_field_id'] => 1,
+ 'version' => 3,
+ 'id' => $result['id'],
+ ));
$this->assertEquals("custom string", $result['values'][$result['id']]['custom_' . $ids['custom_field_id']], ' in line ' . __LINE__);
$this->customFieldDelete($ids['custom_field_id']);
$result = $this->callAPIAndDocument($this->_entity, 'create', $params, __FUNCTION__, __FILE__, $description, $subfile, 'Create');
$result = $this->callAPIAndDocument($this->_entity, 'get', array(
- 'return.custom_' . $customField['id'] => 1,
- 'id' => $result['id']
- ), __FUNCTION__, __FILE__, 'Get with Contact Ref Custom Field', 'ContactRefCustomFieldGet', 'get');
+ 'return.custom_' . $customField['id'] => 1,
+ 'id' => $result['id'],
+ ), __FUNCTION__, __FILE__, 'Get with Contact Ref Custom Field', 'ContactRefCustomFieldGet', 'get');
$this->assertEquals('Anderson, Anthony', $result['values'][$result['id']]['custom_' . $customField['id']], ' in line ' . __LINE__);
$this->assertEquals($this->_contactID, $result['values'][$result['id']]['custom_' . $customField['id'] . "_id"], ' in line ' . __LINE__);
$activity = $this->callAPISuccess('Activity', 'Create', $params);
$activityget = $this->callAPISuccess('Activity', 'get', array(
- 'id' => $activity['id'],
- 'target_contact_id' => $contact2,
- 'return.target_contact_id' => 1
- ));
+ 'id' => $activity['id'],
+ 'target_contact_id' => $contact2,
+ 'return.target_contact_id' => 1,
+ ));
$this->assertEquals($activity['id'], $activityget['id'], 'In line ' . __LINE__);
$this->assertEquals($contact2, $activityget['values'][$activityget['id']]['target_contact_id'][0], 'In line ' . __LINE__);
$activityget = $this->callAPISuccess('activity', 'get', array(
- 'target_contact_id' => $this->_contactID,
- 'return.target_contact_id' => 1,
- 'id' => $activity['id']
- ));
+ 'target_contact_id' => $this->_contactID,
+ 'return.target_contact_id' => 1,
+ 'id' => $activity['id'],
+ ));
if ($activityget['count'] > 0) {
$this->assertNotEquals($contact2, $activityget['values'][$activityget['id']]['target_contact_id'][0], 'In line ' . __LINE__);
}
$this->assertEquals(0, $result['count'], 'No activities of status 1 should exist');
$result = $this->callAPISuccess('Activity', 'Get', array(
'version' => $this->_apiversion,
- 'status_id' => '2'
+ 'status_id' => '2',
));
$this->assertEquals(0, $result['count'], 'No activities of status 1 should exist');
$activityId = $result['id'];
$result = $this->callAPISuccess($this->_entity, 'get', array(
- 'return.custom_' . $ids['custom_field_id'] => 1,
- 'version' => 3,
- 'id' => $result['id']
- ));
+ 'return.custom_' . $ids['custom_field_id'] => 1,
+ 'version' => 3,
+ 'id' => $result['id'],
+ ));
$this->assertEquals("custom string", $result['values'][$result['id']]['custom_' . $ids['custom_field_id']], ' in line ' . __LINE__);
$this->assertEquals("2009-10-18 00:00:00", $result['values'][$result['id']]['activity_date_time'], ' in line ' . __LINE__);
$fields = $this->callAPISuccess('activity', 'getfields', array('version' => $this->_apiversion));
$result = $this->callAPISuccess('Activity', 'Create', $params);
$result = $this->callAPISuccess($this->_entity, 'get', array(
- 'return.custom_' . $ids['custom_field_id'] => 1,
- 'version' => 3,
- 'id' => $result['id']
- ));
+ 'return.custom_' . $ids['custom_field_id'] => 1,
+ 'version' => 3,
+ 'id' => $result['id'],
+ ));
$this->assertEquals("Updated my test data", $result['values'][$result['id']]['custom_' . $ids['custom_field_id']], ' in line ' . __LINE__);
}
),
'api.activity.create' => array(
'subject' => 'send letter',
- 'activity_type_id' => '$value.api.activity_type.create.values.0.value'
+ 'activity_type_id' => '$value.api.activity_type.create.values.0.value',
),
));
protected $_ids = array();
protected $_pageParams = array();
+ /**
+ * Setup function.
+ */
public function setUp() {
parent::setUp();
);
}
+ /**
+ * Clean up after each test.
+ */
public function tearDown() {
$this->quickCleanUpFinancialEntities();
}
+ /**
+ * Test Get.
+ */
public function testGetContribution() {
$p = array(
'contact_id' => $this->_individualId,
$this->assertEquals(1, $contribution['count']);
$this->assertEquals($contribution['values'][$contribution['id']]['contact_id'], $this->_individualId);
- // note there was an assertion converting financial_type_id to 'Donation' which wasn't working.
- // passing back a string rather than an id seems like an error / cruft - & if it is to be introduced we should discuss
+ // Note there was an assertion converting financial_type_id to 'Donation' which wasn't working.
+ // Passing back a string rather than an id seems like an error/cruft.
+ // If it is to be introduced we should discuss.
$this->assertEquals($contribution['values'][$contribution['id']]['financial_type_id'], 1);
$this->assertEquals($contribution['values'][$contribution['id']]['total_amount'], 100.00);
$this->assertEquals($contribution['values'][$contribution['id']]['non_deductible_amount'], 10.00);
$this->assertEquals($contribution['values'][$contribution['id']]['invoice_id'], 78910);
$this->assertEquals($contribution['values'][$contribution['id']]['contribution_source'], 'SSF');
$this->assertEquals($contribution['values'][$contribution['id']]['contribution_status'], 'Completed');
- //create a second contribution - we are testing that 'id' gets the right contribution id (not the contact id)
+ // Create a second contribution - we are testing that 'id' gets the right contribution id (not the contact id).
$p['trxn_id'] = '3847';
$p['invoice_id'] = '3847';
$contribution2 = $this->callAPISuccess('contribution', 'create', $p);
- // now we have 2 - test getcount
+ // Now we have 2 - test getcount.
$contribution = $this->callAPISuccess('contribution', 'getcount', array());
$this->assertEquals(2, $contribution);
- //test id only format
+ // Test id only format.
$contribution = $this->callAPISuccess('contribution', 'get', array(
'id' => $this->_contribution['id'],
'format.only_id' => 1,
));
- $this->assertEquals($this->_contribution['id'], $contribution, print_r($contribution, TRUE) . " in line " . __LINE__);
- //test id only format
+ $this->assertEquals($this->_contribution['id'], $contribution, print_r($contribution, TRUE));
+ // Test id only format.
$contribution = $this->callAPISuccess('contribution', 'get', array(
'id' => $contribution2['id'],
'format.only_id' => 1,
));
$this->assertEquals($contribution2['id'], $contribution);
- //test id as field
+ // Test id as field.
$contribution = $this->callAPISuccess('contribution', 'get', array(
'id' => $this->_contribution['id'],
));
$this->assertEquals(1, $contribution['count']);
- //test get by contact id works
+ // Test get by contact id works.
$contribution = $this->callAPISuccess('contribution', 'get', array('contact_id' => $this->_individualId));
$this->assertEquals(2, $contribution['count']);
}
/**
- * We need to ensure previous tested behaviour still works as part of the api contract
+ * We need to ensure previous tested behaviour still works as part of the api contract.
*/
public function testGetContributionLegacyBehaviour() {
$p = array(
$this->assertEquals($contribution['values'][$contribution['id']]['invoice_id'], 78910);
$this->assertEquals($contribution['values'][$contribution['id']]['contribution_source'], 'SSF');
$this->assertEquals($contribution['values'][$contribution['id']]['contribution_status'], 'Completed');
- //create a second contribution - we are testing that 'id' gets the right contribution id (not the contact id)
+
+ // Create a second contribution - we are testing that 'id' gets the right contribution id (not the contact id).
$p['trxn_id'] = '3847';
$p['invoice_id'] = '3847';
'id' => $this->_contribution['id'],
'format.only_id' => 1,
));
- $this->assertEquals($this->_contribution['id'], $contribution, print_r($contribution, TRUE) . " in line " . __LINE__);
+ $this->assertEquals($this->_contribution['id'], $contribution, print_r($contribution, TRUE));
//test id only format
$contribution = $this->callAPISuccess('contribution', 'get', array(
'id' => $contribution2['id'],
);
$this->callAPISuccess('contribution', 'create', $params);
}
- /*
- * ensure we continue to support contribution_type_id as part of the api commitment to
- * stability
- *///////////////// civicrm_contribution_
-
- public function testCreateLegacyBehaviour() {
- $params = array(
- 'contribution_id' => FALSE,
- 'contact_id' => 1,
- 'total_amount' => 1,
- 'check_permissions' => FALSE,
- 'contribution_type_id' => 3,
- );
- $contribution = $this->callAPISuccess('contribution', 'create', $params);
- $contribution = $this->callAPISuccess('contribution', 'getsingle', array('id' => $contribution['id']));
- $this->assertEquals(3, $contribution['financial_type_id']);
- }
/**
* Check with complete array + custom field
));
$this->customFieldDelete($ids['custom_field_id']);
$this->customGroupDelete($ids['custom_group_id']);
- $this->assertEquals("custom string", $check['values'][$check['id']]['custom_' . $ids['custom_field_id']], ' in line ' . __LINE__);
+ $this->assertEquals("custom string", $check['values'][$check['id']]['custom_' . $ids['custom_field_id']]);
}
/**
- * Check with complete array + custom field
+ * Check with complete array + custom field.
+ *
* Note that the test is written on purpose without any
* variables specific to participant so it can be replicated into other entities
* and / or moved to the automated test suite
'contribution_payment_instrument' => 'Cash',
));
$this->assertArrayHasKey('payment_instrument', $contribution['values'][0]);
- $this->assertEquals('Cash',$contribution['values'][0]['payment_instrument']);
- $this->assertEquals(1,$contribution['count']);
- $contribution = $this->callAPISuccess('contribution','get',array('sequential' => 1, 'payment_instrument' => 'Cash'));
+ $this->assertEquals('Cash', $contribution['values'][0]['payment_instrument']);
+ $this->assertEquals(1, $contribution['count']);
+ $contribution = $this->callAPISuccess('contribution', 'get',array('sequential' => 1, 'payment_instrument' => 'Cash'));
$this->assertArrayHasKey('payment_instrument', $contribution['values'][0]);
$this->assertEquals('Cash',$contribution['values'][0]['payment_instrument']);
$this->assertEquals(1, $contribution['count']);
}
/**
- * Create test with unique field name on source
+ * Create test with unique field name on source.
*/
- public function testCreateContributionSourceInvalidContac() {
+ public function testCreateContributionSourceInvalidContact() {
$params = array(
'contact_id' => 999,
}
/**
- * Test note created correctly
+ * Test note created correctly.
*/
public function testCreateContributionWithNote() {
$description = "Demonstrates creating contribution with Note Entity";
}
/**
- * This is the test for creating soft credits - however a 'get' is not yet possible via API
- * as the current BAO functions are contact-centric (from what I can find)
+ * This is the test for creating soft credits.
*/
- public function testCreateContributionWithSoftCredt() {
+ public function testCreateContributionWithSoftCredit() {
$description = "Demonstrates creating contribution with SoftCredit";
$subfile = "ContributionCreateWithSoftCredit";
$contact2 = $this->callAPISuccess('Contact', 'create', array(
'display_name' => 'superman',
'contact_type' => 'Individual',
));
- $softparams = array(
+ $softParams = array(
'contact_id' => $contact2['id'],
'amount' => 50,
'soft_credit_type_id' => 3,
);
- $params = $this->_params + array('soft_credit' => array(1 => $softparams));
+ $params = $this->_params + array('soft_credit' => array(1 => $softParams));
$contribution = $this->callAPIAndDocument('contribution', 'create', $params, __FUNCTION__, __FILE__, $description, $subfile);
$result = $this->callAPISuccess('contribution', 'get', array('return' => 'soft_credit', 'sequential' => 1));
- $this->assertEquals($softparams['contact_id'], $result['values'][0]['soft_credit'][1]['contact_id']);
- $this->assertEquals($softparams['amount'], $result['values'][0]['soft_credit'][1]['amount']);
- $this->assertEquals($softparams['soft_credit_type_id'], $result['values'][0]['soft_credit'][1]['soft_credit_type']);
+ $this->assertEquals($softParams['contact_id'], $result['values'][0]['soft_credit'][1]['contact_id']);
+ $this->assertEquals($softParams['amount'], $result['values'][0]['soft_credit'][1]['amount']);
+ $this->assertEquals($softParams['soft_credit_type_id'], $result['values'][0]['soft_credit'][1]['soft_credit_type']);
$this->callAPISuccess('contribution', 'delete', array('id' => $contribution['id']));
$this->callAPISuccess('contact', 'delete', array('id' => $contact2['id']));
'contact_type' => 'Individual',
));
$params = $this->_params + array(
- 'soft_credit_to' => $contact2['id'],
- );
+ 'soft_credit_to' => $contact2['id'],
+ );
$contribution = $this->callAPIAndDocument('contribution', 'create', $params, __FUNCTION__, __FILE__, $description, $subfile);
$result = $this->callAPISuccess('contribution', 'get', array('return' => 'soft_credit', 'sequential' => 1));
'contact_type' => 'Individual',
));
$params = $this->_params + array(
- 'honor_contact_id' => $contact2['id'],
- );
+ 'honor_contact_id' => $contact2['id'],
+ );
$contribution = $this->callAPIAndDocument('contribution', 'create', $params, __FUNCTION__, __FILE__, $description, $subfile);
$result = $this->callAPISuccess('contribution', 'get', array('return' => 'soft_credit', 'sequential' => 1));
}
/**
- * Test using example code
+ * Test using example code.
*/
public function testContributionCreateExample() {
//make sure at least on page exists since there is a truncate in tear down
/**
- * Function tests that additional financial records are created when online contribution is created
+ * Function tests that additional financial records are created when online contribution is created.
*/
public function testCreateContributionOnline() {
CRM_Financial_BAO_PaymentProcessor::create($this->_processorParams);
}
/**
+ * Check handling of financial type.
+ *
* In the interests of removing financial type / contribution type checks from
* legacy format function lets test that the api is doing this for us
*/
}
/**
+ * Check handling of financial type.
+ *
* In the interests of removing financial type / contribution type checks from
* legacy format function lets test that the api is doing this for us
*/
}
/**
- * Function tests that additional financial records are created when online contribution with pay later option
- * is created
+ * Tests that additional financial records are created.
+ *
+ * Checks when online contribution with pay later option is created
*/
public function testCreateContributionPayLaterOnline() {
CRM_Financial_BAO_PaymentProcessor::create($this->_processorParams);
}
/**
- * Test that BAO defaults work
+ * Test that BAO defaults work.
*/
public function testCreateBAODefaults() {
unset($this->_params['contribution_source_id'], $this->_params['payment_instrument_id']);
$this->assertEquals($contribution['values'][$contributionID]['contact_id'], $this->_individualId);
$this->assertEquals($contribution['values'][$contributionID]['total_amount'], 110.00);
- $this->assertEquals($contribution['values'][$contributionID]['financial_type_id'],$this->_financialTypeId );
+ $this->assertEquals($contribution['values'][$contributionID]['financial_type_id'], $this->_financialTypeId);
$this->assertEquals($contribution['values'][$contributionID]['instrument_id'], $old_payment_instrument);
$this->assertEquals($contribution['values'][$contributionID]['non_deductible_amount'], 10.00);
$this->assertEquals($contribution['values'][$contributionID]['fee_amount'], $old_fee_amount);
);
$result = $this->callAPISuccess('contribution', 'delete', $params);
- $this->assertAPISuccess($result, 'in line' . __LINE__);
+ $this->assertAPISuccess($result);
}
///////////////// civicrm_contribution_delete methods
$params['contribution_source'] = $params['source'];
unset($params['source']);
foreach ($params as $key => $value) {
- $this->assertEquals($value, $values[$key], $key . " value: $value doesn't match " . print_r($values, TRUE) . 'in line' . __LINE__);
+ $this->assertEquals($value, $values[$key], $key . " value: $value doesn't match " . print_r($values, TRUE));
}
}
/**
* Check for Each data type: loop through available form input types
- **/
+ */
public function testCustomFieldCreateAllAvailableFormInputs() {
$gid = $this->customGroupCreate(array('extends' => 'Individual', 'title' => 'testAllFormInputs'));
$this->assertTrue(is_numeric($optionGroupID) && ($optionGroupID > 0));
$optionGroup = $this->callAPISuccess('option_group', 'getsingle', array(
- 'id' => $optionGroupID
+ 'id' => $optionGroupID,
));
$this->assertEquals($optionGroup['title'], 'Country');
$optionValueCount = $this->callAPISuccess('option_value', 'getcount', array(
- 'option_group_id' => $optionGroupID
+ 'option_group_id' => $optionGroupID,
));
$this->assertEquals(0, $optionValueCount);
}
$contactGroup = $this->customGroupCreate(array('extends' => 'Contact', 'title' => 'test_group_c'));
$contactField = $this->customFieldCreate(array(
'custom_group_id' => $contactGroup['id'],
- 'label' => 'For Contacts'
+ 'label' => 'For Contacts',
));
$indivGroup = $this->customGroupCreate(array('extends' => 'Individual', 'title' => 'test_group_i'));
$indivField = $this->customFieldCreate(array('custom_group_id' => $indivGroup['id'], 'label' => 'For Individuals'));
$activityGroup = $this->customGroupCreate(array('extends' => 'Activity', 'title' => 'test_group_a'));
$activityField = $this->customFieldCreate(array(
'custom_group_id' => $activityGroup['id'],
- 'label' => 'For Activities'
+ 'label' => 'For Activities',
));
// Check getfields
$contactIDs['a'] = $this->individualCreate(array(
'email' => 'include.me@example.org',
'first_name' => 'Includer',
- 'last_name' => 'Person'
+ 'last_name' => 'Person',
));
$contactIDs['b'] = $this->individualCreate(array(
'email' => 'exclude.me@example.org',
- 'last_name' => 'Excluder'
+ 'last_name' => 'Excluder',
));
$this->callAPISuccess('GroupContact', 'create', array(
'group_id' => $groupIDs['a'],
- 'contact_id' => $contactIDs['a']
+ 'contact_id' => $contactIDs['a'],
));
$this->callAPISuccess('GroupContact', 'create', array(
'group_id' => $groupIDs['b'],
- 'contact_id' => $contactIDs['b']
+ 'contact_id' => $contactIDs['b'],
));
// END SAMPLE DATA
$contactIDs['include_me'] = $this->individualCreate(array(
'email' => 'include.me@example.org',
'first_name' => 'Includer',
- 'last_name' => 'Person'
+ 'last_name' => 'Person',
));
$contactIDs['exclude_me'] = $this->individualCreate(array(
'email' => 'exclude.me@example.org',
));
$this->callAPISuccess('GroupContact', 'create', array(
'group_id' => $groupIDs['inc'],
- 'contact_id' => $contactIDs['include_me']
+ 'contact_id' => $contactIDs['include_me'],
));
$this->callAPISuccess('GroupContact', 'create', array(
'group_id' => $groupIDs['inc'],
- 'contact_id' => $contactIDs['exclude_me']
+ 'contact_id' => $contactIDs['exclude_me'],
));
$this->callAPISuccess('GroupContact', 'create', array(
'group_id' => $groupIDs['exc'],
- 'contact_id' => $contactIDs['exclude_me']
+ 'contact_id' => $contactIDs['exclude_me'],
));
$params = $this->_params;
$contactIDs['alice'] = $this->individualCreate(array(
'email' => 'alice@example.org',
'first_name' => 'Alice',
- 'last_name' => 'Person'
+ 'last_name' => 'Person',
));
$mail = $this->callAPISuccess('mailing', 'create', $this->_params);
$contactIDs['alice'] = $this->individualCreate(array(
'email' => 'alice@example.org',
'first_name' => 'Alice',
- 'last_name' => 'Person'
+ 'last_name' => 'Person',
));
$contactIDs['bob'] = $this->individualCreate(array(
'email' => 'bob@example.org',
'first_name' => 'Bob',
- 'last_name' => 'Person'
+ 'last_name' => 'Person',
));
$contactIDs['carol'] = $this->individualCreate(array(
'email' => 'carol@example.org',
'first_name' => 'Carol',
- 'last_name' => 'Person'
+ 'last_name' => 'Person',
));
$this->callAPISuccess('GroupContact', 'create', array(
'group_id' => $groupIDs['inc'],
- 'contact_id' => $contactIDs['alice']
+ 'contact_id' => $contactIDs['alice'],
));
$this->callAPISuccess('GroupContact', 'create', array(
'group_id' => $groupIDs['inc'],
- 'contact_id' => $contactIDs['bob']
+ 'contact_id' => $contactIDs['bob'],
));
$this->callAPISuccess('GroupContact', 'create', array(
'group_id' => $groupIDs['inc'],
- 'contact_id' => $contactIDs['carol']
+ 'contact_id' => $contactIDs['carol'],
));
// END SAMPLE DATA
$this->customGroupDelete($ids['custom_group_id']);
}
- /*
- */
public function testgetfieldspledge() {
$result = $this->callAPISuccess('pledge', 'getfields', array('action' => 'get'));
$this->assertEquals(1, $result['values']['next_pay_date']['api.return']);
$this->assertEquals($oldPledge['id'], $earlyPledge['id'], ' check correct pledge returned ' . __LINE__);
}
- /*
+ /**
* create 2 pledges - see if we can get by status id
*/
public function testGetOverduePledge() {
}
- /*
+ /**
* create 2 pledges - see if we can get by status id
*/
public function testSortParamPledge() {
$pledge = $this->callAPISuccess('pledge', 'delete', $pledgeID);
}
- /*
+ /**
* Test that pledge with weekly schedule calculates dates correctly
*/
public function testCreatePledgeWeeklySchedule() {
//ensure that correct number of payments created & last payment has the right date
$payments = $this->callAPISuccess('PledgePayment', 'Get', array(
'pledge_id' => $pledge['id'],
- 'sequential' => 1
+ 'sequential' => 1,
));
$this->assertEquals($payments['count'], 5, 'In line ' . __LINE__);
$this->assertEquals('2011-07-06 00:00:00', $payments['values'][4]['scheduled_date'], 'In line ' . __LINE__);
$pledge = $this->callAPISuccess('pledge', 'delete', $pledgeID);
}
- /*
- * test that using original_installment_amount rather than pledge_original_installment_amount works
- * Pledge field behaviour is a bit random & so pledge has come to try to handle both unique & non -unique fields
- */
+ /**
+ * test that using original_installment_amount rather than pledge_original_installment_amount works
+ * Pledge field behaviour is a bit random & so pledge has come to try to handle both unique & non -unique fields
+ */
public function testCreatePledgeWithNonUnique() {
$params = $this->_params;
$params['original_installment_amount'] = $params['pledge_original_installment_amount'];
$pledge = $this->callAPISuccess('pledge', 'delete', $new_params);
}
- ///////////////// civicrm_pledge_delete methods
public function testDeleteEmptyParamsPledge() {
$pledge = $this->callAPIFailure('pledge', 'delete', array(), 'Mandatory key(s) missing from params array: id');
}
);
}
- // function tearDown() {
- // $this->quickCleanup(array('civicrm_product'), TRUE);
- // }
-
public function testGetFields() {
$fields = $this->callAPISuccess($this->_entity, 'getfields', array('action' => 'create'));
$this->assertArrayHasKey('period_type', $fields['values']);
'contact_id' => $contactId,
'street_address' => '25 Big Street',
'city' => 'big city',
- 'location_type_id' => 5
+ 'location_type_id' => 5,
));
$this->callAPISuccess('email', 'create', array(
'contact_id' => $contactId,
'email' => 'big@once.com',
'location_type_id' => 2,
- 'is_billing' => 1
+ 'is_billing' => 1,
));
$expected = current($individual);
$this->_addCustomFieldToProfile($this->_profileID);
$result = $this->callAPIAndDocument('profile', 'getfields', array(
'action' => 'submit',
- 'profile_id' => $this->_profileID
+ 'profile_id' => $this->_profileID,
), __FUNCTION__, __FILE__,
'demonstrates retrieving profile fields passing in an id');
$this->assertArrayKeyExists('first_name', $result['values']);
$result = $this->callAPISuccess('profile', 'getfields', array(
'action' => 'submit',
'profile_id' => 'participant_status',
- 'get_options' => 'all'
+ 'get_options' => 'all',
)
);
$this->assertTrue(array_key_exists('participant_status_id', $result['values']));
$result = $this->callAPISuccess('profile', 'getfields', array(
'action' => 'submit',
'profile_id' => 'membership_batch_entry',
- 'get_options' => 'all'
+ 'get_options' => 'all',
)
);
$this->assertTrue(array_key_exists('total_amount', $result['values']));
$this->assertEquals(array(
'contribution_type_id',
'contribution_type',
- 'financial_type'
+ 'financial_type',
), $result['values']['financial_type_id']['api.aliases']);
$this->assertTrue(!array_key_exists('financial_type', $result['values']));
$this->assertEquals(12, $result['values']['receive_date']['type']);
$result = $this->callAPISuccess('profile', 'getfields', array(
'action' => 'submit',
'profile_id' => $profileID,
- 'get_options' => 'all'
+ 'get_options' => 'all',
)
);
}
$profileFields = $this->callAPISuccess('profile', 'getfields', array(
'get_options' => 'all',
'action' => 'submit',
- 'profile_id' => 'membership_batch_entry'
+ 'profile_id' => 'membership_batch_entry',
));
$getoptions = $this->callAPISuccess('membership', 'getoptions', array(
'field' => 'membership_type',
- 'context' => 'validate'
+ 'context' => 'validate',
));
$this->assertEquals(array_keys($membershipTypes['values']), array_keys($getoptions['values']));
$this->assertEquals(array_keys($membershipTypes['values']), array_keys($profileFields['values']['membership_type_id']['options']));
public function testMembershipGetFieldsOrder() {
$result = $this->callAPISuccess('profile', 'getfields', array(
'action' => 'submit',
- 'profile_id' => 'membership_batch_entry'
+ 'profile_id' => 'membership_batch_entry',
));
$weight = 1;
foreach ($result['values'] as $fieldName => $field) {
foreach (array(
'email',
'phone',
- 'address'
+ 'address',
) as $fieldType) {
$typeValues = array_pop($result['values'][$fieldType]);
foreach ($expected[$fieldType] as $field => $value) {
$this->uFFieldCreate(array(
'uf_group_id' => $profileID,
'field_name' => 'custom_' . $ids['custom_field_id'],
- 'contact_type' => 'Contact'
+ 'contact_type' => 'Contact',
));
}
}
'Survey' => 'CiviCampaign',
);
- /* they are two types of missing APIs:
- - Those that are to be implemented
- (in some future version when someone steps in -hint hint-). List the entities in toBeImplemented[ {$action} ]
- Those that don't exist
- and that will never exist (eg an obsoleted Entity
- they need to be returned by the function toBeSkipped_{$action} (because it has to be a static method and therefore couldn't access a this->toBeSkipped)
- */
+ /**
+ * Set up function.
+ *
+ * There are two types of missing APIs:
+ * Those that are to be implemented
+ * (in some future version when someone steps in -hint hint-). List the entities in toBeImplemented[ {$action} ]
+ * Those that don't exist
+ * and that will never exist (eg an obsoleted Entity
+ * they need to be returned by the function toBeSkipped_{$action} (because it has to be a static method and therefore couldn't access a this->toBeSkipped)
+ */
public function setUp() {
parent::setUp();
$this->enableCiviCampaign();
'Extension',
'ReportTemplate',
'System',
- 'Setting'
+ 'Setting',
);
$this->toBeImplemented['create'] = array(
'SurveyRespondant',
'CustomSearch',
'Extension',
'ReportTemplate',
- 'System'
+ 'System',
);
$this->toBeImplemented['delete'] = array(
'MembershipPayment',
'UFMatch',
'Extension',
'LocationType',
- 'System'
+ 'System',
+ );
+ $this->onlyIDNonZeroCount['get'] = array(
+ 'ActivityType',
+ 'Entity',
+ 'Domain',
+ 'Setting',
);
- $this->onlyIDNonZeroCount['get'] = array('ActivityType', 'Entity', 'Domain', 'Setting');
$this->deprecatedAPI = array('Location', 'ActivityType', 'SurveyRespondant');
$this->deletableTestObjects = array();
}
}
/**
- * @param null $skip
+ * Generate list of all entities.
+ *
+ * @param array $skip
+ * Entities to skip.
*
* @return array
*/
- public static function entities($skip = NULL) {
+ public static function entities($skip = array()) {
// The order of operations in here is screwy. In the case where SYNTAX_CONFORMANCE_ENTITIES is
// defined, we should be able to parse+return it immediately. However, some weird dependency
// crept into the system where civicrm_api('Entity','get') must be called as part of entities()
}
/**
+ * Get list of entities for get test.
+ *
* @return array
*/
public static function entities_get() {
}
/**
+ * Get entities for create tests.
+ *
* @return array
*/
public static function entities_create() {
}
/**
+ * Get entities to be skipped on get tests.
+ *
* @param bool $sequential
*
* @return array
'MailingEventConfirm',
'MailingEventResubscribe',
'MailingEventUnsubscribe',
- 'Location'
+ 'Location',
);
if ($sequential === TRUE) {
return $entitiesWithoutGet;
}
/**
+ * Get entities to be skipped for get call.
+ *
* Mailing Contact Just doesn't support id. We have always insisted on finding a way to
* support id in API but in this case the underlying tables are crying out for a restructure
* & it just doesn't make sense, on the otherhand Event need id to be existant as pseudo property
'Domain',
'Profile',
'CustomValue',
- 'Setting'
+ 'Setting',
);
if ($sequential === TRUE) {
return $entitiesWithout;
)
);
$this->_apiversion = 3;
- $op = new PHPUnit_Extensions_Database_Operation_Insert;
+ $op = new PHPUnit_Extensions_Database_Operation_Insert();
$op->execute(
$this->_dbconn,
$this->createFlatXMLDataSet(dirname(__FILE__) . '/dataset/uf_group_test.xml')
)
);
$this->_contactId = $this->individualCreate();
- $op = new PHPUnit_Extensions_Database_Operation_Insert;
+ $op = new PHPUnit_Extensions_Database_Operation_Insert();
$op->execute(
$this->_dbconn,
$this->createFlatXMLDataSet(dirname(__FILE__) . '/dataset/uf_group_test.xml')
{literal}<?php{/literal}
/**
- * Test Generated example of using {$fnPrefix} {$action} API
- *{if $description} {$description}{/if}
+ * @file
+ * Test Generated API Example.
+ * See bottom of this file for more detail.
+ */
+
+/**
+ * Test Generated example of using {$fnPrefix} {$action} API.
+ *
+{if $description}
+ * {$description}
+{/if}
*
+ * @return array
+ * API result array
*/
-function {$function}_example(){literal}{{/literal}
-$params = {$params|@print_array};
+function {$function}_example() {literal}{{/literal}
+ $params = {$params|@print_array};
{literal}
-try{{/literal}
- $result = civicrm_api3('{$fnPrefix}', '{$action}', $params);
-{literal}}
-catch (CiviCRM_API3_Exception $e) {
- // handle error here
- $errorMessage = $e->getMessage();
- $errorCode = $e->getErrorCode();
- $errorData = $e->getExtraParams();
- return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData);
-}{/literal}
+ try{{/literal}
+ $result = civicrm_api3('{$fnPrefix}', '{$action}', $params);
+{literal} }
+ catch (CiviCRM_API3_Exception $e) {
+ // Handle error here.
+ $errorMessage = $e->getMessage();
+ $errorCode = $e->getErrorCode();
+ $errorData = $e->getExtraParams();
+ return array(
+ 'error' => $errorMessage,
+ 'error_code' => $errorCode,
+ 'error_data' => $errorData,
+ );
+ }{/literal}
-return $result;
+ return $result;
{literal}}{/literal}
/**
- * Function returns array of result expected from previous function
+ * Function returns array of result expected from previous function.
+ *
+ * @return array
+ * API result array
*/
-function {$function}_expectedresult(){literal}{{/literal}
+function {$function}_expectedresult() {literal}{{/literal}
$expectedResult = {$result|@print_array};
return $expectedResult;
{literal}}{/literal}
-
-/*
-* This example has been generated from the API test suite. The test that created it is called
-*
-* {$testfunction} and can be found in
+/**
+* This example has been generated from the API test suite.
+* The test that created it is called
+* {$testfunction}
+* and can be found in
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/{$filename}
*
* You can see the outcome of the API tests at
<?xml version="1.0" encoding="iso-8859-1" ?>
<version>
- <version_no>4.6.alpha2</version_no>
+ <version_no>4.6.alpha3</version_no>
</version>